Commit 0dabfebd005c93a70747d52352bd9e079f370f63

Authored by yangfei
1 parent 1c1c961557
Exists in master and in 1 other branch dev

孕期产检提醒

Showing 8 changed files with 395 additions and 163 deletions

platform-common/src/main/java/com/lyms/platform/common/enums/WxTempleteIdEnums.java View file @ 0dabfeb
... ... @@ -22,7 +22,7 @@
22 22 CHAN_YI_BAN_ZHI_DAO("H2_ucLqVEbsZAv-EZcmUDpD1Zul5NGqMoJktHT0u4gw","产妇一般指导"),//产妇
23 23 BABY_YI_BAN_ZHI_DAO("dqvyESU8UXx1V3cIMQDqj4PLxI6T9-sgihQcs3ZGL9E","儿童一般指导"),//儿童
24 24 YUN_XUE_KE_CHEN_TX("","孕妇学校课程提醒"),//孕妇学校课程提醒
25   -
  25 + FU_WU_DING_GOU_TX("UEwcdz3lJL3NR38KRqN6yTO4nUvRgym5mlXl4jXQBik","服务订购提醒"),//孕妇学校课程提醒
26 26 YI_SHENG_ZHI_DAO("OggqiSHitLkCgSLCaCH72reCZzaw5NyG8iO56InQiQg","医生指导");//指导
27 27 // WEI_JI_ZHI_DAO("fNkkLSp_gS-YWvzji6gwgdTddl4XBlk8SNP7FRksrfk","危急值提醒");//危急值提醒
28 28  
platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java View file @ 0dabfeb
... ... @@ -288,6 +288,13 @@
288 288 return repalceStr;
289 289 }
290 290  
  291 + public static String replaceNameRisk(String name, String risk,String repalceStr) {
  292 + if (StringUtils.isNotEmpty(repalceStr)) {
  293 + return repalceStr.replace("{{姓名}}", name).replace("{{高危因素}}", risk);
  294 + }
  295 + return repalceStr;
  296 + }
  297 +
