Commit 6b65eaaf9d563d675137b2c79263ed3dd26d844c
1 parent
e00eee4452
Exists in
dev
#fix:优化体重营养报告区分孕妇和产妇
Showing 4 changed files with 144 additions and 42 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java
View file @
6b65eaa
... | ... | @@ -119,9 +119,9 @@ |
119 | 119 | * 体重报告(小程序和app使用) |
120 | 120 | */ |
121 | 121 | @ResponseBody |
122 | - @RequestMapping(value = "/report/wx/{pid}", method = RequestMethod.GET) | |
123 | - public BaseResponse wxReport(@PathVariable String pid) { | |
124 | - return patientWeightService.wxReport(pid); | |
122 | + @RequestMapping(value = "/report/wx/{pid}/{type}", method = RequestMethod.GET) | |
123 | + public BaseResponse wxReport(@PathVariable String pid,@PathVariable Integer type) { | |
124 | + return patientWeightService.wxReport(pid,type); | |
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
6b65eaa
... | ... | @@ -1412,9 +1412,70 @@ |
1412 | 1412 | @Autowired |
1413 | 1413 | private AppointmentService appointmentService; |
1414 | 1414 | |
1415 | + //大同体重营养报告提醒 1 8 15 22提醒 | |
1416 | + public void serviceReportMsg() { | |
1417 | + logger.info("serviceReportMsg start up"); | |
1418 | + final String hospitalId = "2100002419"; | |
1419 | + Date day = DateUtil.getYMDTime(); | |
1420 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
1421 | + patientsQuery.setHospitalId(hospitalId); | |
1422 | + patientsQuery.setExtEnable(false); | |
1423 | + patientsQuery.setBuildTypeNot(1); | |
1424 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
1425 | + patientsQuery.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
1426 | + patientsQuery.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
1427 | + Date seven = DateUtil.addDay(day, 0); | |
1428 | + Date fourteen = DateUtil.addDay(day, -8); | |
1429 | + Date twenty = DateUtil.addDay(day, -15); | |
1430 | + Date twentyEight = DateUtil.addDay(day, -22); | |
1431 | + Map<String, Date> params = new HashMap<>(); | |
1432 | + params.put("seven", seven); | |
1433 | + params.put("fourteen", fourteen); | |
1434 | + params.put("twenty", twenty); | |
1435 | + params.put("twentyEight", twentyEight); | |
1436 | + patientsQuery.setServiceTime("1"); | |
1437 | + patientsQuery.setMapTime(params); | |
1438 | + final List<Patients> patientList = patientsService.queryPatient(patientsQuery); | |
1439 | + if (CollectionUtils.isNotEmpty(patientList)) { | |
1440 | + commonThreadPool.execute(new Runnable() { | |
1441 | + @Override | |
1442 | + public void run() { | |
1443 | + List<MsgRequest> messages=new ArrayList<>(); | |
1444 | + for (Patients patient : patientList) { | |
1445 | + MsgRequest mr = new MsgRequest(); | |
1446 | + mr.setPhone(patient.getPhone()); | |
1447 | + mr.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
1448 | + mr.setStatus(SmsStatusEnums.WFS.getId()); | |
1449 | + mr.setHospitalId(patient.getHospitalId()); | |
1450 | + mr.setTempId(patient.getId()); | |
1451 | + mr.setPatientId(patient.getId()); | |
1452 | + mr.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
1453 | + mr.setServiceType(1); //判断发送类型 | |
1454 | + | |
1455 | + mr.setFirst("大同市第一人民医院"); | |
1456 | + mr.setObjType(1); | |
1457 | + mr.setKeyword1("产科(请点击此处录入数据,获取营养指导)"); | |
1458 | + mr.setSubTypeId(SmsServiceEnums.FWKT.getId()); | |
1459 | + //planTime 和 timeType为必填 否则推送中心会推送异常 | |
1460 | + mr.setTimeType(SmsTimeTypeEnums.ONTIME.getId()); | |
1461 | + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
1462 | + mr.setKeyword2("产科"); | |
1463 | + mr.setRemark(patient.getUsername()); | |
1464 | + mr.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
1465 | + mr.setWxTempId(WxTempleteIdEnums.YUX_XUE_KE_CHEN_FB.getId()); | |
1466 | + messages.add(mr); | |
1467 | + } | |
1468 | + smsConfigFacade.saveMsg(messages,hospitalId); | |
1469 | + } | |
1470 | + }); | |
1471 | + } | |
1472 | + logger.info("serviceReportMsg end"); | |
1473 | + } | |
1474 | + | |
1475 | + | |
1415 | 1476 | public void bookbuildingMsg() { |
1416 | 1477 | //TODO 大同早上7点推送未建档提醒 |
1417 | - String date = DateUtil.getyyyy_MM_dd(DateUtil.addDay(new Date(),1)); | |
1478 | + String date = DateUtil.getyyyy_MM_dd(DateUtil.addDay(new Date(), 1)); | |
1418 | 1479 | String startTime = date + " 00:00:00"; |
1419 | 1480 | String endTime = date + " 23:59:59"; |
1420 | 1481 | List<AppointmentModel> modelList = appointmentService.queryAppointment("孙慧洁", startTime, endTime, null, null); |
... | ... | @@ -1442,7 +1503,7 @@ |
1442 | 1503 | List<Patients> patientsList = patientsService.queryPatient(patientsQuery); |
1443 | 1504 | if (com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(patientsList)) { |
1444 | 1505 | appointmentModel.setIsBuild(1); |
1445 | - } else { | |
1506 | + } else { | |
1446 | 1507 | appointmentModel.setIsBuild(0); |
1447 | 1508 | } |
1448 | 1509 | } |
1449 | 1510 | |
1450 | 1511 | |
... | ... | @@ -5115,35 +5176,35 @@ |
5115 | 5176 | query.setSerType(1); |
5116 | 5177 | List<PatientService> patientServiceList= patientServiceService.queryPatientService(query); |
5117 | 5178 | if (CollectionUtils.isNotEmpty(patientServiceList)){*/ |
5118 | - //yunBookbuildingService.updatePregnant(patient, patient.getId()); | |
5179 | + //yunBookbuildingService.updatePregnant(patient, patient.getId()); | |
5119 | 5180 | |
5120 | - for (int i = 0; i < 2; i++) { | |
5121 | - List<Map<String, String>> serInfos = new ArrayList<>(); | |
5122 | - Map<String, String> params = new HashMap<>(); | |
5123 | - PatientService patientService = new PatientService(); | |
5124 | - if (i == 0) { | |
5125 | - params.put("serType", "1"); | |
5126 | - } else { | |
5127 | - params.put("serType", "6"); | |
5128 | - } | |
5181 | + for (int i = 0; i < 2; i++) { | |
5182 | + List<Map<String, String>> serInfos = new ArrayList<>(); | |
5183 | + Map<String, String> params = new HashMap<>(); | |
5184 | + PatientService patientService = new PatientService(); | |
5185 | + if (i == 0) { | |
5186 | + params.put("serType", "1"); | |
5187 | + } else { | |
5188 | + params.put("serType", "6"); | |
5189 | + } | |
5129 | 5190 | |
5130 | - params.put("doctorWeek", "0"); | |
5131 | - params.put("serviceWeek", "42"); | |
5132 | - serInfos.add(params); | |
5133 | - patientService.setSerInfos(serInfos); | |
5134 | - patientService.setPerType(1); | |
5135 | - patientService.setCreateUser(patient.getFirstCheckId()); | |
5136 | - //开通日期与建档日期一致 | |
5137 | - patientService.setCreateDate(patient.getBookbuildingDate()); | |
5138 | - patientService.setParentid(patient.getId()); | |
5139 | - patientService.setPid(patient.getPid()); | |
5140 | - try { | |
5141 | - patientServiceFacade.addPatientService(patientService, patient.getOperator(), "2100001504"); | |
5142 | - } catch (Exception e) { | |
5143 | - System.out.println("孕妇建档服务开通异常!" + patient.toString()); | |
5144 | - e.printStackTrace(); | |
5145 | - } | |
5146 | - } | |
5191 | + params.put("doctorWeek", "0"); | |
5192 | + params.put("serviceWeek", "42"); | |
5193 | + serInfos.add(params); | |
5194 | + patientService.setSerInfos(serInfos); | |
5195 | + patientService.setPerType(1); | |
5196 | + patientService.setCreateUser(patient.getFirstCheckId()); | |
5197 | + //开通日期与建档日期一致 | |
5198 | + patientService.setCreateDate(patient.getBookbuildingDate()); | |
5199 | + patientService.setParentid(patient.getId()); | |
5200 | + patientService.setPid(patient.getPid()); | |
5201 | + try { | |
5202 | + patientServiceFacade.addPatientService(patientService, patient.getOperator(), "2100001504"); | |
5203 | + } catch (Exception e) { | |
5204 | + System.out.println("孕妇建档服务开通异常!" + patient.toString()); | |
5205 | + e.printStackTrace(); | |
5206 | + } | |
5207 | + } | |
5147 | 5208 | |
5148 | 5209 | |
5149 | 5210 | } |
5150 | 5211 | |
... | ... | @@ -5151,11 +5212,11 @@ |
5151 | 5212 | |
5152 | 5213 | //logger.info("建档信息异常---》" + patients.toString()); |
5153 | 5214 | //continue; |
5154 | - }else { | |
5215 | + } else { | |
5155 | 5216 | logger.info("建档信息异常---》" + map.get("cardNo")); |
5156 | 5217 | } |
5157 | 5218 | |
5158 | - }else { | |
5219 | + } else { | |
5159 | 5220 | System.out.println("cardNo exception---》" + map.get("cardNo")); |
5160 | 5221 | } |
5161 | 5222 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java
View file @
6b65eaa
... | ... | @@ -39,7 +39,7 @@ |
39 | 39 | BaseResponse report(String id, Integer userId, String rid, String version, String doctorId, String beforeWeight, String height, String bregmatic, String bregmaticOther); |
40 | 40 | |
41 | 41 | |
42 | - BaseResponse wxReport(String pid); | |
42 | + BaseResponse wxReport(String pid,Integer type); | |
43 | 43 | |
44 | 44 | BaseResponse wxServiceStatus(String pid); |
45 | 45 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
6b65eaa
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | import com.lyms.platform.permission.service.PatientServiceService; |
25 | 25 | import com.lyms.platform.permission.service.UsersService; |
26 | 26 | import com.lyms.platform.pojo.*; |
27 | +import com.lyms.platform.query.MatDeliverQuery; | |
27 | 28 | import com.lyms.platform.query.PatientsQuery; |
28 | 29 | import com.lyms.platform.query.SmsConfigQuery; |
29 | 30 | import com.lyms.platform.query.SmsTemplateQuery; |
... | ... | @@ -124,6 +125,8 @@ |
124 | 125 | private BabyNutritionService babyNutritionService; |
125 | 126 | @Autowired |
126 | 127 | private ITemporaryWeightDao temporaryWeightDao; |
128 | + @Autowired | |
129 | + private MatDeliverService matDeliverService; | |
127 | 130 | |
128 | 131 | /** |
129 | 132 | * 最低:0~13 : 0~1.9 13~40 1.9~11.9 |
... | ... | @@ -143,7 +146,7 @@ |
143 | 146 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
144 | 147 | String nowWeight = patientWeight.getNowWeight(); |
145 | 148 | Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); |
146 | - PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("type").is(1) | |
149 | + PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("type").is(patients.getType()) | |
147 | 150 | .and("pid").is(patients.getPid()).and("yn").is("1").and("hospitalId").is(hospitalId)), PatientWeight.class); |
148 | 151 | if (pw == null && StringUtils.isEmpty(patientWeight.getBeforeWeight())) { |
149 | 152 | patients = mongoTemplate.findOne(Query.query(Criteria.where("source").is(patientWeight.getPatientId()).and("hospitalId").is(hospitalId).and("enable").is("2")), Patients.class); |
... | ... | @@ -911,6 +914,42 @@ |
911 | 914 | }else { |
912 | 915 | params.put("riskFactorId",patients.getRiskFactorId()); |
913 | 916 | } |
917 | + if (patients.getType()==3){ | |
918 | + MatDeliverQuery deliverQuery=new MatDeliverQuery(); | |
919 | + deliverQuery.setYn(1); | |
920 | + deliverQuery.setParentId(patients.getId()); | |
921 | + List<MaternalDeliverModel> modelList=matDeliverService.query(deliverQuery); | |
922 | + | |
923 | + String deliveryMode = ""; | |
924 | + if (org.apache.commons.lang.StringUtils.isNotEmpty(modelList.get(0).getDeliveryMode())) { | |
925 | + | |
926 | + StringBuilder sb = new StringBuilder(); | |
927 | + Map m = JsonUtil.str2Obj(modelList.get(0).getDeliveryMode(), Map.class); | |
928 | + String fmfs = null; | |
929 | + if (m != null) { | |
930 | + Object b = m.get("fmfs"); | |
931 | + if (b != null) { | |
932 | + fmfs = b.toString(); | |
933 | + if (fmfs != null) { | |
934 | + if (fmfs.equals("1")) { | |
935 | + String fmName = FmTypeEnums.getFmNameById(fmfs); | |
936 | + sb.append(fmName); | |
937 | + if (null != m.get("scfs") && !"null".equals(m.get("scfs").toString())) { | |
938 | + sb.append(","); | |
939 | + String scfs = m.get("scfs").toString(); | |
940 | + sb.append(FmTypeEnums.getFmScNameById(scfs)); | |
941 | + } | |
942 | + deliveryMode = sb.toString(); | |
943 | + } else if (fmfs.equals("2")) { | |
944 | + String fmName = FmTypeEnums.getFmNameById(fmfs); | |
945 | + deliveryMode = fmName; | |
946 | + } | |
947 | + } | |
948 | + } | |
949 | + } | |
950 | + } | |
951 | + params.put("deliveryModel",deliveryMode); | |
952 | + } | |
914 | 953 | } |
915 | 954 | } |
916 | 955 | return new BaseObjectResponse().setData(params).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
... | ... | @@ -1357,8 +1396,8 @@ |
1357 | 1396 | |
1358 | 1397 | |
1359 | 1398 | @Override |
1360 | - public BaseResponse wxReport(String pid) { | |
1361 | - PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("yn").ne("0")), PatientWeight.class); | |
1399 | + public BaseResponse wxReport(String pid,Integer type) { | |
1400 | + PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("yn").ne("0").and("type").is(type)), PatientWeight.class); | |
1362 | 1401 | if (patientWeight != null) { |
1363 | 1402 | Map<String, Object> map = new LinkedHashMap<>(); |
1364 | 1403 | map.put("beforeWeight", patientWeight.getBeforeWeight()); |
... | ... | @@ -1393,7 +1432,7 @@ |
1393 | 1432 | String nowWeight = patientWeight.getNowWeight(); |
1394 | 1433 | Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); |
1395 | 1434 | // PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patientWeight.getPid())), PatientWeight.class); |
1396 | - PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientWeight.getPatientId())), PatientWeight.class); | |
1435 | + PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientWeight.getPatientId()).and("type").is(patients.getType())), PatientWeight.class); | |
1397 | 1436 | Map<String, String> dayWeights = new LinkedHashMap<>(); |
1398 | 1437 | List<Map<String, Object>> dayWeights2 = new ArrayList<>(); |
1399 | 1438 | String ymdDate = DateUtil.getyyyy_MM_dd(new Date()); |
... | ... | @@ -1522,7 +1561,9 @@ |
1522 | 1561 | patientWeight.setCreated(new Date(Long.parseLong(patientWeight.getCreated2()))); |
1523 | 1562 | patientWeight.setCreated2(null); |
1524 | 1563 | |
1525 | - PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patientWeight.getPid())), PatientWeight.class); | |
1564 | + Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); | |
1565 | + patientWeight.setType(patients.getType()); | |
1566 | + PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patientWeight.getPid()).and("type").is(patients.getType())), PatientWeight.class); | |
1526 | 1567 | if (pw != null) { |
1527 | 1568 | patientWeight.setId(pw.getId()); |
1528 | 1569 | Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(patientWeight)); |