Commit f56f4a109ad4e809279a73a0f4f0d90411d28a90
Exists in
master
and in
2 other branches
Merge remote-tracking branch 'origin/master'
Showing 3 changed files
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java
View file @
f56f4a1
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 | import java.util.ArrayList; |
| 23 | 23 | import java.util.Date; |
| 24 | 24 | import java.util.List; |
| 25 | +import java.util.Map; | |
| 25 | 26 | |
| 26 | 27 | /** |
| 27 | 28 | * 产检记录 |
| 28 | 29 | |
| ... | ... | @@ -38,8 +39,9 @@ |
| 38 | 39 | private AntenatalExaminationService antExService; |
| 39 | 40 | @Autowired |
| 40 | 41 | private PatientsService patientsService; |
| 42 | + @Autowired | |
| 43 | + private CommonService commonService; | |
| 41 | 44 | |
| 42 | - | |
| 43 | 45 | public List aggregateOne(AntExRecordQuery antExRecordQuery) { |
| 44 | 46 | return antExRecordDao.aggregateOne(antExRecordQuery.convertToQuery()); |
| 45 | 47 | } |
| ... | ... | @@ -56,7 +58,7 @@ |
| 56 | 58 | antExQuery.setHospitalId(hospitalId); |
| 57 | 59 | |
| 58 | 60 | //复诊 |
| 59 | - List<AntenatalExaminationModel> list = antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC,"checkDate")); | |
| 61 | + List<AntenatalExaminationModel> list = antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "checkDate")); | |
| 60 | 62 | for (AntenatalExaminationModel antEx : list) { |
| 61 | 63 | AntExRecordModel record = convert(antEx); |
| 62 | 64 | if (null != record) { |
| 63 | 65 | |
| ... | ... | @@ -96,13 +98,12 @@ |
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | |
| 99 | - | |
| 100 | - private void syncSingle(String pid){ | |
| 101 | + private void syncSingle(String pid) { | |
| 101 | 102 | AntExQuery antExQuery = new AntExQuery(); |
| 102 | 103 | antExQuery.setYn(YnEnums.YES.getId()); |
| 103 | 104 | antExQuery.setPid(pid); |
| 104 | 105 | //复诊 |
| 105 | - List<AntenatalExaminationModel> list = antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC,"checkDate")); | |
| 106 | + List<AntenatalExaminationModel> list = antExService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "checkDate")); | |
| 106 | 107 | for (AntenatalExaminationModel antEx : list) { |
| 107 | 108 | AntExRecordModel record = convert(antEx); |
| 108 | 109 | if (null != record) { |
| 109 | 110 | |
| ... | ... | @@ -215,7 +216,22 @@ |
| 215 | 216 | antExRecordModel.setBarCode(antEx.getBarCode()); |
| 216 | 217 | antExRecordModel.setNextCheckTime(antEx.getNextCheckTime()); |
| 217 | 218 | antExRecordModel.setCheckTime(antEx.getCheckDate()); |
| 219 | + antExRecordModel.sethScore(0); | |
| 220 | + //取当次产检的风险因素 | |
| 221 | + List li = null; | |
| 222 | + try { | |
| 223 | + li = JsonUtil.toList(antEx.getRiskFactor(), List.class); | |
| 224 | + } catch (Exception e) { | |
| 225 | + } | |
| 226 | + if (null != li) { | |
| 227 | + antExRecordModel.sethRisk(li); | |
| 228 | + Map result = commonService.calculateRiskScore(li); | |
| 229 | + antExRecordModel.sethScore((Integer) result.get("score")); | |
| 230 | + antExRecordModel.sethLevel((List) result.get("levelList")); | |
| 231 | + } | |
| 232 | + | |
| 218 | 233 | Patients patients = patientsService.findOnePatientById(antEx.getParentId()); |
| 234 | + | |
| 219 | 235 | if (null != patients) { |
| 220 | 236 | if (patients.getType() == 1) { |
| 221 | 237 | antExRecordModel.setStatus(2); |
| 222 | 238 | |
| ... | ... | @@ -236,9 +252,9 @@ |
| 236 | 252 | antExRecordModel.setLastMenses(patients.getLastMenses()); |
| 237 | 253 | antExRecordModel.setDueDate(patients.getDueDate()); |
| 238 | 254 | antExRecordModel.setName(patients.getUsername()); |
| 239 | - antExRecordModel.sethScore(null==patients.getRiskScore()?0:patients.getRiskScore()); | |
| 255 | + /* antExRecordModel.sethScore(null==patients.getRiskScore()?0:patients.getRiskScore()); | |
| 240 | 256 | antExRecordModel.sethRisk(patients.getRiskFactorId()); |
| 241 | - antExRecordModel.sethLevel(JsonUtil.toList(patients.getRiskLevelId(), List.class)); | |
| 257 | + antExRecordModel.sethLevel(JsonUtil.toList(patients.getRiskLevelId(), List.class));*/ | |
| 242 | 258 | } else { |
| 243 | 259 | logger.info("antex find patient by id is null. parentId:" + antEx.getParentId()); |
| 244 | 260 | return null; |
| ... | ... | @@ -258,6 +274,20 @@ |
| 258 | 274 | antExRecordModel.setBarCode(antExChuModel.getBarCode()); |
| 259 | 275 | antExRecordModel.setCheckTime(antExChuModel.getCheckTime()); |
| 260 | 276 | antExRecordModel.setNextCheckTime(antExChuModel.getNextCheckTime()); |
| 277 | + //高危信息 | |
| 278 | + List li = null; | |
| 279 | + try { | |
| 280 | + li = JsonUtil.toList(antExChuModel.getHighrisk(), List.class); | |
| 281 | + } catch (Exception e) { | |
| 282 | + } | |
| 283 | + antExRecordModel.sethScore(0); | |
| 284 | + if (null != li) { | |
| 285 | + antExRecordModel.sethRisk(li); | |
| 286 | + Map result = commonService.calculateRiskScore(li); | |
| 287 | + antExRecordModel.sethScore((Integer) result.get("score")); | |
| 288 | + antExRecordModel.sethLevel((List) result.get("levelList")); | |
| 289 | + } | |
| 290 | + | |
| 261 | 291 | Patients patients = patientsService.findOnePatientById(antExChuModel.getParentId()); |
| 262 | 292 | if (null != patients) { |
| 263 | 293 | if (patients.getType() == 1) { |
| 264 | 294 | |
| ... | ... | @@ -279,9 +309,9 @@ |
| 279 | 309 | antExRecordModel.setLastMenses(patients.getLastMenses()); |
| 280 | 310 | antExRecordModel.setDueDate(patients.getDueDate()); |
| 281 | 311 | antExRecordModel.setName(patients.getUsername()); |
| 282 | - antExRecordModel.sethScore(null==patients.getRiskScore()?0:patients.getRiskScore()); | |
| 312 | + /* antExRecordModel.sethScore(null==patients.getRiskScore()?0:patients.getRiskScore()); | |
| 283 | 313 | antExRecordModel.sethRisk(patients.getRiskFactorId()); |
| 284 | - antExRecordModel.sethLevel(JsonUtil.toList(patients.getRiskLevelId(), List.class)); | |
| 314 | + antExRecordModel.sethLevel(JsonUtil.toList(patients.getRiskLevelId(), List.class));*/ | |
| 285 | 315 | } else { |
| 286 | 316 | logger.info("antexc find patient by id is null. parentId:" + antExChuModel.getParentId()); |
| 287 | 317 | return null; |
| ... | ... | @@ -306,7 +336,7 @@ |
| 306 | 336 | antExRecordQuery.mysqlBuild(antExRecordDao.count(query)); |
| 307 | 337 | query.start(antExRecordQuery.getOffset()).end(antExRecordQuery.getLimit()); |
| 308 | 338 | } |
| 309 | - return antExRecordDao.queryRecord(query.addOrder(Sort.Direction.DESC,"modified")); | |
| 339 | + return antExRecordDao.queryRecord(query.addOrder(Sort.Direction.DESC, "modified")); | |
| 310 | 340 | } |
| 311 | 341 | |
| 312 | 342 |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CommonService.java
View file @
f56f4a1
| 1 | 1 | package com.lyms.platform.biz.service; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.enums.RiskDefaultTypeEnum; |
| 4 | +import com.lyms.platform.common.enums.YnEnums; | |
| 4 | 5 | import com.lyms.platform.common.utils.ExceptionUtils; |
| 5 | 6 | import com.lyms.platform.common.utils.JsonUtil; |
| 7 | +import com.lyms.platform.pojo.AntExChuModel; | |
| 8 | +import com.lyms.platform.pojo.AntenatalExaminationModel; | |
| 6 | 9 | import com.lyms.platform.pojo.BasicConfig; |
| 10 | +import com.lyms.platform.pojo.Patients; | |
| 11 | +import com.lyms.platform.query.PatientsQuery; | |
| 7 | 12 | import org.apache.commons.collections.CollectionUtils; |
| 8 | 13 | import org.apache.commons.lang.StringUtils; |
| 14 | +import org.apache.commons.lang.math.NumberUtils; | |
| 9 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 16 | import org.springframework.stereotype.Service; |
| 11 | 17 | |
| 12 | -import java.util.ArrayList; | |
| 13 | -import java.util.HashMap; | |
| 14 | -import java.util.List; | |
| 15 | -import java.util.Map; | |
| 18 | +import java.util.*; | |
| 16 | 19 | |
| 17 | 20 | /** |
| 18 | 21 | * Created by Administrator on 2016/12/26 0026. |
| ... | ... | @@ -126,6 +129,36 @@ |
| 126 | 129 | } |
| 127 | 130 | } |
| 128 | 131 | return list; |
| 132 | + } | |
| 133 | + | |
| 134 | + /** | |
| 135 | + * 根据高危因素计算高危评分和风险等级 | |
| 136 | + * | |
| 137 | + * @param riskList | |
| 138 | + * @return | |
| 139 | + */ | |
| 140 | + public Map calculateRiskScore(List riskList ){ | |
| 141 | + Map result = new HashMap(); | |
| 142 | + int score=0; | |
| 143 | + List<String> levelList = new ArrayList<>() ; | |
| 144 | + for (int i = 0; i < riskList.size(); i++) { | |
| 145 | + Objects obj =(Objects)riskList.get(i); | |
| 146 | + if(null!=obj){ | |
| 147 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(obj.toString()); | |
| 148 | + if(null!=basicConfig){ | |
| 149 | + if(null!=basicConfig.getScore()){ | |
| 150 | + score += basicConfig.getScore(); | |
| 151 | + } | |
| 152 | + basicConfig = basicConfigService.getOneBasicConfigById(basicConfig.getParentId()); | |
| 153 | + if (null != basicConfig && !levelList.contains(basicConfig.getId())) { | |
| 154 | + levelList.add(basicConfig.getId()); | |
| 155 | + } | |
| 156 | + } | |
| 157 | + } | |
| 158 | + } | |
| 159 | + result.put("score",score); | |
| 160 | + result.put("levelList",levelList); | |
| 161 | + return result; | |
| 129 | 162 | } |
| 130 | 163 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
f56f4a1
| ... | ... | @@ -511,112 +511,6 @@ |
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - //修改患者风险等级 | |
| 515 | - private void updatePatientRiskLevel(AntExChuModel antExChuModel, Patients patients) { | |
| 516 | - List<String> list = new ArrayList<>(); | |
| 517 | - Integer score = 0; | |
| 518 | - try { | |
| 519 | - if (StringUtils.isNotEmpty(antExChuModel.getHighrisk()) && !"[]".equals(antExChuModel.getHighrisk())) { | |
| 520 | - List l = JsonUtil.toList(antExChuModel.getHighrisk(), List.class); | |
| 521 | - for (int i = 0; i < l.size(); i++) { | |
| 522 | - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(l.get(i).toString()); | |
| 523 | - score += basicConfig.getScore(); | |
| 524 | - basicConfig = basicConfigService.getOneBasicConfigById(basicConfig.getParentId()); | |
| 525 | - if (null != basicConfig && !list.contains(basicConfig.getId())) { | |
| 526 | - list.add(basicConfig.getId()); | |
| 527 | - } | |
| 528 | - } | |
| 529 | - } | |
| 530 | - } catch (Exception e) { | |
| 531 | - } | |
| 532 | - try { | |
| 533 | - if (StringUtils.isNotEmpty(antExChuModel.getOtherHighRisk()) && !"{}".equals(antExChuModel.getOtherHighRisk())) { | |
| 534 | - Map map = JsonUtil.str2Obj(antExChuModel.getOtherHighRisk(), Map.class); | |
| 535 | - String m = (String) map.get("fyyse"); | |
| 536 | - if (!list.contains(m)) { | |
| 537 | - list.add(m); | |
| 538 | - } | |
| 539 | - //风险评分 | |
| 540 | - Object idObj = map.get("fxpf"); | |
| 541 | - if (null != idObj && !"null".equals(idObj.toString()) && !"".equals(idObj.toString())) { | |
| 542 | - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj.toString()); | |
| 543 | - score += NumberUtils.toInt(basicConfig.getName(), 0); | |
| 544 | - } | |
| 545 | - } | |
| 546 | - } catch (Exception e) { | |
| 547 | - } | |
| 548 | - patientsService.updatePatient(patients); | |
| 549 | - if (!list.isEmpty()) { | |
| 550 | - Patients patients1 = new Patients(); | |
| 551 | - try { | |
| 552 | - List list2 = JsonUtil.toList(antExChuModel.getHighrisk(), List.class); | |
| 553 | - patients1.setRiskFactorId(list2); | |
| 554 | - } catch (Exception e) { | |
| 555 | - } | |
| 556 | - patients1.setRiskScore(score); | |
| 557 | - patients1.setRiskLevelId(JsonUtil.array2JsonString(list)); | |
| 558 | - patients1.setModified(new Date()); | |
| 559 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
| 560 | - patientsQuery.setPid(patients.getPid()); | |
| 561 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
| 562 | - patientsQuery.setType(1); | |
| 563 | - patientsService.findAndModify(patientsQuery, patients1); | |
| 564 | - } | |
| 565 | - } | |
| 566 | - | |
| 567 | - //修改患者风险等级 | |
| 568 | - private void updatePatientRiskLevel(AntenatalExaminationModel antExChuModel, Patients patients) { | |
| 569 | - List<String> list = new ArrayList<>(); | |
| 570 | - Integer score = 0; | |
| 571 | - try { | |
| 572 | - if (StringUtils.isNotEmpty(antExChuModel.getRiskFactor()) && !"[]".equals(antExChuModel.getRiskFactor())) { | |
| 573 | - List l = JsonUtil.toList(antExChuModel.getRiskFactor(), List.class); | |
| 574 | - for (int i = 0; i < l.size(); i++) { | |
| 575 | - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(l.get(i).toString()); | |
| 576 | - score += basicConfig.getScore(); | |
| 577 | - basicConfig = basicConfigService.getOneBasicConfigById(basicConfig.getParentId()); | |
| 578 | - if (null != basicConfig && !list.contains(basicConfig.getId())) { | |
| 579 | - list.add(basicConfig.getId()); | |
| 580 | - } | |
| 581 | - } | |
| 582 | - } | |
| 583 | - } catch (Exception e) { | |
| 584 | - } | |
| 585 | - try { | |
| 586 | - if (StringUtils.isNotEmpty(antExChuModel.getOtherRisk()) && !"{}".equals(antExChuModel.getOtherRisk())) { | |
| 587 | - Map map = JsonUtil.str2Obj(antExChuModel.getOtherRisk(), Map.class); | |
| 588 | - String m = (String) map.get("fyyse"); | |
| 589 | - if (!list.contains(m)) { | |
| 590 | - list.add(m); | |
| 591 | - } | |
| 592 | - //风险评分 | |
| 593 | - Object idObj = map.get("fxpf"); | |
| 594 | - if (null != idObj && !"null".equals(idObj.toString()) && !"".equals(idObj.toString())) { | |
| 595 | - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(idObj.toString()); | |
| 596 | - score += NumberUtils.toInt(basicConfig.getName(), 0); | |
| 597 | - } | |
| 598 | - } | |
| 599 | - } catch (Exception e) { | |
| 600 | - } | |
| 601 | - patientsService.updatePatient(patients); | |
| 602 | - if (!list.isEmpty()) { | |
| 603 | - Patients patients1 = new Patients(); | |
| 604 | - try { | |
| 605 | - List list2 = JsonUtil.toList(antExChuModel.getRiskFactor(), List.class); | |
| 606 | - patients1.setRiskFactorId(list2); | |
| 607 | - } catch (Exception e) { | |
| 608 | - } | |
| 609 | - patients1.setRiskScore(score); | |
| 610 | - patients1.setModified(new Date()); | |
| 611 | - patients1.setRiskLevelId(JsonUtil.array2JsonString(list)); | |
| 612 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
| 613 | - patientsQuery.setPid(patients.getPid()); | |
| 614 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
| 615 | - patientsQuery.setType(1); | |
| 616 | - patientsService.findAndModify(patientsQuery, patients1); | |
| 617 | - } | |
| 618 | - } | |
| 619 | - | |
| 620 | 514 | /** |
| 621 | 515 | * 获取最后一次高危产检的高危信息 |
| 622 | 516 | * <p/> |