291 298 public static String replaceBaby(String name, Date birth, String repalceStr) {
292 299 if (StringUtils.isNotEmpty(repalceStr)) {
293 300 String date = DateUtil.getyyyy_MM_dd(birth);
platform-common/src/main/java/com/lyms/platform/common/utils/SystemConfig.java View file @ 0dabfeb
... ... @@ -37,6 +37,8 @@
37 37 public static final String JIWANGSHI_ID="d0b47bdc-c516-4f86-95fa-176a33ca73bf";
38 38 //高危id
39 39 public static final String HIGH_RISK_ID="fb43fd5a-b153-4cb9-9180-c46f5612ba43";
  40 + //儿童高危id
  41 + public static final String BABY_HIGH_RISK_ID="5b18f8a7422b03d4ad2bf913";
40 42  
41 43 //血型
42 44 public static final String XUEXING ="5769eef90cf22c315757741f";
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java View file @ 0dabfeb
... ... @@ -19,13 +19,6 @@
19 19  
20 20 private String shortCode;
21 21  
22   - public String getShortCode() {
23   - return shortCode;
24   - }
25   -
26   - public void setShortCode(String shortCode) {
27   - this.shortCode = shortCode;
28   - }
29 22 //筛查结果
30 23 private List<String> screenResult;
31 24 // 纠正末次月经 (和末次月经反起存)
32 25  
... ... @@ -44,85 +37,12 @@
44 37 //是否发放母子保健手册
45 38 private String sendCareMan;
46 39  
47   - public String getSendCareMan() {
48   - return sendCareMan;
49   - }
50   -
51   - public void setSendCareMan(String sendCareMan) {
52   - this.sendCareMan = sendCareMan;
53   - }
54   -
55   - public Boolean getReqHusband() {
56   - return reqHusband;
57   - }
58   -
59   - public void setReqHusband(Boolean reqHusband) {
60   - this.reqHusband = reqHusband;
61   - }
62   -
63   - public Date getFuckLastMens() {
64   - return fuckLastMens;
65   - }
66   -
67   - public String getLastMenstrualPeriodBasisOther() {
68   - return lastMenstrualPeriodBasisOther;
69   - }
70   -
71   - public void setLastMenstrualPeriodBasisOther(String lastMenstrualPeriodBasisOther) {
72   - this.lastMenstrualPeriodBasisOther = lastMenstrualPeriodBasisOther;
73   - }
74   -
75   - public void setFuckLastMens(Date fuckLastMens) {
76   - this.fuckLastMens = fuckLastMens;
77   - }
78   -
79   - public String getLastMenstrualPeriodBasis() {
80   - return lastMenstrualPeriodBasis;
81   - }
82   -
83   - public void setLastMenstrualPeriodBasis(String lastMenstrualPeriodBasis) {
84   - this.lastMenstrualPeriodBasis = lastMenstrualPeriodBasis;
85   - }
86   -
87   - public String getLastMenstrualPeriodBasisDoctorId() {
88   - return lastMenstrualPeriodBasisDoctorId;
89   - }
90   -
91   - public void setLastMenstrualPeriodBasisDoctorId(String lastMenstrualPeriodBasisDoctorId) {
92   - this.lastMenstrualPeriodBasisDoctorId = lastMenstrualPeriodBasisDoctorId;
93   - }
94   -
95   - public String getLastMenstrualPeriodBasisDate() {
96   - return lastMenstrualPeriodBasisDate;
97   - }
98   -
99   - public void setLastMenstrualPeriodBasisDate(String lastMenstrualPeriodBasisDate) {
100   - this.lastMenstrualPeriodBasisDate = lastMenstrualPeriodBasisDate;
101   - }
102   -
103   -
104 40 // 月经周期开始天数
105 41 private String mensStartDay;
106 42  
107 43 // 月经周期开始天数
108 44 private String mensEndDay;
109 45  
110   - public String getMensEndDay() {
111   - return mensEndDay;
112   - }
113   -
114   - public String getMensStartDay() {
115   - return mensStartDay;
116   - }
117   -
118   - public void setMensEndDay(String mensEndDay) {
119   - this.mensEndDay = mensEndDay;
120   - }
121   -
122   - public void setMensStartDay(String mensStartDay) {
123   - this.mensStartDay = mensStartDay;
124   - }
125   -
126 46 /**
127 47 * 身份证号码
128 48 */
... ... @@ -362,6 +282,86 @@
362 282  
363 283 //面部信息
364 284 private String face;
  285 +
  286 + public String getShortCode() {
  287 + return shortCode;
  288 + }
  289 +
  290 + public void setShortCode(String shortCode) {
  291 + this.shortCode = shortCode;
  292 + }
  293 +
  294 + public String getMensEndDay() {
  295 + return mensEndDay;
  296 + }
  297 +
  298 + public String getMensStartDay() {
  299 + return mensStartDay;
  300 + }
  301 +
  302 + public void setMensEndDay(String mensEndDay) {
  303 + this.mensEndDay = mensEndDay;
  304 + }
  305 +
  306 + public void setMensStartDay(String mensStartDay) {
  307 + this.mensStartDay = mensStartDay;
  308 + }
  309 +
  310 + public String getSendCareMan() {
  311 + return sendCareMan;
  312 + }
  313 +
  314 + public void setSendCareMan(String sendCareMan) {
  315 + this.sendCareMan = sendCareMan;
  316 + }
  317 +
  318 + public Boolean getReqHusband() {
  319 + return reqHusband;
  320 + }
  321 +
  322 + public void setReqHusband(Boolean reqHusband) {
  323 + this.reqHusband = reqHusband;
  324 + }
  325 +
  326 + public Date getFuckLastMens() {
  327 + return fuckLastMens;
  328 + }
  329 +
  330 + public String getLastMenstrualPeriodBasisOther() {
  331 + return lastMenstrualPeriodBasisOther;
  332 + }
  333 +
  334 + public void setLastMenstrualPeriodBasisOther(String lastMenstrualPeriodBasisOther) {
  335 + this.lastMenstrualPeriodBasisOther = lastMenstrualPeriodBasisOther;
  336 + }
  337 +
  338 + public void setFuckLastMens(Date fuckLastMens) {
  339 + this.fuckLastMens = fuckLastMens;
  340 + }
  341 +
  342 + public String getLastMenstrualPeriodBasis() {
  343 + return lastMenstrualPeriodBasis;
  344 + }
  345 +
  346 + public void setLastMenstrualPeriodBasis(String lastMenstrualPeriodBasis) {
  347 + this.lastMenstrualPeriodBasis = lastMenstrualPeriodBasis;
  348 + }
  349 +
  350 + public String getLastMenstrualPeriodBasisDoctorId() {
  351 + return lastMenstrualPeriodBasisDoctorId;
  352 + }
  353 +
  354 + public void setLastMenstrualPeriodBasisDoctorId(String lastMenstrualPeriodBasisDoctorId) {
  355 + this.lastMenstrualPeriodBasisDoctorId = lastMenstrualPeriodBasisDoctorId;
  356 + }
  357 +
  358 + public String getLastMenstrualPeriodBasisDate() {
  359 + return lastMenstrualPeriodBasisDate;
  360 + }
  361 +
  362 + public void setLastMenstrualPeriodBasisDate(String lastMenstrualPeriodBasisDate) {
  363 + this.lastMenstrualPeriodBasisDate = lastMenstrualPeriodBasisDate;
  364 + }
365 365  
366 366 public String getFace() {
367 367 return face;
platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java View file @ 0dabfeb
... ... @@ -9,7 +9,6 @@
9 9 import org.apache.commons.collections.CollectionUtils;
10 10 import org.springframework.data.mongodb.core.query.Criteria;
11 11  
12   -import java.util.ArrayList;
13 12 import java.util.Date;
14 13 import java.util.List;
15 14  
... ... @@ -44,6 +43,25 @@
44 43 private Integer first; // 1否 2 是,是否当前医院第一次初诊 德州需求
45 44  
46 45  
  46 +
  47 +
  48 + //生日查询
  49 + private Date birthEnd;
  50 + private Date birthStart;
  51 +
  52 + //户籍地
  53 + private String provinceRegisterId;
  54 + private String cityRegisterId;
  55 + private String areaRegisterId;
  56 + private String streetRegisterId;
  57 +
  58 + //居住地
  59 + private String provinceId;
  60 + private String cityId;
  61 + private String areaId;
  62 + private String streetId;
  63 + private Integer type;
  64 +
47 65 public Integer getFirst() {
48 66 return first;
49 67 }
... ... @@ -84,23 +102,6 @@
84 102 this.cDueWeekEnd = cDueWeekEnd;
85 103 }
86 104  
87   - //生日查询
88   - private Date birthEnd;
89   - private Date birthStart;
90   -
91   - //户籍地
92   - private String provinceRegisterId;
93   - private String cityRegisterId;
94   - private String areaRegisterId;
95   - private String streetRegisterId;
96   -
97   - //居住地
98   - private String provinceId;
99   - private String cityId;
100   - private String areaId;
101   - private String streetId;
102   - private Integer type;
103   -
104 105 public Integer getType() {
105 106 return type;
106 107 }
... ... @@ -474,8 +475,7 @@
474 475 }
475 476 if(null!=rFactorList &&!rFactorList.isEmpty()){
476 477 condition = condition.and("hRisk", rFactorList, MongoOper.IN);
477   - }else
478   - if (StringUtils.isNotEmpty(rFactor)) {
  478 + }else if (StringUtils.isNotEmpty(rFactor)) {
479 479 condition = condition.and("hRisk", rFactor, MongoOper.IN);
480 480 }
481 481 if (null != status) {
platform-dal/src/main/java/com/lyms/platform/query/SmsTemplateQuery.java View file @ 0dabfeb
... ... @@ -7,8 +7,6 @@
7 7 import com.lyms.platform.common.dao.operator.MongoQuery;
8 8 import org.bson.types.ObjectId;
9 9  
10   -import java.util.Date;
11   -
12 10 /**
13 11 * 短信模板配置查询对象
14 12 *
15 13  
... ... @@ -66,7 +64,10 @@
66 64 //模板类型 0推送 1短信
67 65 private Integer templateType;
68 66  
  67 + //健康类型 0健康 1高危
  68 + private Integer healthType;
69 69  
  70 +
70 71 @Override
71 72 public MongoQuery convertToQuery() {
72 73 MongoCondition condition = MongoCondition.newInstance();
... ... @@ -77,6 +78,9 @@
77 78 if (null != id) {
78 79 condition = condition.and("id", new ObjectId(id), MongoOper.IS);
79 80 }
  81 + if (null != healthType) {
  82 + condition = condition.and("healthType", healthType, MongoOper.IS);
  83 + }
80 84 if (-1 != yn) {
81 85 condition = condition.and("yn", yn, MongoOper.IS);
82 86 }
... ... @@ -115,6 +119,14 @@
115 119 condition = condition.and("content", content, MongoOper.LIKE);
116 120 }
117 121 return condition.toMongoQuery();
  122 + }
  123 +
  124 + public Integer getHealthType() {
  125 + return healthType;
  126 + }
  127 +
  128 + public void setHealthType(Integer healthType) {
  129 + this.healthType = healthType;
118 130 }
119 131  
120 132 public Integer getTemplateType() {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ 0dabfeb
... ... @@ -88,7 +88,7 @@
88 88 // antExRecordQuery.setName(antExManagerQueryRequest.getName());
89 89 // antExRecordQuery.setPhone(antExManagerQueryRequest.getPhone());
90 90 antExRecordQuery.setrFactor(antExManagerQueryRequest.getRiskFactorId());
91   - antExRecordQuery.setrFactorList(com.lyms.platform.common.utils.StringUtils.covertToList(antExManagerQueryRequest.getRiskFactorId(), String.class));
  91 + antExRecordQuery.setrFactorList(StringUtils.covertToList(antExManagerQueryRequest.getRiskFactorId(), String.class));
92 92 antExRecordQuery.setLevelId(antExManagerQueryRequest.getLevel());
93 93 antExRecordQuery.setBarCode(antExManagerQueryRequest.getBarCode());
94 94 // antExRecordQuery.setCardNo(antExManagerQueryRequest.getCardNo());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 0dabfeb
1 1 package com.lyms.platform.operate.web.facade;
2 2  
3 3 import com.lyms.hospitalapi.dzfy.DzfyHisService;
  4 +import com.lyms.platform.beans.MsgRequest;
4 5 import com.lyms.platform.biz.SequenceConstant;
5 6 import com.lyms.platform.biz.service.*;
6 7 import com.lyms.platform.common.constants.ErrorCodeConstants;
7 8  
8 9  
9 10  
... ... @@ -121,12 +122,13 @@
121 122  
122 123 @Autowired
123 124 private MeasureInfoFacade measureInfoFacade;
124   -
125 125 @Autowired
  126 + private SmsTemplateService smsTemplateService;
  127 + @Autowired
126 128 private SieveFacade sieveFacade;
127   -
128   -
129 129 @Autowired
  130 + private SmsConfigFacade smsConfigFacade;
  131 + @Autowired
130 132 private DiagnoseConfigService diagnoseConfigService;
131 133  
132 134 @Autowired
... ... @@ -331,6 +333,12 @@
331 333 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
332 334 }
333 335  
  336 + /**
  337 + * 复诊数据自动流转
  338 + *
  339 + * @param antExamModel
  340 + * @param hospitalId
  341 + */
334 342 public void updateAutoData(final AntenatalExaminationModel antExamModel, final String hospitalId) {
335 343 commonThreadPool.execute(new Runnable() {
336 344 @Override
... ... @@ -387,6 +395,7 @@
387 395 });
388 396 }
389 397  
  398 +
390 399 //修改转诊单/最后一次产检医生,高危及诊断信息
391 400 public void updateApplyOrder(final AntenatalExaminationModel antenatalExamination, final String parentId) {
392 401 Patients patients = patientsService.findOnePatientById(parentId);
... ... @@ -431,7 +440,7 @@
431 440 model1.setrLevel(rlevel);
432 441 try {
433 442 //风险名称
434   - model1.setrRisk(queryRiskName(patients.getRiskFactorId()));
  443 + model1.setrRisk(queryRiskListName(patients.getRiskFactorId()));
435 444 //高危集合ID
436 445 model1.setRiskFactorId(patients.getRiskFactorId());
437 446 System.out.println("待修改转诊信息:" + model1.toString());
... ... @@ -448,7 +457,7 @@
448 457 }
449 458  
450 459 /**
451   - * 增加或修改产前检查记录(初诊)
  460 + * 增加或修改产记录(初诊)
452 461 *
453 462 * @param excAddRequest
454 463 * @return
... ... @@ -483,28 +492,28 @@
483 492 if (StringUtils.isNotEmpty(antExChuModel.getId()) && StringUtils.isNotEmpty(antExChuModel.getParentId())) {
484 493 antenatalExaminationService.updateAntExChu(antExChuModel, antExChuModel.getId());
485 494 antenatalExaminationService.updatePatientAbortion(antExChuModel.getId(), antExChuModel.getAbortionZR(), antExChuModel.getAbortionRG());
486   - commonThreadPool.execute(new Runnable() {
487   - @Override
488   - public void run() {
489   - Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
490   - patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
491   -
492   - if (StringUtils.isNotEmpty(patients.getEnable()) && "0".equals(patients.getEnable())) {
493   - patients.setEnable("1");
494   - }
495   - patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
496   - patientsService.updatePatient(patients);
497   - //修改的时候设置最新的高危/冗余筛查结果和下次产检预约时间
498   - updateLastRisk(patients.getId());
499   - //修改本院最后一次定义高危
500   - updateLastRhTime(patients.getId(), hospitalId);
501   - setLashCTimes(excAddRequest.getParentId());
502   - //冗余到产检表
503   - antenatalExaminationService.updateAntExRecord(excAddRequest.getId(), 1);
504   - //修改数据
505   - syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
506   - }
507   - });
  495 + // commonThreadPool.execute(new Runnable() {
  496 + // @Override
  497 + // public void run() {
  498 + // Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
  499 + //
  500 + // if (StringUtils.isNotEmpty(patients.getEnable()) && "0".equals(patients.getEnable())) {
  501 + // patients.setEnable("1");
  502 + // }
  503 + // patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
  504 + // patientsService.updatePatient(patients);
  505 + // patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
  506 + // //修改的时候设置最新的高危/冗余筛查结果和下次产检预约时间
  507 + // updateLastRisk(patients.getId());
  508 + // //修改本院最后一次定义高危
  509 + // updateLastRhTime(patients.getId(), hospitalId);
  510 + // setLashCTimes(excAddRequest.getParentId());
  511 + // //冗余到产检表
  512 + // antenatalExaminationService.updateAntExRecord(excAddRequest.getId(), 1);
  513 + // //修改数据
  514 + // syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
  515 + // }
  516 + // });
508 517 AntExChuQuery antExChuQuery = new AntExChuQuery();
509 518 antExChuQuery.setYn(YnEnums.YES.getId());
510 519 antExChuQuery.setId(antExChuModel.getId());
... ... @@ -517,7 +526,7 @@
517 526 List<AntExChuModel> data1 = antenatalExaminationService.queryAntExChu(antExChuQuery1);
518 527  
519 528 if (CollectionUtils.isEmpty(data1)) {
520   - final Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
  529 + Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
521 530 PatientsQuery patientsQuery = new PatientsQuery();
522 531 patientsQuery.setPid(patients.getPid());
523 532 patientsQuery.setYn(YnEnums.YES.getId());
524 533  
525 534  
... ... @@ -542,27 +551,29 @@
542 551 antExChuModel.setHospitalId(hospitalId);
543 552 stopWatch.start("queryAntExChu");
544 553 antenatalExaminationService.addOneAntEx(antExChuModel);
  554 + excAddRequest.setId(antExChuModel.getId());
545 555  
546   - final String chuId = antExChuModel.getId();
547   - final String chuParentId = antExChuModel.getParentId();
  556 + // final String chuId = antExChuModel.getId();
  557 + // final String chuParentId = antExChuModel.getParentId();
548 558  
549   - commonThreadPool.execute(new Runnable() {
550   - @Override
551   - public void run() {
552   - patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
553   - patientsService.updatePatient(patients);
554   - /** 把优惠券设置为已使用状态 */
555   - couponService.use(hospitalId, excAddRequest.getCouponCode(), userId, chuId);
556   - //修改患者风险等级
557   - patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
558   - updateLastRisk(patients.getId());
559   - //修改本院最后一次定义高危
560   - updateLastRhTime(patients.getId(), hospitalId);
561   - setLashCTimes(chuParentId);
562   - antenatalExaminationService.updateAntExRecord(chuId, 1);
563   - syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
564   - }
565   - });
  559 + // commonThreadPool.execute(new Runnable() {
  560 + // @Override
  561 + // public void run() {
  562 + // Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
  563 + // patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
  564 + // patientsService.updatePatient(patients);
  565 + // /** 把优惠券设置为已使用状态 */
  566 + // couponService.use(hospitalId, excAddRequest.getCouponCode(), userId, chuId);
  567 + // //修改患者风险等级
  568 + // patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
  569 + // updateLastRisk(patients.getId());
  570 + // //修改本院最后一次定义高危
  571 + // updateLastRhTime(patients.getId(), hospitalId);
  572 + // setLashCTimes(chuParentId);
  573 + // antenatalExaminationService.updateAntExRecord(chuId, 1);
  574 + // syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
  575 + // }
  576 + // });
