Commit 002d235c5ab05a2116976d2f1747dc651c0d0d92
1 parent
f2a60a6315
Exists in
master
and in
1 other branch
座机号 替换的问题
Showing 9 changed files with 525 additions and 83 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
- platform-biz-service/src/main/resources/mainOrm/slave/Users.xml
- platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/ConvertHelper.java
- platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/SyncDataWork.java
- platform-job-index/src/main/java/com/lyms/platform/job/index/web/controller/SyncDataController.java
- platform-job-index/src/main/resources/lable.properties
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
View file @
002d235
| ... | ... | @@ -191,7 +191,7 @@ | 
| 191 | 191 | PatientsQuery patientsQuery = new PatientsQuery(); | 
| 192 | 192 | patientsQuery.setYn(YnEnums.YES.getId()); | 
| 193 | 193 | patientsQuery.setType(1); | 
| 194 | - patientsQuery.setLastMensesEnd(endDate); | |
| 194 | + patientsQuery.setLastMensesNeEnd(endDate); | |
| 195 | 195 | List<Patients> patientses = queryPatient(patientsQuery); | 
| 196 | 196 | List<PersonModel> list = null; | 
| 197 | 197 | for (Patients patients : patientses) { | 
platform-biz-service/src/main/resources/mainOrm/slave/Users.xml
View file @
002d235
| ... | ... | @@ -97,6 +97,12 @@ | 
| 97 | 97 | <if test="created != null"> | 
| 98 | 98 | created = #{created,jdbcType=TIMESTAMP}, | 
| 99 | 99 | </if> | 
| 100 | + <if test="gteModified != null"> | |
| 101 | + and modified >= #{gteModified,jdbcType=TIMESTAMP} | |
| 102 | + </if> | |
| 103 | + <if test="gteCreated != null"> | |
| 104 | + and created >= #{gteCreated,jdbcType=TIMESTAMP} | |
| 105 | + </if> | |
| 100 | 106 | <if test="remarks != null "> | 
| 101 | 107 | remarks = #{remarks,jdbcType=VARCHAR}, | 
| 102 | 108 | </if> | 
platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
View file @
002d235
| ... | ... | @@ -26,8 +26,17 @@ | 
| 26 | 26 | private Date nextCheckTimeEnd; | 
| 27 | 27 | //大于修改时间 | 
| 28 | 28 | private Date gteModified; | 
| 29 | + private Date gteCreated; | |
| 29 | 30 | private String pid; | 
| 30 | 31 | |
| 32 | + public Date getGteCreated() { | |
| 33 | + return gteCreated; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public void setGteCreated(Date gteCreated) { | |
| 37 | + this.gteCreated = gteCreated; | |
| 38 | + } | |
| 39 | + | |
| 31 | 40 | public Date getGteModified() { | 
| 32 | 41 | return gteModified; | 
| 33 | 42 | } | 
| 34 | 43 | |
| ... | ... | @@ -146,9 +155,16 @@ | 
| 146 | 155 | |
| 147 | 156 | if(null!=gteModified){ | 
| 148 | 157 | if (null != c) { | 
| 149 | - c = c.gte(gteModified); | |
| 158 | + c = c.where("modified").gte(gteModified); | |
| 150 | 159 | } else { | 
| 151 | 160 | c = Criteria.where("modified").gte(gteModified); | 
| 161 | + } | |
| 162 | + } | |
| 163 | + if(null!=gteCreated){ | |
| 164 | + if (null != c) { | |
| 165 | + c = c.where("created").gte(gteCreated); | |
| 166 | + } else { | |
| 167 | + c = Criteria.where("created").gte(gteCreated); | |
| 152 | 168 | } | 
| 153 | 169 | } | 
| 154 | 170 | 
platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
View file @
002d235
| ... | ... | @@ -28,6 +28,27 @@ | 
| 28 | 28 | |
| 29 | 29 | private boolean neEnd; | 
| 30 | 30 | |
| 31 | + //大于修改时间 | |
| 32 | + private Date gteModified; | |
| 33 | + | |
| 34 | + private Date gteCreated; | |
| 35 | + | |
| 36 | + public Date getGteCreated() { | |
| 37 | + return gteCreated; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setGteCreated(Date gteCreated) { | |
| 41 | + this.gteCreated = gteCreated; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public Date getGteModified() { | |
| 45 | + return gteModified; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setGteModified(Date gteModified) { | |
| 49 | + this.gteModified = gteModified; | |
| 50 | + } | |
| 51 | + | |
| 31 | 52 | public boolean isNeEnd() { | 
| 32 | 53 | return neEnd; | 
| 33 | 54 | } | 
| ... | ... | @@ -114,6 +135,21 @@ | 
| 114 | 135 | } | 
| 115 | 136 | isAddStart = Boolean.TRUE; | 
| 116 | 137 | } | 
| 138 | + if(null!=gteModified){ | |
| 139 | + if (null != c) { | |
| 140 | + c = c.where("modified").gte(gteModified); | |
| 141 | + } else { | |
| 142 | + c = Criteria.where("modified").gte(gteModified); | |
| 143 | + } | |
| 144 | + } | |
| 145 | + if(null!=gteCreated){ | |
| 146 | + if (null != c) { | |
| 147 | + c = c.where("created").gte(gteCreated); | |
| 148 | + } else { | |
| 149 | + c = Criteria.where("created").gte(gteCreated); | |
| 150 | + } | |
| 151 | + } | |
| 152 | + | |
| 117 | 153 | |
| 118 | 154 | if (null != end) { | 
| 119 | 155 | if (isAddStart) { | 
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
002d235
| ... | ... | @@ -78,7 +78,16 @@ | 
| 78 | 78 | |
| 79 | 79 | private Date lastRhTimeStart; | 
| 80 | 80 | private Date lastRhTimeEnd; | 
| 81 | + private Date lastMensesNeEnd; | |
| 81 | 82 | |
| 83 | + public Date getLastMensesNeEnd() { | |
| 84 | + return lastMensesNeEnd; | |
| 85 | + } | |
| 86 | + | |
| 87 | + public void setLastMensesNeEnd(Date lastMensesNeEnd) { | |
| 88 | + this.lastMensesNeEnd = lastMensesNeEnd; | |
| 89 | + } | |
| 90 | + | |
| 82 | 91 | private String pid; | 
| 83 | 92 | |
| 84 | 93 | public Date getLastRhTimeEnd() { | 
| 85 | 94 | |
| ... | ... | @@ -215,7 +224,17 @@ | 
| 215 | 224 | //大于修改时间 | 
| 216 | 225 | private Date gteModified; | 
| 217 | 226 | //大于创建时间 | 
| 227 | + //大于创建时间 | |
| 228 | + private Date gteCreated; | |
| 218 | 229 | |
| 230 | + public Date getGteCreated() { | |
| 231 | + return gteCreated; | |
| 232 | + } | |
| 233 | + | |
| 234 | + public void setGteCreated(Date gteCreated) { | |
| 235 | + this.gteCreated = gteCreated; | |
| 236 | + } | |
| 237 | + | |
| 219 | 238 | public Date getGteModified() { | 
| 220 | 239 | return gteModified; | 
| 221 | 240 | } | 
| 222 | 241 | |
| ... | ... | @@ -681,12 +700,20 @@ | 
| 681 | 700 | |
| 682 | 701 | if (null != gteModified) { | 
| 683 | 702 | if (null!=c1) { | 
| 684 | - c1 = c1.gte(gteModified); | |
| 703 | + c1 = c1.where("modified").gte(gteModified); | |
| 685 | 704 | } else { | 
| 686 | 705 | c1 = Criteria.where("modified").gte(gteModified); | 
| 687 | 706 | } | 
| 688 | 707 | } | 
| 689 | 708 | |
| 709 | + if(null!=gteCreated){ | |
| 710 | + if (null != c1) { | |
| 711 | + c1 = c1.where("created").gte(gteCreated); | |
| 712 | + } else { | |
| 713 | + c1 = Criteria.where("created").gte(gteCreated); | |
| 714 | + } | |
| 715 | + } | |
| 716 | + | |
| 690 | 717 | // Criteria cr1 = Criteria.where("bookbuildingDate").gte(bookbuildingDateStart).lte(bookbuildingDateEnd); | 
| 691 | 718 | // Criteria cr = cr1.where("lastMenses").gte(lastMensesStart).lte(lastMensesEnd); | 
| 692 | 719 | |
| ... | ... | @@ -710,6 +737,13 @@ | 
| 710 | 737 | } | 
| 711 | 738 | } | 
| 712 | 739 | |
| 740 | + if (null != lastMensesNeEnd) { | |
| 741 | + if (c1!=null) { | |
| 742 | + c1 = c1.lt(lastMensesNeEnd); | |
| 743 | + } else { | |
| 744 | + c1 = Criteria.where("lastMenses").lt(lastMensesNeEnd); | |
| 745 | + } | |
| 746 | + } | |
| 713 | 747 | |
| 714 | 748 | if (null != dueDateStart) { | 
| 715 | 749 | if(null!=c1){ | 
platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/ConvertHelper.java
View file @
002d235
| 1 | 1 | package com.lyms.platform.job.index.restore.data; | 
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 3 | 4 | import com.lyms.platform.common.utils.DateUtil; | 
| 4 | 5 | import com.lyms.platform.common.utils.JsonUtil; | 
| 5 | 6 | import com.lyms.platform.common.utils.ReflectionUtils; | 
| 7 | +import com.lyms.platform.common.utils.StringUtils; | |
| 6 | 8 | import com.lyms.platform.permission.model.Organization; | 
| 7 | 9 | import com.lyms.platform.pojo.AntExChuModel; | 
| 10 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
| 8 | 11 | import com.lyms.platform.pojo.Patients; | 
| 9 | 12 | import com.lymsh.mommybaby.maindata.model.DoctorUsers; | 
| 10 | 13 | import com.lymsh.mommybaby.maindata.model.Hospitals; | 
| 11 | 14 | import com.lymsh.mommybaby.maindata.model.Reports; | 
| 15 | +import org.apache.commons.collections.CollectionUtils; | |
| 12 | 16 | import org.apache.commons.lang.math.NumberUtils; | 
| 13 | 17 | import org.springframework.core.io.ClassPathResource; | 
| 14 | 18 | import org.springframework.core.io.support.EncodedResource; | 
| ... | ... | @@ -179,7 +183,7 @@ | 
| 179 | 183 | * @param antExChuModel | 
| 180 | 184 | * @return | 
| 181 | 185 | */ | 
| 182 | - public static Reports convertAntExChu(AntExChuModel antExChuModel, Date lastMenses) { | |
| 186 | + public static Reports convertAntExChu(AntExChuModel antExChuModel, Date lastMenses,Map map,String doctorUserName) { | |
| 183 | 187 | Reports reports = new Reports(); | 
| 184 | 188 | //孕期类型 | 
| 185 | 189 | reports.setType(1); | 
| ... | ... | @@ -193,7 +197,7 @@ | 
| 193 | 197 | //产检报告 | 
| 194 | 198 | reports.setCheckType(3); | 
| 195 | 199 | reports.setPublishName(AUTO_WORKER); | 
| 196 | - | |
| 200 | + reports.setNextCheckTime(antExChuModel.getNextCheckTime()); | |
| 197 | 201 | Integer dueWeek = null; | 
| 198 | 202 | if (null != antExChuModel.getcDueWeek()) { | 
| 199 | 203 | dueWeek = NumberUtils.toInt(antExChuModel.getcDueWeek()); | 
| 200 | 204 | |
| 201 | 205 | |
| ... | ... | @@ -201,18 +205,50 @@ | 
| 201 | 205 | dueWeek = DateUtil.getWeek(lastMenses, antExChuModel.getCheckTime()); | 
| 202 | 206 | } | 
| 203 | 207 | reports.setWeeks(dueWeek); | 
| 204 | - reports.setResult(convertAntExChuResult(antExChuModel)); | |
| 208 | + reports.setResult(convertAntExChuResult(antExChuModel, map, doctorUserName)); | |
| 205 | 209 | |
| 206 | 210 | return reports; | 
| 207 | 211 | } | 
| 208 | 212 | |
| 209 | 213 | /** | 
| 214 | + * 转换检查报告 | |
| 215 | + * | |
| 216 | + * @param antExChuModel | |
| 217 | + * @return | |
| 218 | + */ | |
| 219 | + public static Reports convertAntExChu(AntenatalExaminationModel antExChuModel, Date lastMenses,Map<String,String> rhMap,String doctorUserName) { | |
| 220 | + Reports reports = new Reports(); | |
| 221 | + //孕期类型 | |
| 222 | + reports.setType(1); | |
| 223 | + reports.setPhysicalTime(antExChuModel.getCheckDate()); | |
| 224 | + reports.setForeignId(antExChuModel.getId()); | |
| 225 | + reports.setDesignation("复诊"); | |
| 226 | + reports.setCreated(antExChuModel.getCreated()); | |
| 227 | + reports.setModified(antExChuModel.getModified()); | |
| 228 | + reports.setYn(antExChuModel.getYn()); | |
| 229 | + reports.setPublishId(0); | |
| 230 | + //产检报告 | |
| 231 | + reports.setCheckType(3); | |
| 232 | + reports.setPublishName(AUTO_WORKER); | |
| 233 | + reports.setNextCheckTime(antExChuModel.getNextCheckTime()); | |
| 234 | + Integer dueWeek = null; | |
| 235 | + if (null != antExChuModel.getcDueWeek()) { | |
| 236 | + dueWeek = NumberUtils.toInt(antExChuModel.getcDueWeek()); | |
| 237 | + } else { | |
| 238 | + dueWeek = DateUtil.getWeek(lastMenses, antExChuModel.getCheckDate()); | |
| 239 | + } | |
| 240 | + reports.setWeeks(dueWeek); | |
| 241 | + reports.setResult(convertAntExResult(antExChuModel,rhMap,doctorUserName)); | |
| 242 | + return reports; | |
| 243 | + } | |
| 244 | + | |
| 245 | + /** | |
| 210 | 246 | * 把初诊转换成json | 
| 211 | 247 | * | 
| 212 | 248 | * @param antExChuModel | 
| 213 | 249 | * @return | 
| 214 | 250 | */ | 
| 215 | - private static String convertAntExChuResult(AntExChuModel antExChuModel) { | |
| 251 | + private static String convertAntExChuResult(AntExChuModel antExChuModel,Map<String,String> bgMap,String doctorUserName) { | |
| 216 | 252 | List list = new ArrayList(); | 
| 217 | 253 | |
| 218 | 254 | List<String> list2 = getField(antExChuModel); | 
| 219 | 255 | |
| 220 | 256 | |
| 221 | 257 | |
| ... | ... | @@ -221,14 +257,77 @@ | 
| 221 | 257 | String key = properties.getProperty(list2.get(i)); | 
| 222 | 258 | java.util.Map<String, Object> dataMap = new HashMap<>(); | 
| 223 | 259 | if (null != key) { | 
| 260 | + if ("血压".equals(key)) { | |
| 261 | + Map map = JsonUtil.str2Obj(antExChuModel.getBp(), Map.class); | |
| 262 | + if (null != map) { | |
| 263 | + String ssy =null; | |
| 264 | + String szy =null; | |
| 265 | + Object obj1 = map.get("ssy"); | |
| 266 | + if(null!=obj1){ | |
| 267 | + //低压 | |
| 268 | + ssy= map.get("ssy").toString(); | |
| 269 | + } | |
| 270 | + obj1 = map.get("szy"); | |
| 271 | + if(null!=obj1){ | |
| 272 | + szy= map.get("szy").toString(); | |
| 273 | + } | |
| 274 | + //高压 | |
| 275 | + if (StringUtils.isNotEmpty(szy)) { | |
| 276 | + java.util.Map<String, Object> dataMap1 = new HashMap<>(); | |
| 277 | + dataMap1.put("k", "血压(低压)"); | |
| 278 | + dataMap1.put("v", szy+"mmHg"); | |
| 279 | + list.add(dataMap1); | |
| 280 | + } | |
| 281 | + if (StringUtils.isNotEmpty(ssy)) { | |
| 282 | + dataMap.put("k", "高压"); | |
| 283 | + dataMap.put("v", ssy+"mmHg"); | |
| 284 | + list.add(dataMap); | |
| 285 | + } | |
| 286 | + } | |
| 287 | + continue; | |
| 288 | + } | |
| 289 | + //高危 | |
| 290 | + if ("高危因素".equals(key)) { | |
| 291 | + List map = JsonUtil.toList(antExChuModel.getHighrisk(), List.class); | |
| 292 | + if (CollectionUtils.isNotEmpty(map)) { | |
| 293 | + StringBuilder sb = new StringBuilder(); | |
| 294 | + for (Object str : map) { | |
| 295 | + if (null!=str &&org.apache.commons.lang.StringUtils.isNotEmpty(str.toString())) { | |
| 296 | + String val = bgMap.get(str.toString()); | |
| 297 | + if(org.apache.commons.lang.StringUtils.isNotEmpty(val)){ | |
| 298 | + sb.append(val).append("、"); | |
| 299 | + } | |
| 300 | + } | |
| 301 | + } | |
| 302 | + if(null!=antExChuModel.getOtherHighRisk()&&!"{}".equals(antExChuModel.getOtherHighRisk())){ | |
| 303 | + Map map1 = JsonUtil.str2Obj(antExChuModel.getOtherHighRisk(),Map.class); | |
| 304 | + Object rh= map1.get("fxysu"); | |
| 305 | + if(null!=rh &&StringUtils.isNotEmpty(rh.toString())){ | |
| 306 | + sb.append(rh); | |
| 307 | + } | |
| 308 | + } | |
| 309 | + //低压 | |
| 310 | + java.util.Map<String, Object> dataMap1 = new HashMap<>(); | |
| 311 | + dataMap1.put("k", key); | |
| 312 | + dataMap1.put("v", sb.toString()); | |
| 313 | + list.add(dataMap1); | |
| 314 | + } | |
| 315 | + continue; | |
| 316 | + } | |
| 224 | 317 | dataMap.put("k", key); | 
| 318 | + if("产检医生".equals(key)){ | |
| 319 | + obj=doctorUserName; | |
| 320 | + dataMap.put("v", obj); | |
| 321 | + list.add(dataMap); | |
| 322 | + continue; | |
| 323 | + } | |
| 225 | 324 | if (obj instanceof Date) { | 
| 226 | 325 | dataMap.put("v", DateUtil.getyyyy_MM_dd((Date) obj)); | 
| 227 | 326 | } else { | 
| 228 | - String str =getAntExChuValue(key, antExChuModel); | |
| 229 | - if(null!=str){ | |
| 327 | + String str = getAntExChuValue(key, antExChuModel); | |
| 328 | + if (null != str) { | |
| 230 | 329 | dataMap.put("v", str); | 
| 231 | - }else{ | |
| 330 | + } else { | |
| 232 | 331 | dataMap.put("v", obj); | 
| 233 | 332 | } | 
| 234 | 333 | } | 
| 235 | 334 | |
| ... | ... | @@ -240,7 +339,89 @@ | 
| 240 | 339 | return JsonUtil.array2JsonString(list); | 
| 241 | 340 | } | 
| 242 | 341 | |
| 342 | + private static String convertAntExResult(AntenatalExaminationModel antExChuModel,Map<String,String> hrMap,String doctorUserName) { | |
| 343 | + List list = new ArrayList(); | |
| 243 | 344 | |
| 345 | + List<String> list2 = getField(antExChuModel); | |
| 346 | + for (int i = 0; i < list2.size(); i++) { | |
| 347 | + Object obj = ReflectionUtils.getFieldValue(antExChuModel, list2.get(i)); | |
| 348 | + String key = properties.getProperty(list2.get(i)); | |
| 349 | + java.util.Map<String, Object> dataMap = new HashMap<>(); | |
| 350 | + if (null != key) { | |
| 351 | + if ("血压".equals(key)) { | |
| 352 | + Map map = JsonUtil.str2Obj(antExChuModel.getBp(), Map.class); | |
| 353 | + if (null != map) { | |
| 354 | + | |
| 355 | + String ssy =null; | |
| 356 | + String szy =null; | |
| 357 | + Object obj1 = map.get("ssy"); | |
| 358 | + if(null!=obj1){ | |
| 359 | + //低压 | |
| 360 | + ssy= map.get("ssy").toString(); | |
| 361 | + } | |
| 362 | + obj1 = map.get("szy"); | |
| 363 | + if(null!=obj1){ | |
| 364 | + szy= map.get("szy").toString(); | |
| 365 | + } | |
| 366 | + if (StringUtils.isNotEmpty(ssy)) { | |
| 367 | + java.util.Map<String, Object> dataMap1 = new HashMap<>(); | |
| 368 | + dataMap1.put("k", "血压(低压)"); | |
| 369 | + dataMap1.put("v", ssy +"mmHg"); | |
| 370 | + list.add(dataMap1); | |
| 371 | + } | |
| 372 | + if (StringUtils.isNotEmpty(szy)) { | |
| 373 | + dataMap.put("k", "高压"); | |
| 374 | + dataMap.put("v", szy+ "mmHg"); | |
| 375 | + list.add(dataMap); | |
| 376 | + } | |
| 377 | + } | |
| 378 | + continue; | |
| 379 | + } | |
| 380 | + //高危 | |
| 381 | + else if ("高危因素".equals(key)) { | |
| 382 | + List map = JsonUtil.toList(antExChuModel.getRiskFactor(), List.class); | |
| 383 | + if (CollectionUtils.isNotEmpty(map)) { | |
| 384 | + StringBuilder sb = new StringBuilder(); | |
| 385 | + for (Object str : map) { | |
| 386 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(str.toString())) { | |
| 387 | + String val = hrMap.get(str.toString()); | |
| 388 | + if(org.apache.commons.lang.StringUtils.isNotEmpty(val)){ | |
| 389 | + sb.append(val).append("、"); | |
| 390 | + } | |
| 391 | + } | |
| 392 | + } | |
| 393 | + if(null!=antExChuModel.getOtherRisk()&&!"{}".equals(antExChuModel.getOtherRisk())){ | |
| 394 | + Map map1 = JsonUtil.str2Obj(antExChuModel.getOtherRisk(),Map.class); | |
| 395 | + Object rh= map1.get("fxysu"); | |
| 396 | + if(null!=rh &&StringUtils.isNotEmpty(rh.toString())){ | |
| 397 | + sb.append(rh); | |
| 398 | + } | |
| 399 | + } | |
| 400 | + //低压 | |
| 401 | + java.util.Map<String, Object> dataMap1 = new HashMap<>(); | |
| 402 | + dataMap1.put("k", key); | |
| 403 | + dataMap1.put("v", sb.toString()); | |
| 404 | + list.add(dataMap1); | |
| 405 | + } | |
| 406 | + continue; | |
| 407 | + }else if("产检医生".equals(key)){ | |
| 408 | + obj=doctorUserName; | |
| 409 | + } | |
| 410 | + | |
| 411 | + dataMap.put("k", key); | |
| 412 | + if (obj instanceof Date) { | |
| 413 | + dataMap.put("v", DateUtil.getyyyy_MM_dd((Date) obj)); | |
| 414 | + } else { | |
| 415 | + dataMap.put("v", obj); | |
| 416 | + } | |
| 417 | + if (null != obj) { | |
| 418 | + list.add(dataMap); | |
| 419 | + } | |
| 420 | + } | |
| 421 | + } | |
| 422 | + return JsonUtil.array2JsonString(list); | |
| 423 | + } | |
| 424 | + | |
| 244 | 425 | private static String getAntExChuValue(String key, AntExChuModel antExChuModel) { | 
| 245 | 426 | StringBuilder sb = new StringBuilder(); | 
| 246 | 427 | Map<String, Object> map = null; | 
| 247 | 428 | |
| 248 | 429 | |
| ... | ... | @@ -264,17 +445,19 @@ | 
| 264 | 445 | return replace(map, sb); | 
| 265 | 446 | } | 
| 266 | 447 | |
| 267 | - public static void main(String [] args){ | |
| 268 | - AntExChuModel antExChuModel=new AntExChuModel(); | |
| 269 | - antExChuModel.setFamilyHistory("{\"yesOrNo\":\"no\"}"); | |
| 448 | + public static void main(String[] args) { | |
| 449 | + AntExChuModel antExChuModel = new AntExChuModel(); | |
| 450 | + antExChuModel.setFamilyHistory("{\"npx\":true,\"sm\":true,\"yesOrNo\":\"yes\"}"); | |
| 270 | 451 | antExChuModel.setPregnancyTimes(3); | 
| 271 | 452 | antExChuModel.setHeight("3.2"); | 
| 272 | 453 | antExChuModel.setYsfyHistory("{\"yesOrNo\":\"yes\",\"yzq3\":true}"); | 
| 273 | - System.out.print(convertAntExChuResult(antExChuModel)); | |
| 454 | + antExChuModel.setBp("{\"ssy\":70,\"szy\":120}"); | |
| 455 | + antExChuModel.setFuwei("11"); | |
| 456 | + System.out.print(convertAntExChu(antExChuModel,null, null,"").getResult()); | |
| 274 | 457 | } | 
| 275 | 458 | |
| 276 | 459 | private static String replace(Map map, StringBuilder sb) { | 
| 277 | - if(null==map){ | |
| 460 | + if (null == map) { | |
| 278 | 461 | return null; | 
| 279 | 462 | } | 
| 280 | 463 | if ("yes".equals(map.get(YES_OR_NO))) { | 
| ... | ... | @@ -295,8 +478,8 @@ | 
| 295 | 478 | if (map.containsKey("qtText")) { | 
| 296 | 479 | sb.append(map.get("qtText")); | 
| 297 | 480 | } | 
| 298 | - if(sb.toString().endsWith(",")){ | |
| 299 | - return sb.substring(0,sb.length()-1); | |
| 481 | + if (sb.toString().endsWith(",")) { | |
| 482 | + return sb.substring(0, sb.length() - 1); | |
| 300 | 483 | } | 
| 301 | 484 | } else if ("no".equals(map.get(YES_OR_NO))) { | 
| 302 | 485 | sb.append("无"); | 
| ... | ... | @@ -309,6 +492,19 @@ | 
| 309 | 492 | return cachedField.get(antExChuModel.getClass()); | 
| 310 | 493 | } | 
| 311 | 494 | Field[] field = AntExChuModel.class.getDeclaredFields(); | 
| 495 | + List<String> fieldName = new ArrayList<>(); | |
| 496 | + for (Field f : field) { | |
| 497 | + fieldName.add(f.getName()); | |
| 498 | + } | |
| 499 | + cachedField.put(antExChuModel.getClass(), fieldName); | |
| 500 | + return fieldName; | |
| 501 | + } | |
| 502 | + | |
| 503 | + private static List<String> getField(AntenatalExaminationModel antExChuModel) { | |
| 504 | + if (cachedField.containsKey(antExChuModel.getClass())) { | |
| 505 | + return cachedField.get(antExChuModel.getClass()); | |
| 506 | + } | |
| 507 | + Field[] field = AntenatalExaminationModel.class.getDeclaredFields(); | |
| 312 | 508 | List<String> fieldName = new ArrayList<>(); | 
| 313 | 509 | for (Field f : field) { | 
| 314 | 510 | fieldName.add(f.getName()); | 
platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/SyncDataWork.java
View file @
002d235
| ... | ... | @@ -5,15 +5,18 @@ | 
| 5 | 5 | import com.lyms.platform.biz.service.YunBookbuildingService; | 
| 6 | 6 | import com.lyms.platform.common.enums.YnEnums; | 
| 7 | 7 | import com.lyms.platform.common.utils.DateUtil; | 
| 8 | +import com.lyms.platform.common.utils.SystemConfig; | |
| 8 | 9 | import com.lyms.platform.permission.model.Organization; | 
| 9 | 10 | import com.lyms.platform.permission.model.OrganizationQuery; | 
| 10 | 11 | import com.lyms.platform.permission.model.Users; | 
| 11 | 12 | import com.lyms.platform.permission.model.UsersQuery; | 
| 12 | 13 | import com.lyms.platform.permission.service.OrganizationService; | 
| 13 | 14 | import com.lyms.platform.pojo.AntExChuModel; | 
| 15 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
| 14 | 16 | import com.lyms.platform.pojo.BasicConfig; | 
| 15 | 17 | import com.lyms.platform.pojo.Patients; | 
| 16 | 18 | import com.lyms.platform.query.AntExChuQuery; | 
| 19 | +import com.lyms.platform.query.AntExQuery; | |
| 17 | 20 | import com.lyms.platform.query.BasicConfigQuery; | 
| 18 | 21 | import com.lyms.platform.query.PatientsQuery; | 
| 19 | 22 | import com.lymsh.mommybaby.maindata.enumdata.YnEnum; | 
| ... | ... | @@ -25,6 +28,7 @@ | 
| 25 | 28 | import org.apache.commons.lang.math.NumberUtils; | 
| 26 | 29 | import org.slf4j.Logger; | 
| 27 | 30 | import org.slf4j.LoggerFactory; | 
| 31 | +import org.springframework.beans.factory.annotation.Autowire; | |
| 28 | 32 | import org.springframework.beans.factory.annotation.Autowired; | 
| 29 | 33 | import org.springframework.beans.factory.annotation.Value; | 
| 30 | 34 | import org.springframework.stereotype.Component; | 
| ... | ... | @@ -42,7 +46,7 @@ | 
| 42 | 46 | |
| 43 | 47 | /** | 
| 44 | 48 | * 同步数据接口 | 
| 45 | - * <p> | |
| 49 | + * <p/> | |
| 46 | 50 | * Created by Administrator on 2016/9/29 0029. | 
| 47 | 51 | */ | 
| 48 | 52 | @Component | 
| 49 | 53 | |
| 50 | 54 | |
| 51 | 55 | |
| 52 | 56 | |
| 53 | 57 | |
| ... | ... | @@ -96,33 +100,35 @@ | 
| 96 | 100 | private MembersService membersService; | 
| 97 | 101 | |
| 98 | 102 | @Value("#{configProperties['file.path']}") | 
| 99 | - private String FILE_PATH; | |
| 103 | + private String FILE_PATH; | |
| 100 | 104 | //最后一次同步时间 | 
| 101 | - private long lastSyncTime=-1L; | |
| 105 | + private long lastSyncTime = -1L; | |
| 102 | 106 | /** | 
| 103 | 107 | * | 
| 104 | 108 | */ | 
| 105 | 109 | private java.util.Map<String, Integer> orgMapToId = new HashMap<>(); | 
| 106 | 110 | //妈咪贝比的省市区 | 
| 107 | 111 | private java.util.Map<String, Integer> mamiRegions = new HashMap<>(); | 
| 112 | + //高危因素 | |
| 113 | + private java.util.Map<String, String> bgHighRisk = new HashMap<>(); | |
| 108 | 114 | |
| 109 | 115 | /** | 
| 110 | 116 | * mongo 里面省市区的id | 
| 111 | 117 | */ | 
| 112 | 118 | public static final String CHINA_BASIC_ID = "f6c505dd-835a-43d7-b0bb-fdb9eb0b7b31"; | 
| 113 | 119 | |
| 114 | - private long readLastSyncTime(){ | |
| 120 | + private long readLastSyncTime() { | |
| 115 | 121 | try { | 
| 116 | - if(-1!=lastSyncTime){ | |
| 122 | + if (-1 != lastSyncTime) { | |
| 117 | 123 | return lastSyncTime; | 
| 118 | 124 | } | 
| 119 | - RandomAccessFile randomAccessFile=new RandomAccessFile(new File(FILE_PATH),"rw"); | |
| 120 | - String line =randomAccessFile.readLine(); | |
| 121 | - if(StringUtils.isNotEmpty(line)){ | |
| 122 | - lastSyncTime = Long.valueOf(line); | |
| 123 | - } | |
| 124 | - }catch (Exception e){ | |
| 125 | - logger.error("read last sync time error.",e); | |
| 125 | + RandomAccessFile randomAccessFile = new RandomAccessFile(new File(FILE_PATH), "rw"); | |
| 126 | + String line = randomAccessFile.readLine(); | |
| 127 | + if (StringUtils.isNotEmpty(line)) { | |
| 128 | + lastSyncTime = Long.valueOf(line); | |
| 129 | + } | |
| 130 | + } catch (Exception e) { | |
| 131 | + logger.error("read last sync time error.", e); | |
| 126 | 132 | } | 
| 127 | 133 | return lastSyncTime; | 
| 128 | 134 | } | 
| 129 | 135 | |
| 130 | 136 | |
| 131 | 137 | |
| ... | ... | @@ -130,16 +136,17 @@ | 
| 130 | 136 | /** | 
| 131 | 137 | * 持久化最后一次同步时间 | 
| 132 | 138 | */ | 
| 133 | - private void writeLastSyncTime(){ | |
| 139 | + private void writeLastSyncTime() { | |
| 134 | 140 | try { | 
| 135 | - lastSyncTime=System.currentTimeMillis(); | |
| 136 | - RandomAccessFile randomAccessFile=new RandomAccessFile(new File(FILE_PATH),"rw"); | |
| 141 | + lastSyncTime = System.currentTimeMillis(); | |
| 142 | + RandomAccessFile randomAccessFile = new RandomAccessFile(new File(FILE_PATH), "rw"); | |
| 137 | 143 | randomAccessFile.writeBytes(lastSyncTime + ""); | 
| 138 | 144 | randomAccessFile.close(); | 
| 139 | - }catch (Exception e){ | |
| 140 | - logger.error("read last sync time error.",e); | |
| 145 | + } catch (Exception e) { | |
| 146 | + logger.error("read last sync time error.", e); | |
| 141 | 147 | } | 
| 142 | 148 | } | 
| 149 | + | |
| 143 | 150 | /** | 
| 144 | 151 | * 加载全部省市区的数据到内存里面 | 
| 145 | 152 | */ | 
| ... | ... | @@ -157,6 +164,25 @@ | 
| 157 | 164 | } | 
| 158 | 165 | } | 
| 159 | 166 | |
| 167 | + private void loadRpHighRisk() { | |
| 168 | + | |
| 169 | + BasicConfigQuery regionsQuery = new BasicConfigQuery(); | |
| 170 | + regionsQuery.setParentId(SystemConfig.HIGH_RISK_ID); | |
| 171 | + regionsQuery.setYn(YnEnums.YES.getId()); | |
| 172 | + List<BasicConfig> basicConfigList = basicConfigService.queryBasicConfig(regionsQuery); | |
| 173 | + if (CollectionUtils.isNotEmpty(basicConfigList)) { | |
| 174 | + for (BasicConfig basicConfig : basicConfigList) { | |
| 175 | + regionsQuery.setParentId(basicConfig.getId()); | |
| 176 | + List<BasicConfig> basicConfigList1 = basicConfigService.queryBasicConfig(regionsQuery); | |
| 177 | + for (BasicConfig basicConfig1 : basicConfigList1) { | |
| 178 | + bgHighRisk.put(basicConfig1.getId(), basicConfig1.getName()); | |
| 179 | + } | |
| 180 | + } | |
| 181 | + } else { | |
| 182 | + logger.warn("load loadRpHighRisk error.no data"); | |
| 183 | + } | |
| 184 | + } | |
| 185 | + | |
| 160 | 186 | /** | 
| 161 | 187 | * 加载区域平台的省市区 | 
| 162 | 188 | */ | 
| ... | ... | @@ -172,8 +198,8 @@ | 
| 172 | 198 | } | 
| 173 | 199 | } | 
| 174 | 200 | |
| 175 | - private Hospitals fullHospital(Organization organization){ | |
| 176 | - Hospitals hospitals = ConvertHelper.convertHospital(organization); | |
| 201 | + private Hospitals fullHospital(Organization organization) { | |
| 202 | + Hospitals hospitals = ConvertHelper.convertHospital(organization); | |
| 177 | 203 | if (null != organization.getAreaId()) { | 
| 178 | 204 | BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(organization.getAreaId()); | 
| 179 | 205 | if (null != basicConfig) { | 
| 180 | 206 | |
| 181 | 207 | |
| 182 | 208 | |
| 183 | 209 | |
| 184 | 210 | |
| 185 | 211 | |
| ... | ... | @@ -200,30 +226,29 @@ | 
| 200 | 226 | //获取最后一次同步的时间 如果为-1就表示是全量同步 | 
| 201 | 227 | readLastSyncTime(); | 
| 202 | 228 | logger.info("start sync at " + DateUtil.getyyyy_MM_dd(new Date())); | 
| 203 | - //先加载省市区 | |
| 229 | + //先加载省市区 | |
| 204 | 230 | loadMamiAllRegion(); | 
| 231 | + //加载高危数据 | |
| 232 | + loadRpHighRisk(); | |
| 205 | 233 | |
| 206 | 234 | OrganizationQuery organizationQuery = new OrganizationQuery(); | 
| 207 | 235 | organizationQuery.setYn(YnEnums.YES.getId()); | 
| 208 | 236 | //查询符合条件的机构 | 
| 209 | 237 | List<Organization> organizationList = organizationService.queryOrganization(organizationQuery); | 
| 210 | - CountDownLatch countDownLatch=null;; | |
| 238 | + CountDownLatch countDownLatch = null; | |
| 239 | + ; | |
| 211 | 240 | if (CollectionUtils.isNotEmpty(organizationList)) { | 
| 212 | 241 | Hospitals hospitals = null; | 
| 213 | - countDownLatch =new CountDownLatch(organizationList.size()); | |
| 242 | + countDownLatch = new CountDownLatch(organizationList.size()); | |
| 214 | 243 | for (Organization organization : organizationList) { | 
| 215 | 244 | HospitalsQuery hospitalsQuery = new HospitalsQuery(); | 
| 216 | -// hospitalsQuery.setForeignId(organization.getId() + ""); | |
| 217 | 245 | hospitalsQuery.setTitle(organization.getName()); | 
| 218 | 246 | hospitalsQuery.setYn(YnEnums.YES.getId()); | 
| 219 | 247 | List<Hospitals> hospitalsList = hospitalsService.queryHospitals(hospitalsQuery); | 
| 220 | 248 | if (CollectionUtils.isNotEmpty(hospitalsList)) { | 
| 221 | - hospitals=hospitalsList.get(0); | |
| 222 | -// hospitals = fullHospital(organization); | |
| 223 | - /* hospitals.setId(hospitalsList.get(0).getId()); | |
| 224 | - hospitalsService.updateHospitals(hospitals);*/ | |
| 249 | + hospitals = hospitalsList.get(0); | |
| 225 | 250 | } else { | 
| 226 | - hospitals= fullHospital(organization); | |
| 251 | + hospitals = fullHospital(organization); | |
| 227 | 252 | hospitalsService.addHospitals(hospitals); | 
| 228 | 253 | } | 
| 229 | 254 | |
| 230 | 255 | |
| 231 | 256 | |
| ... | ... | @@ -232,15 +257,20 @@ | 
| 232 | 257 | } else { | 
| 233 | 258 | logger.warn("add hospital don't id."); | 
| 234 | 259 | } | 
| 235 | - workExecutor.execute(new SyncWork(organization.getId() + "",countDownLatch)); | |
| 260 | + workExecutor.execute(new SyncWork(organization.getId() + "", countDownLatch)); | |
| 236 | 261 | } | 
| 237 | 262 | } | 
| 238 | 263 | countDownLatch.await(); | 
| 239 | 264 | //持久化最后一次同步时间 | 
| 240 | 265 | writeLastSyncTime(); | 
| 266 | + clearAll(); | |
| 241 | 267 | logger.info("sync end costTime:" + (System.currentTimeMillis() - l) + " ms."); | 
| 242 | 268 | } | 
| 243 | - | |
| 269 | + private void clearAll(){ | |
| 270 | + orgMapToId.clear(); | |
| 271 | + mamiRegions.clear(); | |
| 272 | + bgHighRisk.clear(); | |
| 273 | + } | |
| 244 | 274 | /** | 
| 245 | 275 | * 执行同步的工作线程 | 
| 246 | 276 | */ | 
| 247 | 277 | |
| 248 | 278 | |
| 249 | 279 | |
| 250 | 280 | |
| 251 | 281 | |
| ... | ... | @@ -251,24 +281,25 @@ | 
| 251 | 281 | |
| 252 | 282 | private java.util.Map<Integer, Integer> userMapping = new HashMap<>(); | 
| 253 | 283 | |
| 254 | - public SyncWork(String hospitalId,CountDownLatch countDownLatch) { | |
| 255 | - setName("SyncWork-"+hospitalId); | |
| 284 | + public SyncWork(String hospitalId, CountDownLatch countDownLatch) { | |
| 285 | + setName("SyncWork-" + hospitalId); | |
| 256 | 286 | this.hospitalId = hospitalId; | 
| 257 | - this.countDownLatch=countDownLatch; | |
| 287 | + this.countDownLatch = countDownLatch; | |
| 258 | 288 | } | 
| 259 | 289 | |
| 260 | 290 | @Override | 
| 261 | 291 | public void run() { | 
| 262 | 292 | try { | 
| 263 | - long l =System.currentTimeMillis(); | |
| 293 | + long l = System.currentTimeMillis(); | |
| 264 | 294 | logger.info("begin sync work hospital:" + hospitalId + ",at time " + DateUtil.getyyyy_MM_dd(new Date())); | 
| 265 | - StopWatch stopWatch=new StopWatch("SyncWork-"+hospitalId); | |
| 295 | + StopWatch stopWatch = new StopWatch("SyncWork-" + hospitalId); | |
| 266 | 296 | //查询出该医院所以的医生用户 | 
| 267 | 297 | UsersQuery usersQuery = new UsersQuery(); | 
| 268 | 298 | usersQuery.setYn(YnEnums.YES.getId()); | 
| 269 | 299 | usersQuery.setOrgId(Integer.valueOf(hospitalId)); | 
| 270 | - if(-1!=lastSyncTime){ | |
| 300 | + if (-1 != lastSyncTime) { | |
| 271 | 301 | usersQuery.setGteModified(new Date(lastSyncTime)); | 
| 302 | + usersQuery.setGteCreated(new Date(lastSyncTime)); | |
| 272 | 303 | } | 
| 273 | 304 | stopWatch.start("queryUsers"); | 
| 274 | 305 | List<Users> userses = usersService.queryUsers(usersQuery); | 
| 275 | 306 | |
| ... | ... | @@ -283,12 +314,12 @@ | 
| 283 | 314 | doctorUsersQuery.setYn(YnEnums.YES.getId()); | 
| 284 | 315 | doctorUsersQuery.setHospitalId(orgMapToId.get(hospitalId)); | 
| 285 | 316 | doctorUsersQuery.setUsername(users.getName()); | 
| 286 | - StopWatch stopWatch1=new StopWatch("SyncWork-"+hospitalId+",userId:"+users.getId()); | |
| 317 | + StopWatch stopWatch1 = new StopWatch("SyncWork-" + hospitalId + ",userId:" + users.getId()); | |
| 287 | 318 | stopWatch1.start("queryDoctorUsers"); | 
| 288 | 319 | List<DoctorUsers> doctorUsersList = doctorUsersService.queryDoctorUsers(doctorUsersQuery); | 
| 289 | 320 | stopWatch1.stop(); | 
| 290 | 321 | if (CollectionUtils.isNotEmpty(doctorUsersList)) { | 
| 291 | - doctorUsers=doctorUsersList.get(0); | |
| 322 | + doctorUsers = doctorUsersList.get(0); | |
| 292 | 323 | /* doctorUsers = ConvertHelper.convertUsers(users); | 
| 293 | 324 | doctorUsers.setHospitalId(orgMapToId.get(hospitalId)); | 
| 294 | 325 | stopWatch1.start("updateDoctorUsers"); | 
| 295 | 326 | |
| 296 | 327 | |
| 297 | 328 | |
| 298 | 329 | |
| 299 | 330 | |
| 300 | 331 | |
| 301 | 332 | |
| 302 | 333 | |
| 303 | 334 | |
| ... | ... | @@ -308,34 +339,39 @@ | 
| 308 | 339 | } | 
| 309 | 340 | logger.info(stopWatch1.toString()); | 
| 310 | 341 | } | 
| 342 | + logger.info("hospitalId" + hospitalId + ",userMapping :" + userMapping); | |
| 311 | 343 | } | 
| 312 | 344 | |
| 313 | 345 | PatientsQuery patientsQuery1 = new PatientsQuery(); | 
| 314 | 346 | patientsQuery1.setYn(YnEnums.YES.getId()); | 
| 315 | 347 | patientsQuery1.setHospitalId(hospitalId); | 
| 316 | - if(-1!=lastSyncTime){ | |
| 348 | + if (-1 != lastSyncTime) { | |
| 317 | 349 | patientsQuery1.setGteModified(new Date(lastSyncTime)); | 
| 350 | + patientsQuery1.setGteCreated(new Date(lastSyncTime)); | |
| 318 | 351 | } | 
| 319 | - StopWatch stopWatch2=new StopWatch("SyncWork-"+hospitalId+"-query patient"); | |
| 352 | + StopWatch stopWatch2 = new StopWatch("SyncWork-" + hospitalId + "-query patient"); | |
| 320 | 353 | stopWatch2.start("queryPregnantWithQuery"); | 
| 321 | 354 | List<Patients> patientses = yunBookbuildingService.queryPregnantWithQuery(patientsQuery1); | 
| 322 | 355 | stopWatch2.stop(); | 
| 323 | 356 | logger.info(stopWatch2.toString()); | 
| 324 | - logger.info("query patient by hospitalId:"+ hospitalId+", list size :" + patientses.size()); | |
| 325 | - if(CollectionUtils.isNotEmpty(patientses)) { | |
| 357 | + logger.info("query patient by hospitalId:" + hospitalId + ", list size :" + patientses.size()); | |
| 358 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 326 | 359 | for (Patients patients : patientses) { | 
| 327 | - StopWatch stopWatch3=new StopWatch("SyncWork-"+hospitalId+"-patient-"+patients.getId()); | |
| 360 | + StopWatch stopWatch3 = new StopWatch("SyncWork-" + hospitalId + "-patient-" + patients.getId()); | |
| 328 | 361 | com.lymsh.mommybaby.maindata.model.Patients mamiPatient = ConvertHelper.convertPatient(patients); | 
| 362 | + stopWatch3.start("aouPatients"); | |
| 329 | 363 | //增加建档记录 | 
| 330 | 364 | patientsService.aouPatients(mamiPatient); | 
| 365 | + stopWatch3.stop(); | |
| 331 | 366 | //绑定用户 | 
| 332 | 367 | bandingMember(mamiPatient); | 
| 333 | 368 | |
| 334 | 369 | AntExChuQuery antExChuQuery = new AntExChuQuery(); | 
| 335 | 370 | antExChuQuery.setYn(YnEnums.YES.getId()); | 
| 336 | 371 | antExChuQuery.setParentId(patients.getId()); | 
| 337 | - if(-1!=lastSyncTime){ | |
| 372 | + if (-1 != lastSyncTime) { | |
| 338 | 373 | antExChuQuery.setGteModified(new Date(lastSyncTime)); | 
| 374 | + antExChuQuery.setGteCreated(new Date(lastSyncTime)); | |
| 339 | 375 | } | 
| 340 | 376 | |
| 341 | 377 | DoctorUsersPatientsMaps doctorUsersPatientsMaps = new DoctorUsersPatientsMaps(); | 
| 342 | 378 | |
| 343 | 379 | |
| 344 | 380 | |
| ... | ... | @@ -344,16 +380,19 @@ | 
| 344 | 380 | |
| 345 | 381 | //门诊患者 | 
| 346 | 382 | doctorUsersPatientsMaps.setGroupId(4); | 
| 347 | - //设置为待处理 | |
| 348 | - doctorUsersPatientsMaps.setStatus(1); | |
| 349 | - doctorUsersPatientsMaps.setStatusName("待处理"); | |
| 350 | - stopWatch3.start("aouPatients"); | |
| 383 | + //已分勉 | |
| 384 | + if (null != patients.getType() && patients.getType() == 3) { | |
| 385 | + doctorUsersPatientsMaps.setGroupId(7); | |
| 386 | + } | |
| 351 | 387 | //设置为高危 | 
| 352 | - if(null!=patients.getRiskScore() &&patients.getRiskScore()>0){ | |
| 388 | + else if (null != patients.getRiskScore() && patients.getRiskScore() > 0) { | |
| 353 | 389 | doctorUsersPatientsMaps.setGroupId(2); | 
| 354 | 390 | } | 
| 391 | + //设置为待处理 | |
| 392 | + doctorUsersPatientsMaps.setStatus(1); | |
| 393 | + doctorUsersPatientsMaps.setStatusName("待处理"); | |
| 355 | 394 | |
| 356 | - stopWatch3.stop(); | |
| 395 | + | |
| 357 | 396 | doctorUsersPatientsMaps.setPatientId(mamiPatient.getId()); | 
| 358 | 397 | if (StringUtils.isNotEmpty(patients.getBookbuildingDoctor())) { | 
| 359 | 398 | doctorUsersPatientsMaps.setDoctorUserId(userMapping.get(Integer.valueOf(patients.getBookbuildingDoctor()))); | 
| 360 | 399 | |
| ... | ... | @@ -366,8 +405,19 @@ | 
| 366 | 405 | if (CollectionUtils.isEmpty(antExChuModel)) { | 
| 367 | 406 | continue; | 
| 368 | 407 | } | 
| 408 | + String doctorUserName = null; | |
| 369 | 409 | for (AntExChuModel antExChuModel1 : antExChuModel) { | 
| 370 | - Reports reports = ConvertHelper.convertAntExChu(antExChuModel1, patients.getLastMenses()); | |
| 410 | + | |
| 411 | + Integer doctorUserId = userMapping.get(Integer.valueOf(antExChuModel1.getProdDoctor())); | |
| 412 | + if (null != doctorUserId) { | |
| 413 | + DoctorUsers doctorUsers1 = doctorUsersService.getDoctorUsers(doctorUserId); | |
| 414 | + if (null != doctorUsers1) { | |
| 415 | + doctorUserName = doctorUsers1.getUsername(); | |
| 416 | + } | |
| 417 | + } | |
| 418 | + | |
| 419 | + | |
| 420 | + Reports reports = ConvertHelper.convertAntExChu(antExChuModel1, patients.getLastMenses(), bgHighRisk, doctorUserName); | |
| 371 | 421 | if (NumberUtils.isNumber(antExChuModel1.getProdDoctor())) { | 
| 372 | 422 | Users users = usersService.getUsers(Integer.valueOf(antExChuModel1.getProdDoctor())); | 
| 373 | 423 | if (null != users) { | 
| ... | ... | @@ -393,7 +443,6 @@ | 
| 393 | 443 | stopWatch3.start("updatePatients"); | 
| 394 | 444 | patientsService.updatePatients(p); | 
| 395 | 445 | stopWatch3.stop(); | 
| 396 | - logger.info(stopWatch3.toString()); | |
| 397 | 446 | |
| 398 | 447 | |
| 399 | 448 | DoctorUsersPatientsMaps reportdoctorUsersPatientsMaps = new DoctorUsersPatientsMaps(); | 
| 400 | 449 | |
| 401 | 450 | |
| 402 | 451 | |
| 403 | 452 | |
| 404 | 453 | |
| ... | ... | @@ -402,22 +451,110 @@ | 
| 402 | 451 | |
| 403 | 452 | //门诊患者 | 
| 404 | 453 | reportdoctorUsersPatientsMaps.setGroupId(4); | 
| 405 | - if(null!=patients.getRiskScore() &&patients.getRiskScore()>0){ | |
| 406 | - doctorUsersPatientsMaps.setGroupId(2); | |
| 454 | + if (null != patients.getRiskScore() && patients.getRiskScore() > 0) { | |
| 455 | + reportdoctorUsersPatientsMaps.setGroupId(2); | |
| 407 | 456 | } | 
| 457 | + reportdoctorUsersPatientsMaps.setPatientId(mamiPatient.getId()); | |
| 408 | 458 | //设置为待处理 | 
| 409 | 459 | reportdoctorUsersPatientsMaps.setStatus(1); | 
| 410 | 460 | reportdoctorUsersPatientsMaps.setStatusName("待处理"); | 
| 411 | - if (StringUtils.isNotEmpty(patients.getBookbuildingDoctor())) { | |
| 412 | - doctorUsersPatientsMaps.setDoctorUserId(userMapping.get(Integer.valueOf(antExChuModel1.getProdDoctor()))); | |
| 461 | + if (StringUtils.isNotEmpty(antExChuModel1.getProdDoctor())) { | |
| 462 | + reportdoctorUsersPatientsMaps.setDoctorUserId(userMapping.get(Integer.valueOf(antExChuModel1.getProdDoctor()))); | |
| 413 | 463 | stopWatch3.start("report aouDoctorUsersPatientsMaps"); | 
| 414 | 464 | doctorUsersPatientsMapsService.aouDoctorUsersPatientsMaps(reportdoctorUsersPatientsMaps); | 
| 415 | 465 | stopWatch3.stop(); | 
| 416 | 466 | } | 
| 467 | + | |
| 468 | + if (null != reports.getNextCheckTime()) { | |
| 469 | + com.lymsh.mommybaby.maindata.model.Patients patients1 = new com.lymsh.mommybaby.maindata.model.Patients(); | |
| 470 | + patients1.setId(mamiPatient.getId()); | |
| 471 | + patients1.setNextCheckTime(reports.getNextCheckTime()); | |
| 472 | + patientsService.updatePatients(patients1); | |
| 473 | + } | |
| 417 | 474 | } | 
| 475 | + AntExQuery antExQuery = new AntExQuery(); | |
| 476 | + antExQuery.setYn(YnEnums.YES.getId()); | |
| 477 | + antExQuery.setParentId(patients.getId()); | |
| 478 | + if (-1 != lastSyncTime) { | |
| 479 | + antExQuery.setGteModified(new Date(lastSyncTime)); | |
| 480 | + antExQuery.setGteCreated(new Date(lastSyncTime)); | |
| 481 | + } | |
| 482 | + //复诊 | |
| 483 | + List<AntenatalExaminationModel> antList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
| 484 | + doctorUserName = null; | |
| 485 | + if (CollectionUtils.isNotEmpty(antList)) { | |
| 486 | + for (AntenatalExaminationModel ant : antList) { | |
| 487 | + | |
| 488 | + Integer doctorUserId = userMapping.get(Integer.valueOf(ant.getCheckDoctor())); | |
| 489 | + if (null != doctorUserId) { | |
| 490 | + DoctorUsers doctorUsers1 = doctorUsersService.getDoctorUsers(doctorUserId); | |
| 491 | + if (null != doctorUsers1) { | |
| 492 | + doctorUserName = doctorUsers1.getUsername(); | |
| 493 | + } | |
| 494 | + } | |
| 495 | + | |
| 496 | + | |
| 497 | + Reports reports = ConvertHelper.convertAntExChu(ant, patients.getLastMenses(), bgHighRisk, doctorUserName); | |
| 498 | + | |
| 499 | + if (NumberUtils.isNumber(ant.getCheckDoctor())) { | |
| 500 | + Users users = usersService.getUsers(Integer.valueOf(ant.getCheckDoctor())); | |
| 501 | + if (null != users) { | |
| 502 | + reports.setDoctorName(users.getName()); | |
| 503 | + } | |
| 504 | + } | |
| 505 | + reports.setPatientId(mamiPatient.getId()); | |
| 506 | + reports.setAge(patients.getAge()); | |
| 507 | + reports.setRealName(patients.getUsername()); | |
| 508 | + if (StringUtils.isNotEmpty(patients.getHospitalId())) { | |
| 509 | + Organization organization = organizationService.getOrganization(NumberUtils.toInt(patients.getHospitalId())); | |
| 510 | + if (null != organization) { | |
| 511 | + reports.setHospitalName(organization.getName()); | |
| 512 | + } | |
| 513 | + } | |
| 514 | + stopWatch3.start("aouReports"); | |
| 515 | + reportsService.aouReports(reports); | |
| 516 | + stopWatch3.stop(); | |
| 517 | + com.lymsh.mommybaby.maindata.model.Patients p = new com.lymsh.mommybaby.maindata.model.Patients(); | |
| 518 | + p.setLastReportId(reports.getId()); | |
| 519 | + p.setLastReportDoctorName(reports.getDoctorName()); | |
| 520 | + p.setId(mamiPatient.getId()); | |
| 521 | + stopWatch3.start("updatePatients"); | |
| 522 | + patientsService.updatePatients(p); | |
| 523 | + stopWatch3.stop(); | |
| 524 | + | |
| 525 | + | |
| 526 | + DoctorUsersPatientsMaps reportdoctorUsersPatientsMaps = new DoctorUsersPatientsMaps(); | |
| 527 | + reportdoctorUsersPatientsMaps.setCreated(new Date()); | |
| 528 | + reportdoctorUsersPatientsMaps.setYn(YnEnums.YES.getId()); | |
| 529 | + | |
| 530 | + //门诊患者 | |
| 531 | + reportdoctorUsersPatientsMaps.setGroupId(4); | |
| 532 | + if (null != patients.getRiskScore() && patients.getRiskScore() > 0) { | |
| 533 | + reportdoctorUsersPatientsMaps.setGroupId(2); | |
| 534 | + } | |
| 535 | + reportdoctorUsersPatientsMaps.setPatientId(mamiPatient.getId()); | |
| 536 | + //设置为待处理 | |
| 537 | + reportdoctorUsersPatientsMaps.setStatus(1); | |
| 538 | + reportdoctorUsersPatientsMaps.setStatusName("待处理"); | |
| 539 | + if (StringUtils.isNotEmpty(ant.getCheckDoctor())) { | |
| 540 | + reportdoctorUsersPatientsMaps.setDoctorUserId(userMapping.get(Integer.valueOf(ant.getCheckDoctor()))); | |
| 541 | + stopWatch3.start("report antchu aouDoctorUsersPatientsMaps"); | |
| 542 | + doctorUsersPatientsMapsService.aouDoctorUsersPatientsMaps(reportdoctorUsersPatientsMaps); | |
| 543 | + stopWatch3.stop(); | |
| 544 | + } | |
| 545 | + | |
| 546 | + if (null != reports.getNextCheckTime()) { | |
| 547 | + com.lymsh.mommybaby.maindata.model.Patients patients1 = new com.lymsh.mommybaby.maindata.model.Patients(); | |
| 548 | + patients1.setId(mamiPatient.getId()); | |
| 549 | + patients1.setNextCheckTime(reports.getNextCheckTime()); | |
| 550 | + patientsService.updatePatients(patients1); | |
| 551 | + } | |
| 552 | + } | |
| 553 | + } | |
| 554 | + logger.info(stopWatch3.toString()); | |
| 418 | 555 | } | 
| 419 | 556 | } | 
| 420 | - logger.info("hospital "+hospitalId+",costTime:"+(System.currentTimeMillis()-l)); | |
| 557 | + logger.info("hospital " + hospitalId + ",costTime:" + (System.currentTimeMillis() - l)); | |
| 421 | 558 | } catch (Exception e) { | 
| 422 | 559 | e.printStackTrace(); | 
| 423 | 560 | } finally { | 
| 424 | 561 | |
| ... | ... | @@ -425,9 +562,10 @@ | 
| 425 | 562 | } | 
| 426 | 563 | } | 
| 427 | 564 | } | 
| 428 | - private void bandingMember(com.lymsh.mommybaby.maindata.model.Patients patients){ | |
| 565 | + | |
| 566 | + private void bandingMember(com.lymsh.mommybaby.maindata.model.Patients patients) { | |
| 429 | 567 | MembersQuery membersQuery = new MembersQuery(); | 
| 430 | - if(StringUtils.isEmpty(patients.getPhone())){ | |
| 568 | + if (StringUtils.isEmpty(patients.getPhone())) { | |
| 431 | 569 | return; | 
| 432 | 570 | } | 
| 433 | 571 | membersQuery.setPhone(patients.getPhone()); | 
| 434 | 572 | |
| ... | ... | @@ -438,13 +576,13 @@ | 
| 438 | 576 | membersQuery.setPatientId(patients.getId()); | 
| 439 | 577 | membersQuery.setYn(YnEnum.yes.getId()); | 
| 440 | 578 | List<Members> membersList1 = membersService.queryMembers(membersQuery); | 
| 441 | - for (Members members:membersList1) { | |
| 579 | + for (Members members : membersList1) { | |
| 442 | 580 | Members m = new Members(); | 
| 443 | 581 | m.setId(members.getId()); | 
| 444 | 582 | m.setYn(YnEnum.no.getId()); | 
| 445 | 583 | membersService.updateMembers(m); | 
| 446 | 584 | } | 
| 447 | - for (Members members:membersList) { | |
| 585 | + for (Members members : membersList) { | |
| 448 | 586 | Members temp = new Members(); | 
| 449 | 587 | temp.setId(members.getId()); | 
| 450 | 588 | temp.setPatientId(patients.getId()); | 
| ... | ... | @@ -452,7 +590,7 @@ | 
| 452 | 590 | temp.setLastMenses(patients.getLastMenses()); | 
| 453 | 591 | temp.setDueDate(patients.getDueDate()); | 
| 454 | 592 | //member status 为2时不需要修改 | 
| 455 | - if(null==members.getStatus()||2!=members.getStatus() ){ | |
| 593 | + if (null == members.getStatus() || 2 != members.getStatus()) { | |
| 456 | 594 | temp.setStatus(patients.getType()); | 
| 457 | 595 | } | 
| 458 | 596 | 
platform-job-index/src/main/java/com/lyms/platform/job/index/web/controller/SyncDataController.java
View file @
002d235
| ... | ... | @@ -23,8 +23,8 @@ | 
| 23 | 23 | @Qualifier("job-index-syncdataservice") | 
| 24 | 24 | private SyncDataService syncDataService; | 
| 25 | 25 | |
| 26 | - @Autowired | |
| 27 | - private SyncDataWork syncDataWork; | |
| 26 | +/* @Autowired | |
| 27 | + private SyncDataWork syncDataWork;*/ | |
| 28 | 28 | |
| 29 | 29 | /** | 
| 30 | 30 | * 孕妇同步 | 
| ... | ... | @@ -52,7 +52,7 @@ | 
| 52 | 52 | @ResponseBody | 
| 53 | 53 | public String syncDataToMami() { | 
| 54 | 54 | try { | 
| 55 | - syncDataWork.sync(); | |
| 55 | +// syncDataWork.sync(); | |
| 56 | 56 | } catch (Exception e) { | 
| 57 | 57 | ExceptionUtils.catchException(e, "syncDataToMami error"); | 
| 58 | 58 | } | 
platform-job-index/src/main/resources/lable.properties
View file @
002d235
| 1 | 1 | dueDate=预产期 | 
| 2 | +prodDoctor=产检医生 | |
| 2 | 3 | lastMenses=末次月经 | 
| 3 | 4 | cDueWeek=当前孕周 | 
| 5 | +dirOpinion=指导意见 | |
| 4 | 6 | pastHistory=既往史 | 
| 5 | 7 | familyHistory=家族史 | 
| 6 | 8 | personalHistory=个人史 | 
| ... | ... | @@ -23,6 +25,7 @@ | 
| 23 | 25 | baricIndex=体重指数 | 
| 24 | 26 | cestationInfo=本次妊娠情况 | 
| 25 | 27 | gonggao=宫高 | 
| 28 | +gongGao=宫高 | |
| 26 | 29 | fuwei=腹围 | 
| 27 | 30 | tireNumber1=胎数 | 
| 28 | 31 | heart=心脏 | 
| ... | ... | @@ -33,4 +36,17 @@ | 
| 33 | 36 | uterus=子宫 | 
| 34 | 37 | fujian=附件 | 
| 35 | 38 | bp=血压 | 
| 39 | +chiefComplaint=主诉 | |
| 40 | +abdominalCircumference=腹围 | |
| 41 | +edema=浮肿 | |
| 42 | +tireNumber=胎数 | |
| 43 | +hemoglobin=血红蛋白 | |
| 44 | +urineProtein=尿蛋白 | |
| 45 | +bChao=B超 | |
| 46 | +bloodSugar=血糖 | |
| 47 | +treatmentOpinion=处理意见 | |
| 48 | +guide=指导 | |
| 49 | +checkDoctor=产检医生 | |
| 50 | +highrisk=高危因素 | |
| 51 | +riskFactor=高危因素 |