Commit aa0ec54f7e2c08c535ddfc7073470cd66842269c

Authored by liquanyu
1 parent 69ac760834

update

Showing 1 changed file with 113 additions and 29 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ aa0ec54
1 1 package com.lyms.platform.operate.web.facade;
2 2  
3 3 import com.lyms.hospitalapi.dzfy.DzfyHisService;
  4 +import com.lyms.hospitalapi.pojo.QhdDjq;
4 5 import com.lyms.hospitalapi.zcfy.ZcPrenatalService;
5 6 import com.lyms.platform.beans.MsgRequest;
6 7 import com.lyms.platform.biz.SequenceConstant;
7 8  
8 9  
... ... @@ -12,17 +13,14 @@
12 13 import com.lyms.platform.common.dao.BaseQuery;
13 14 import com.lyms.platform.common.dao.operator.MongoQuery;
14 15 import com.lyms.platform.common.enums.*;
15   -import com.lyms.platform.common.result.BaseListResponse;
16   -import com.lyms.platform.common.result.BaseObjectResponse;
17   -import com.lyms.platform.common.result.BaseResponse;
  16 +import com.lyms.platform.common.result.*;
18 17 import com.lyms.platform.common.utils.*;
19 18 import com.lyms.platform.common.utils.BeanUtils;
  19 +import com.lyms.platform.common.utils.HttpClientUtil;
20 20 import com.lyms.platform.operate.web.request.*;
21 21 import com.lyms.platform.operate.web.result.*;
22 22 import com.lyms.platform.operate.web.service.ITrackDownService;
23   -import com.lyms.platform.operate.web.utils.InitDataUtils;
24   -import com.lyms.platform.operate.web.utils.MongoUtil;
25   -import com.lyms.platform.operate.web.utils.ResolveUtils;
  23 +import com.lyms.platform.operate.web.utils.*;