566 577 operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospitalId), antExChuModel, OptActionEnums.ADD.getId(), "添加初诊");
567 578 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
568 579 Patients patients1 = new Patients();
... ... @@ -594,7 +605,7 @@
594 605 }
595 606 model.setrLevel(rlevel);
596 607 try {
597   - model.setrRisk(queryRiskName(patients.getRiskFactorId()));
  608 + model.setrRisk(queryRiskListName(patients.getRiskFactorId()));
598 609 //高危集合ID
599 610 model.setRiskFactorId(patients.getRiskFactorId());
600 611 } catch (Exception e) {
601 612  
602 613  
603 614  
... ... @@ -622,18 +633,201 @@
622 633 }
623 634 }
624 635  
625   - //聊城东昌府医院初诊的身高更新到随心测
626   - if ("1000000116".equals(hospitalId) || "2100001305".equals(hospitalId)) {
627   - measureInfoFacade.updateHeight(antExChuModel.getParentId(), hospitalId, antExChuModel.getHeight());
  636 + //处理数据自动流转
  637 + updateChuAutoData(excAddRequest, hospitalId, userId);
  638 +
  639 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  640 + }
  641 +
  642 + /**
  643 + * 产检生成推送消息:只针对标准服务的用户
  644 + *
  645 + */
  646 + private void createSendMsg(Patients patient) {
  647 +
  648 + //判断医院是否启动和对应的服务项是否启用
  649 + SmsConfigModel configModel = new SmsConfigModel();
  650 + int startType = smsConfigFacade.hospitalIsStart(patient.getHospitalId(), configModel, SmsServiceEnums.FWDGTX.getId());
  651 + if (startType == 0) {
  652 + return;
628 653 }
629 654  
630 655  
631   - //处理自定义高危状态为已使用状态
632   - highRiskFacade.dispHospHighRiskUse(antExChuModel.getOtherHighRisk());
633   - return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  656 + boolean isHightRisk = false;
  657 + if (patient.getRiskScore() != null) {
  658 + if (patient.getRiskScore() > 0) {//高危评分大于0
  659 + isHightRisk = true;
  660 + }
  661 + }
  662 +
  663 + SmsTemplateQuery query = new SmsTemplateQuery();
  664 + query.setYn(YnEnums.YES.getId());
  665 + query.setStatus(1);
  666 + query.setHospitalId(patient.getHospitalId());
  667 + query.setServiceObj(ServiceObjEnums.YUNOBJ.getId());
  668 +
  669 + //健康类型 0健康 1高危
  670 + if (isHightRisk) {//高危孕妇
  671 + query.setHealthType(1);
  672 + }else{//健康
  673 + query.setHealthType(0);
  674 + }
  675 +
  676 + List<SmsTemplateModel> temps = smsTemplateService.querySmsTemplates(query);
  677 +
  678 + Integer serviceType = patient.getServiceType();
  679 + Integer serviceStatus = patient.getServiceStatus();
  680 +
  681 + //根据服务状态和服务类型获取可以发送的模板
  682 + List<SmsTemplateModel> sendList = smsConfigFacade.getSendTemplateByServiceStatus(temps, serviceType, serviceStatus);
  683 +
  684 + if (CollectionUtils.isNotEmpty(temps)) {
  685 + if (CollectionUtils.isNotEmpty(sendList)) {
  686 + //短信前缀
  687 + String messagePrefix = smsConfigFacade.getMsgPrefix(configModel, patient.getLastCheckEmployeeId(), ServiceObjEnums.YUNOBJ.getId());
  688 + for (SmsTemplateModel templateModel : sendList) {
  689 + if (templateModel != null && templateModel.getStatus() == 1) {
  690 +
  691 + //推送类型模板
  692 + if (templateModel.getTemplateType() == null || templateModel.getTemplateType() == 0) {
  693 + //发送推送类模板建档
  694 + if (startType == 3) {
  695 + continue;
  696 + }
  697 + }
  698 + //发送短信类模板建档
  699 + else if (templateModel.getTemplateType() == 1 && startType == 1) {
  700 + continue;
  701 + }
  702 +
  703 + List<MsgRequest> messages = new ArrayList<>();
  704 + MsgRequest mr = new MsgRequest();
  705 + String content = "";
  706 + if(isHightRisk){
  707 + //风险名称
  708 + String riskNmae = queryRiskNameStr(patient.getRiskFactorId());
  709 + content = com.lyms.platform.common.utils.StringUtils.replaceNameRisk(patient.getUsername(), riskNmae, templateModel.getContent());
  710 + }else{
  711 + content = com.lyms.platform.common.utils.StringUtils.replaceName(patient.getUsername(), templateModel.getContent());
  712 + }
  713 +
  714 + mr.setFirst("【" + messagePrefix + "】" + content);
  715 + mr.setObjType(ServiceObjEnums.YUNOBJ.getId());
  716 + mr.setPhone(patient.getPhone());
  717 + mr.setTimeType(SmsTimeTypeEnums.ONTIME.getId());
  718 + mr.setTypeId(ProjectTypeEnums.YNXT.getId());
  719 + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
  720 + mr.setSubTypeId(SmsServiceEnums.FWDGTX.getId());
  721 + mr.setStatus(SmsStatusEnums.WFS.getId());
  722 + mr.setHospitalId(patient.getHospitalId());
  723 + mr.setTempId(templateModel.getId());
  724 + mr.setPatientId(patient.getId());
  725 + mr.setSmsStatus(SmsStatusEnums.WFS.getId());
  726 + mr.setServiceType((templateModel.getTemplateType() == null || templateModel.getTemplateType() == 0) ? 1 : 3); //判断发送类型
  727 + try {
  728 + Users users = usersService.getUsers(Integer.parseInt(patient.getLastCheckEmployeeId()));
  729 + if (users != null && users.getYn() == YnEnums.YES.getId()) {
  730 + mr.setKeyword1(users.getName());
  731 + }
  732 + }
  733 + catch (Exception e)
  734 + {
  735 + System.out.print(e+patient.getLastCheckEmployeeId());
  736 + }
  737 +
  738 + mr.setKeyword2(DateUtil.getymd());
  739 + mr.setRemark("");
  740 + mr.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date()));
  741 +
  742 + mr.setWxTempId(WxTempleteIdEnums.FU_WU_DING_GOU_TX.getId());
  743 + messages.add(mr);
  744 + ExceptionUtils.catchException("patient build msg = " + messages);
  745 + if (CollectionUtils.isNotEmpty(messages)) {
  746 + smsConfigFacade.saveMsg(messages, patient.getHospitalId());
  747 + }
  748 + }
  749 + }
  750 + }
  751 + }
