Commit ed6c6c92c04550ba87b6e78453f0d40440187f74

Authored by liquanyu
1 parent 1d35b07ca5

同步

Showing 7 changed files with 156 additions and 11 deletions

platform-dal/src/main/java/com/lyms/platform/query/ResidentsArchiveQuery.java View file @ ed6c6c9
... ... @@ -143,8 +143,12 @@
143 143 private Date checkupTimeEnd;
144 144  
145 145 private Boolean checkupExist;
  146 + //大于修改时间
  147 + private Date gteModified;
  148 + //大于创建时间
  149 + //大于创建时间
  150 + private Date gteCreated;
146 151  
147   -
148 152 @Override
149 153 public MongoQuery convertToQuery() {
150 154 MongoCondition condition = MongoCondition.newInstance();
... ... @@ -314,6 +318,12 @@
314 318 }
315 319 }
316 320  
  321 + if (null != gteModified && null != gteCreated) {
  322 + MongoCondition mongoCondition = new MongoCondition("modified", gteModified, MongoOper.GTE);
  323 + MongoCondition condition2 = new MongoCondition("created", gteCreated, MongoOper.GTE);
  324 + condition = condition.orCondition(new MongoCondition[]{mongoCondition, condition2});
  325 + }
  326 +
317 327 if (StringUtils.isNotBlank(trackHospitalId)) {
318 328 MongoCondition c = MongoCondition.newInstance();
319 329 MongoCondition con1 = MongoCondition.newInstance("trackHospitalId", trackHospitalId, MongoOper.IS);
... ... @@ -352,6 +362,22 @@
352 362  
353 363 //0 或者空不是 1是
354 364 private Integer hasHj;
  365 +
  366 + public Date getGteModified() {
  367 + return gteModified;
  368 + }
  369 +
  370 + public void setGteModified(Date gteModified) {
  371 + this.gteModified = gteModified;
  372 + }
  373 +
  374 + public Date getGteCreated() {
  375 + return gteCreated;
  376 + }
  377 +
  378 + public void setGteCreated(Date gteCreated) {
  379 + this.gteCreated = gteCreated;
  380 + }
355 381  
356 382 public Boolean getCheckupExist() {
357 383 return checkupExist;
platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/ConvertHelper.java View file @ ed6c6c9
... ... @@ -576,6 +576,26 @@
576 576 return localPatient;
577 577 }
578 578  
  579 +
  580 + public static com.lymsh.mommybaby.maindata.model.Patients convertResidents(ResidentsArchiveModel residents) {
  581 + com.lymsh.mommybaby.maindata.model.Patients localPatient = new com.lymsh.mommybaby.maindata.model.Patients();
  582 + localPatient.setCreated(residents.getCreated());
  583 + localPatient.setYn(residents.getYn());
  584 + localPatient.setForeignId(residents.getId());
  585 + localPatient.setUsername(residents.getUsername());
  586 + localPatient.setAge(residents.getAge());
  587 + localPatient.setBirth(residents.getBirthday());
  588 + localPatient.setPhone(residents.getPhone());
  589 + localPatient.setPid(residents.getId());
  590 + localPatient.setLastCheckEmployeeId(residents.getBuildDoctor());
  591 + localPatient.setHospitalForeignId(residents.getHospitalId());
  592 + //妇女
  593 + localPatient.setType(4);
  594 + localPatient.setPublishId(0);
  595 + localPatient.setPublishName(AUTO_WORKER);
  596 + return localPatient;
  597 + }
  598 +
579 599 /**
580 600 * 转换医生用户信息
581 601 *
platform-job-index/src/main/java/com/lyms/platform/job/index/restore/data/SyncDataWork.java View file @ ed6c6c9
... ... @@ -57,6 +57,9 @@
57 57 private YunBookbuildingService yunBookbuildingService;
58 58 @Autowired
59 59 private BasicConfigService basicConfigService;
  60 +
  61 + @Autowired
  62 + private ResidentsArchiveService residentsArchiveService;
60 63 /**
61 64 * 工作线程池
62 65 */
... ... @@ -882,6 +885,9 @@
882 885 handleAntEx(patients, mamiPatient, stopWatch3);
883 886  
884 887 logger.info(stopWatch3.toString());
  888 +
  889 +
  890 + syncResidents(hospitalId);
885 891 } catch (Exception e) {
886 892 ERROR_LOGGER.error("handl patient :" + patients.getId() + ", hospitalId:" + hospitalId, e);
887 893 }
... ... @@ -896,6 +902,45 @@
896 902 ERROR_LOGGER.error("sync worker error.hospitalId:" + hospitalId, e);
897 903 } finally {
898 904 countDownLatch.countDown();
  905 + }
  906 + }
  907 + }
  908 +
  909 + /**
  910 + * 同步妇女档案
  911 + * @param hospitalId
  912 + */
  913 + private void syncResidents(String hospitalId)
  914 + {
  915 + ResidentsArchiveQuery query = new ResidentsArchiveQuery();
  916 + query.setHospitalId(hospitalId);
  917 + query.setYn(YnEnums.YES.getId());
  918 +
  919 + if (-1 != readLastSyncTime()) {
  920 + query.setGteModified(new Date(readLastSyncTime()));
  921 + query.setGteCreated(new Date(readLastSyncTime()));
  922 + }
  923 +
  924 + StopWatch stopWatch2 = new StopWatch("SyncWork-" + hospitalId + "-query residents");
  925 + stopWatch2.start("queryResidentsQuery");
  926 + List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(query);
  927 + stopWatch2.stop();
  928 + logger.info(stopWatch2.toString());
  929 + logger.info("query residents by hospitalId:" + hospitalId + ", list size :" + modelList.size());
  930 +
  931 +
  932 + if (CollectionUtils.isNotEmpty(modelList))
  933 + {
  934 + for (ResidentsArchiveModel model : modelList)
  935 + {
  936 + com.lymsh.mommybaby.maindata.model.Patients mamiPatient = ConvertHelper
  937 + .convertResidents(model);
  938 +
  939 + if (StringUtils.isBlank(mamiPatient.getPhone())) {
  940 + continue;
  941 + }
  942 + //增加建档记录
  943 + patientsService.aouPatients(mamiPatient);
899 944 }
900 945 }
901 946 }
platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/MsgGenerateServiceImpl.java View file @ ed6c6c9
... ... @@ -82,6 +82,9 @@
82 82 @Autowired
83 83 private UsersService usersService;
84 84  
  85 + @Autowired
  86 + private MatDeliverService matDeliverService;
  87 +