26 24 import com.lyms.platform.permission.model.Organization;
27 25 import com.lyms.platform.permission.model.PatientService;
28 26 import com.lyms.platform.permission.model.PatientServiceQuery;
... ... @@ -397,6 +395,12 @@
397 395 return resp;
398 396 } else {
399 397 couponService.use(autoMatchFacade.getHospitalId(userId), antExAddRequest.getCouponCode(), userId, model.getId());
  398 +
  399 + //秦皇岛妇幼使用完优惠劵后需要把对应优惠劵插入到秦皇岛妇幼his
  400 + if ("216".equals(hospitalId))
  401 + {
  402 + qhdCouponUse( hospitalId, antExAddRequest.getCouponCode(), userId);
  403 + }
400 404 }
401 405 }
402 406 operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospitalId), model, OptActionEnums.ADD.getId(), "添加复诊");
403 407  
... ... @@ -500,17 +504,15 @@
500 504  
501 505 try {
502 506 //处方计划
503   - if (antExamModel.getNextCheckTime() != null)
504   - {
505   - saveCheckItem(antExamModel.getNextCheckTime(),patients);
  507 + if (antExamModel.getNextCheckTime() != null) {
  508 + saveCheckItem(antExamModel.getNextCheckTime(), patients);
506 509 }
507 510 } catch (Exception e) {
508 511 e.printStackTrace();
509 512 }
510 513 try {
511 514 //处方计划
512   - if (antExamModel.getCheckDate() != null)
513   - {
  515 + if (antExamModel.getCheckDate() != null) {
514 516 saveCheckActual(antExamModel.getCheckDate(), patients);
515 517 }
516 518 } catch (Exception e) {
517 519  
... ... @@ -519,10 +521,9 @@
519 521  
520 522 try {
521 523 //处方计划
522   - if (antExamModel.getNextCheckTime() != null)
523   - {
  524 + if (antExamModel.getNextCheckTime() != null) {
524 525 patients = patientsService.findOnePatientById(antExamModel.getParentId());
525   - updateTrackCount(antExamModel.getCheckDate(), antExamModel.getNextCheckTime(),patients);
  526 + updateTrackCount(antExamModel.getCheckDate(), antExamModel.getNextCheckTime(), patients);
526 527 }
527 528 } catch (Exception e) {
528 529 e.printStackTrace();
529 530  
530 531  
531 532  
532 533  
533 534  
534 535  
535 536  
... ... @@ -1091,43 +1092,46 @@
1091 1092 patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
1092 1093 patientsService.updatePatient(patients);
1093 1094 } catch (Exception e) {
1094   - e.printStackTrace();
1095 1095 }
1096 1096 try {
1097 1097 //修改的时候设置最新的高危/冗余筛查结果和下次产检预约时间
1098 1098 updateLastRisk(patients.getId());
1099 1099 } catch (Exception e) {
1100   - e.printStackTrace();
1101 1100 }
1102 1101 try {
1103 1102 //修改最后一次定义高危的时间
1104 1103 updateLastRhTime(patients.getId(), hospitalId);
1105 1104 } catch (Exception e) {
1106   - e.printStackTrace();
1107 1105 }
1108 1106 try {
1109 1107 // 修改最后一次产检时间
1110 1108 setLashCTimes(excAddRequest.getParentId());
1111 1109 } catch (Exception e) {
1112   - e.printStackTrace();
1113 1110 }
1114 1111 try {
1115   - /** 把优惠券设置为已使用状态 */
1116   - couponService.use(hospitalId, excAddRequest.getCouponCode(), userId, excAddRequest.getId());
  1112 + if (StringUtils.isNotEmpty(excAddRequest.getCouponCode()))
  1113 + {
  1114 + /** 把优惠券设置为已使用状态 */
  1115 + couponService.use(hospitalId, excAddRequest.getCouponCode(), userId, excAddRequest.getId());
  1116 +
  1117 + //秦皇岛妇幼使用完优惠劵后需要把对应优惠劵插入到秦皇岛妇幼his
  1118 + if ("216".equals(hospitalId))
  1119 + {
  1120 + qhdCouponUse( hospitalId, excAddRequest.getCouponCode(), userId);
  1121 + }
  1122 + }
1117 1123 } catch (Exception e) {
1118   - e.printStackTrace();
  1124 +
1119 1125 }
1120 1126 try {
1121 1127 //冗余到产检表
1122 1128 antenatalExaminationService.updateAntExRecord(excAddRequest.getId(), 1);
1123 1129 } catch (Exception e) {
1124   - e.printStackTrace();
1125 1130 }
1126 1131 try {
1127 1132 //修改数据
1128 1133 syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
1129 1134 } catch (Exception e) {
1130   - e.printStackTrace();
1131 1135 }
1132 1136 try {
1133 1137 //聊城东昌府医院初诊的身高更新到随心测
... ... @@ -1135,7 +1139,6 @@
1135 1139 measureInfoFacade.updateHeight(excAddRequest.getParentId(), hospitalId, excAddRequest.getHeight());
1136 1140 }
1137 1141 } catch (Exception e) {
1138   - e.printStackTrace();
1139 1142 }
1140 1143 try {
1141 1144 if (CollectionUtils.isNotEmpty(excAddRequest.getOtherHighRisk())) {
... ... @@ -1143,7 +1146,6 @@
1143 1146 highRiskFacade.dispHospHighRiskUse(JsonUtil.array2JsonString(excAddRequest.getOtherHighRisk()));
1144 1147 }
1145 1148 } catch (Exception e) {
1146   - e.printStackTrace();
1147 1149 }
1148 1150  
1149 1151 try {
... ... @@ -1152,7 +1154,6 @@
1152 1154 createSendMsg(patients.getId());
1153 1155 }
1154 1156 } catch (Exception e) {
1155   - e.printStackTrace();
1156 1157 }
1157 1158  
1158 1159 //诸城市妇幼保健院
... ... @@ -1169,7 +1170,6 @@
1169 1170 saveCheckItem(DateUtil.parseYMD(excAddRequest.getNextCheckTime()),patients);
1170 1171 }
1171 1172 } catch (Exception e) {
1172   - e.printStackTrace();
1173 1173 }
1174 1174 try {
1175 1175 //处方计划
... ... @@ -1178,7 +1178,6 @@
1178 1178 saveCheckActual(DateUtil.parseYMD(excAddRequest.getCheckTime()), patients);
1179 1179 }
1180 1180 } catch (Exception e) {
1181   - e.printStackTrace();
1182 1181 }
1183 1182  
1184 1183 try {
1185 1184  
... ... @@ -1188,10 +1187,95 @@
1188 1187 saveTrackCount(DateUtil.parseYMD(excAddRequest.getNextCheckTime()), patients);
1189 1188 }
1190 1189 } catch (Exception e) {
1191   - e.printStackTrace();
1192 1190 }
1193 1191 }
1194 1192 });
  1193 + }
  1194 +
  1195 + private void qhdCouponUse(String hospitalId,String code,Integer userId)
  1196 + {
  1197 + //获取优惠劵类型
  1198 + Map<String,String> param = new HashMap<>();
  1199 + param.put("hospitalId",hospitalId);
  1200 + param.put("code", code);
  1201 + Map<String,String> couponInfo = couponService.findCouponByCode(param);
  1202 +
  1203 + if (couponInfo == null || couponInfo.size() == 0)
  1204 + {
  1205 + return ;
  1206 + }
  1207 +
  1208 + PatientsQuery patientsQuery = new PatientsQuery();
  1209 + patientsQuery.setPid(couponInfo.get("pId"));
  1210 + patientsQuery.setYn(YnEnums.YES.getId());
  1211 +
  1212 + List<Patients> list = patientsService.queryPatient1(patientsQuery, "created");
  1213 + QhdDjq model = new QhdDjq();
  1214 + if (CollectionUtils.isNotEmpty(list))
  1215 + {
  1216 + Patients patient = list.get(0);
  1217 + model.setPatName(patient.getUsername());
  1218 + model.setPatIdCardNo(patient.getCardNo());
  1219 + model.setPatCardNo(patient.getVcCardNo());
  1220 + model.setPatPhoneNumber(patient.getPhone());
  1221 + model.setTokenCardNo(code);
  1222 + model.setCardStatus("1");//1 正常 9作废 默认1(必须填写)
  1223 + model.setLmpDate(DateUtil.getyyyy_MM_dd_hms(patient.getLastMenses()));
  1224 +
  1225 + AntExChuQuery antExChuQuery1 = new AntExChuQuery();
  1226 + antExChuQuery1.setParentId(patient.getId());
  1227 + antExChuQuery1.setYn(YnEnums.YES.getId());
  1228 + List<AntExChuModel> data = antenatalExaminationService.queryAntExChu(antExChuQuery1);
  1229 + Integer gravidity = 1; //孕次
  1230 + if (CollectionUtils.isNotEmpty(data))
  1231 + {
  1232 + AntExChuModel chuModel = data.get(0);
  1233 + if (chuModel != null && chuModel.getPregnancyTimes() != null)
  1234 + {
  1235 + gravidity = chuModel.getPregnancyTimes();
  1236 + }
  1237 + }
  1238 +
  1239 + model.setGravidity(String.valueOf(gravidity));
  1240 + Object order = couponInfo.get("couponOrder");
  1241 + model.setSerialNumber(order == null ? "0" : order.toString());
  1242 +
  1243 + String hospital = "";
  1244 + if (org.apache.commons.lang.StringUtils.isNotEmpty(couponInfo.get("createHospitalId"))) {
  1245 + Organization organization = organizationService.getOrganization(Integer.parseInt(couponInfo.get("createHospitalId")));
  1246 + if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
  1247 + hospital = organization.getName();
  1248 + String areaId = organization.getAreaId();
  1249 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(areaId);
  1250 + String areaName = basicConfig.getName();
  1251 + model.setAreaFrom(areaName);
  1252 + }
  1253 + }
  1254 + model.setPostHos(hospital);
  1255 +
  1256 + String checkDoctor = CommonsHelper.getUserName(patient.getBookbuildingDoctor(), usersService);
  1257 +
  1258 + model.setPostDoc(checkDoctor);
  1259 + model.setApplyInfo("产检");
  1260 + model.setApplyTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
  1261 + model.setRemark("");
  1262 + Users users = usersService.getUsers(userId);
  1263 + if (users != null) {
  1264 + model.setWorkerId(users.getAccount());
  1265 + }
  1266 + else
  1267 + {
  1268 + model.setWorkerId("");
  1269 + }
  1270 + }
  1271 +
  1272 + System.out.println(model.toString());
  1273 +
  1274 +// String result = HospitalCouponPrintUtils.qhdCouponUse(model);
  1275 +// if("0".equals(result)){
  1276 +// int count = couponService.updateCouponStatus(param);
  1277 +// System.out.println("update coupon count " + count);
  1278 +// }
1195 1279 }
1196 1280  
1197 1281 public void saveTrackCount(Date nextCheckTime,Patients patients)