634 752 }
635 753  
  754 +
636 755 /**
  756 + * 初诊数据自动流转
  757 + *
  758 + * @param excAddRequest
  759 + * @param hospitalId
  760 + */
  761 + public void updateChuAutoData(final AntExcAddRequest excAddRequest, final String hospitalId, final Integer userId) {
  762 + commonThreadPool.execute(new Runnable() {
  763 + @Override
  764 + public void run() {
  765 + Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
  766 + try {
  767 + patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
  768 + patientsService.updateNextCheckTime(excAddRequest.getNextCheckTime(), patients.getId());
  769 + patientsService.updatePatient(patients);
  770 + } catch (Exception e) {
  771 + e.printStackTrace();
  772 + }
  773 + try {
  774 + //修改的时候设置最新的高危/冗余筛查结果和下次产检预约时间
  775 + updateLastRisk(patients.getId());
  776 + } catch (Exception e) {
  777 + e.printStackTrace();
  778 + }
  779 + try {
  780 + //修改最后一次定义高危的时间
  781 + updateLastRhTime(patients.getId(), hospitalId);
  782 + } catch (Exception e) {
  783 + e.printStackTrace();
  784 + }
  785 + try {
  786 + // 修改最后一次产检时间
  787 + setLashCTimes(excAddRequest.getParentId());
  788 + } catch (Exception e) {
  789 + e.printStackTrace();
  790 + }
  791 + try {
  792 + /** 把优惠券设置为已使用状态 */
  793 + couponService.use(hospitalId, excAddRequest.getCouponCode(), userId, excAddRequest.getId());
  794 + } catch (Exception e) {
  795 + e.printStackTrace();
  796 + }
  797 + try {
  798 + //冗余到产检表
  799 + antenatalExaminationService.updateAntExRecord(excAddRequest.getId(), 1);
  800 + } catch (Exception e) {
  801 + e.printStackTrace();
  802 + }
  803 + try {
  804 + //修改数据
  805 + syncMaster(excAddRequest.getParentId(), excAddRequest.getNextCheckTime());
  806 + } catch (Exception e) {
  807 + e.printStackTrace();
  808 + }
  809 + try {
  810 + //聊城东昌府医院初诊的身高更新到随心测
  811 + if ("1000000116".equals(hospitalId) || "2100001305".equals(hospitalId)) {
  812 + measureInfoFacade.updateHeight(excAddRequest.getParentId(), hospitalId, excAddRequest.getHeight());
  813 + }
  814 + } catch (Exception e) {
  815 + e.printStackTrace();
  816 + }
  817 + try {
  818 + if (CollectionUtils.isNotEmpty(excAddRequest.getOtherHighRisk())) {
  819 + //处理自定义高危状态为已使用状态
  820 + highRiskFacade.dispHospHighRiskUse(JsonUtil.array2JsonString(excAddRequest.getOtherHighRisk()));
  821 + }
  822 + } catch (Exception e) {
  823 + e.printStackTrace();
  824 + }
  825 + }
  826 + });
  827 + }
  828 +
  829 +
  830 + /**
637 831 * 初诊、复诊添加或更新追访信息
638 832 *
639 833 * @param userId
... ... @@ -921,7 +1115,7 @@
921 1115 break;
922 1116 }
923 1117 highScoreResult.put("screenResult", model.getScreenResult());
924   - if(model.getNextCheckTime()!=null){
  1118 + if (model.getNextCheckTime() != null) {
925 1119 //最后一次预约下次产检时间
926 1120 highScoreResult.put("nextCheckTime", model.getNextCheckTime());
927 1121 }
... ... @@ -945,7 +1139,7 @@
945 1139 }
946 1140 highScoreResult.put("screenResult", antExChuModel.getScreenResult());
947 1141 //最后一次预约下次产检时间
948   - if(antExChuModel.getNextCheckTime()!=null) {
  1142 + if (antExChuModel.getNextCheckTime() != null) {
949 1143 highScoreResult.put("nextCheckTime", antExChuModel.getNextCheckTime());
950 1144 }
951 1145 next = false;
... ... @@ -2401,7 +2595,7 @@
2401 2595 return dataList;
2402 2596 }
2403 2597  
2404   - private List queryRiskName(List l) {
  2598 + private List queryRiskListName(List l) {
2405 2599 List data = new ArrayList();
2406 2600 for (int i = 0; i < l.size(); i++) {
2407 2601 String key = (String) l.get(i);
... ... @@ -2412,6 +2606,23 @@
2412 2606 }
2413 2607 return data;
2414 2608 }
  2609 +
  2610 + private String queryRiskNameStr(List l) {
  2611 + StringBuffer data = new StringBuffer();
  2612 + for (int i = 0; i < l.size(); i++) {
  2613 + String key = (String) l.get(i);
  2614 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(key);
  2615 + if (null != basicConfig) {
  2616 + data.append(basicConfig.getName()+"、");
  2617 + }
  2618 + }
  2619 + if(data.toString().endsWith("、")){
  2620 + return data.toString().substring(0,data.toString().length()-1);
  2621 + }else {
  2622 + return data.toString();
  2623 + }
  2624 + }
  2625 +
2415 2626  
2416 2627 /**
2417 2628 * 根据产前检查id查询