85 88 /**
86 89 * 生成孕妇的AMS推送消息
87 90 * @param generateHospitalId 医院id
... ... @@ -234,7 +237,7 @@
234 237 hearingDiagnoseService,
235 238 babyPatientExtendEarFollowUpService,
236 239 patientServiceService,
237   - usersService);
  240 + usersService,matDeliverService);
238 241 pool.execute(worker);
239 242 }
240 243  
platform-msg-generate/src/main/java/com/lyms/platform/msg/utils/HelperUtils.java View file @ ed6c6c9
... ... @@ -290,7 +290,7 @@
290 290 if (serviceType == com.lyms.platform.common.enums.ServiceTypeEnums.ALL_SERVICE.getId()) {
291 291 Integer[] status = null;
292 292 if (serviceStatus == ServiceStatusEnums.ALL_OPEN.getId()) {
293   - status = new Integer[]{ServiceStatusEnums.STANDARD_OPEN.getId(),ServiceStatusEnums.ADD_OPEN.getId()};
  293 + //status = new Integer[]{ServiceStatusEnums.STANDARD_OPEN.getId(),ServiceStatusEnums.ADD_OPEN.getId()};
294 294  
295 295 }
296 296 else if (serviceStatus == ServiceStatusEnums.ALL_NO_OPEN.getId())
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java View file @ ed6c6c9
... ... @@ -2,12 +2,10 @@
2 2  
3 3 import com.lyms.platform.beans.MsgListRequest;
4 4 import com.lyms.platform.beans.MsgRequest;
5   -import com.lyms.platform.biz.service.BabyBookbuildingService;
6   -import com.lyms.platform.biz.service.PostReviewService;
7   -import com.lyms.platform.biz.service.SmsTemplateService;
8   -import com.lyms.platform.biz.service.YunBookbuildingService;
  5 +import com.lyms.platform.biz.service.*;
9 6 import com.lyms.platform.common.enums.*;
10 7 import com.lyms.platform.common.utils.DateUtil;
  8 +import com.lyms.platform.common.utils.JsonUtil;
11 9 import com.lyms.platform.common.utils.StringUtils;
12 10 import com.lyms.platform.msg.service.IBaseService;
13 11 import com.lyms.platform.msg.utils.DateUtils;
14 12  
... ... @@ -16,11 +14,13 @@
16 14 import com.lyms.platform.permission.service.*;
17 15 import com.lyms.platform.pojo.*;
18 16 import com.lyms.platform.query.BabyModelQuery;
  17 +import com.lyms.platform.query.MatDeliverQuery;
19 18 import com.lyms.platform.query.PatientsQuery;
20 19 import com.lyms.platform.query.SmsTemplateQuery;
21 20 import org.apache.commons.collections.CollectionUtils;
22 21 import org.slf4j.Logger;
23 22 import org.slf4j.LoggerFactory;
  23 +import org.springframework.beans.factory.annotation.Autowired;
24 24 import org.springframework.data.domain.Sort;
25 25 import org.springframework.data.mongodb.core.MongoTemplate;
26 26 import org.springframework.data.mongodb.core.query.Criteria;
... ... @@ -63,6 +63,10 @@
63 63  
64 64 private UsersService usersService;
65 65  
  66 +
  67 +
  68 + private MatDeliverService matDeliverService;
  69 +
66 70 public TempleteMsgGenerateWorker(List<SmsConfigModel> configs, IBaseService baseService,
67 71 YunBookbuildingService yunBookbuildingService,
68 72 SmsTemplateService smsTemplateService,
... ... @@ -95,7 +99,8 @@
95 99 BabyPatientExtendEarHearingDiagnoseService hearingDiagnoseService,
96 100 BabyPatientExtendEarFollowUpService babyPatientExtendEarFollowUpService,
97 101 PatientServiceService patientServiceService,
98   - UsersService usersService) {
  102 + UsersService usersService,
  103 + MatDeliverService matDeliverService) {
99 104 this.configs = configs;
100 105 this.baseService = baseService;
101 106 this.yunBookbuildingService = yunBookbuildingService;
... ... @@ -108,6 +113,7 @@
108 113 this.babyPatientExtendEarFollowUpService = babyPatientExtendEarFollowUpService;
109 114 this.patientServiceService = patientServiceService;
110 115 this.usersService = usersService;
  116 + this.matDeliverService = matDeliverService;
111 117 }
112 118  
113 119 @Override
... ... @@ -1695,6 +1701,9 @@
1695 1701 patientsQuery.setYn(YnEnums.YES.getId());
1696 1702 patientsQuery.setHospitalId(tempHid);
1697 1703  
  1704 + patientsQuery.setFmDateStart(DateUtil.addDay(new Date(), 1));
  1705 + patientsQuery.setFmDateEnd(DateUtil.addDay(new Date(),-60));
  1706 +
1698 1707 List buildType = new ArrayList();
1699 1708 buildType.add(0);
1700 1709 buildType.add(2);
... ... @@ -1788,8 +1797,7 @@
1788 1797 && serviceStatus == ServiceStatusEnums.ADD_ALL.getId()){
1789 1798 addPuerperaMessages(template, config, service, tempHid, sendTimeType, patientsQuery, messages, start, end);
1790 1799 } else {
1791   - PatientsQuery query = getPatientsQuery(template, false);
1792   - addPuerperaMessages(template, config, service, tempHid, sendTimeType, query, messages, start, end);
  1800 + addPuerperaMessages(template, config, service, tempHid, sendTimeType, patientsQuery, messages, start, end);
1793 1801 }
1794 1802 }
1795 1803 }
... ... @@ -1831,6 +1839,7 @@
1831 1839 Integer start,
1832 1840 Integer end) {
1833 1841 List<Patients> patientses = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  1842 + System.out.println(patientsQuery.convertToQuery().convertToMongoQuery().toString());
1834 1843 for (Patients pat : patientses) {
1835 1844 if (pat.getDueDate() == null) {
1836 1845 continue;
1837 1846  
... ... @@ -1843,9 +1852,33 @@
1843 1852 if (queryPostOrder(pat.getDueDate(), start, tempHid, sendTimeType, pat.getId())) {
1844 1853 continue;
1845 1854 }
  1855 + String content = template.getContent();
  1856 + if (template.getContent().contains("#剖宫产#") || template.getContent().contains("#顺产#"))
  1857 + {
  1858 + MatDeliverQuery deliverQuery = new MatDeliverQuery();
  1859 + deliverQuery.setPid(pat.getPid());
  1860 + deliverQuery.setCreatedStart(pat.getLastMenses());
  1861 + if (template.getContent().contains("#剖宫产#"))
  1862 + {
  1863 + content = content.replace("#剖宫产#", "");
  1864 + deliverQuery.setDeliveryModeQueryJson("\"fmfs\":\"2\"");
  1865 + }
  1866 + else
  1867 + {
  1868 + content = content.replace("#顺产#", "");
  1869 + deliverQuery.setDeliveryModeQueryJson("\"fmfs\":\"1\"");
  1870 + }
  1871 +
  1872 + List<MaternalDeliverModel> list = matDeliverService.query(deliverQuery);
  1873 + if (CollectionUtils.isEmpty(list))
  1874 + {
  1875 + continue;
  1876 + }
  1877 + }
  1878 +
1846 1879 //短信前缀
1847 1880 String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.CHANOBJ.getId());
1848   - String messageContent = "【" + messagePrefix + "】" + template.getContent();
  1881 + String messageContent = "【" + messagePrefix + "】" + content;
1849 1882 messageContent = HelperUtils.replaceName(pat.getUsername(), messageContent);
1850 1883  
1851 1884 String days = "产后" + HelperUtils.getKeyword(start, end, "天");
platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml View file @ ed6c6c9
... ... @@ -492,6 +492,23 @@
492 492  
493 493  
494 494  
  495 + <!--处理追访预约时间延期-->
  496 + <bean id="handleTrackDownJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
  497 + <!-- 要调用的bean -->
  498 + <property name="targetObject" ref="trackDownFacade"></property>
  499 + <!-- 要调用的Method -->
  500 + <property name="targetMethod" value="handleTrackDown"></property>
  501 + <!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 -->
  502 + <property name="concurrent" value="false"></property>
  503 + </bean>
  504 +
  505 + <bean id="handleTrackDownTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
  506 + <property name="jobDetail" ref="handleTrackDownJob"/>
  507 + <property name="cronExpression" value="0 20 8 * * ? "></property>
  508 + </bean>
  509 +
  510 +
  511 +
495 512 <!-- 总调度,用于启动定时器 -->
496 513 <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
497 514 <property name="triggers" >
... ... @@ -521,6 +538,7 @@
521 538  
522 539 <ref bean="autoGetSieveTrigger" />
523 540 <ref bean="genWeightTrigger" />
  541 + <ref bean="handleTrackDownTrigger" />
524 542  
525 543 <!--陵城孕前优生临床检查自动保存到表
526 544 <ref bean="dzlcTyTrigger" />-->