Commit ea6562a5fdd699d6c2c513890caea4820136fa36
1 parent
b9cd9b392b
Exists in
luanping
and in
1 other branch
#新增南和服务开通同步功能
Showing 8 changed files with 166 additions and 7 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/PatientServiceMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/PatientServiceService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/PatientServiceServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/PatientService.xml
- platform-msg-generate/src/main/java/com/lyms/platform/msg/utils/DateUtils.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
- platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/PatientServiceMapper.java
View file @
ea6562a
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | |
12 | 12 | public interface PatientServiceMapper { |
13 | 13 | public void addPatientService(PatientService obj); |
14 | + void addPatientServiceAll(@Param("serviceList") List<PatientService> serviceList); | |
14 | 15 | |
15 | 16 | public void updatePatientService(PatientService obj); |
16 | 17 | |
... | ... | @@ -30,6 +31,8 @@ |
30 | 31 | */ |
31 | 32 | List<Map> selectOnlyBzService(PatientServiceQuery query); |
32 | 33 | |
34 | + | |
35 | + List<Map<String,String>> selectServiceByHospital(@Param("hospitalId") String hospitalId); | |
33 | 36 | |
34 | 37 | int selectOnlyBzServiceCount(PatientServiceQuery query); |
35 | 38 |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/PatientServiceService.java
View file @
ea6562a
... | ... | @@ -3,13 +3,14 @@ |
3 | 3 | import com.lyms.platform.permission.model.PatientService; |
4 | 4 | import com.lyms.platform.permission.model.PatientServiceQuery; |
5 | 5 | import com.lyms.platform.permission.model.ServiceListQuery; |
6 | +import org.apache.ibatis.annotations.Param; | |
6 | 7 | |
7 | 8 | import java.util.List; |
8 | 9 | import java.util.Map; |
9 | 10 | |
10 | 11 | public interface PatientServiceService { |
11 | 12 | public void addPatientService(PatientService obj); |
12 | - | |
13 | + void addPatientServiceAll(List<PatientService> serviceList); | |
13 | 14 | public void updatePatientService(PatientService obj); |
14 | 15 | |
15 | 16 | public void deletePatientService(String id); |
... | ... | @@ -32,7 +33,7 @@ |
32 | 33 | List<Map<String, Object>> getServeDetailList(ServiceListQuery param); |
33 | 34 | |
34 | 35 | List<String> getHospitalIds(ServiceListQuery param, List<String> ids); |
35 | - | |
36 | + List<Map<String,String>> selectServiceByHospital(@Param("hospitalId") String hospitalId); | |
36 | 37 | /** |
37 | 38 | * 查询病人服务list |
38 | 39 | * |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/PatientServiceServiceImpl.java
View file @
ea6562a
... | ... | @@ -7,11 +7,13 @@ |
7 | 7 | import com.lyms.platform.permission.service.PatientServiceService; |
8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
9 | 9 | import org.springframework.stereotype.Service; |
10 | +import org.springframework.transaction.annotation.Transactional; | |
10 | 11 | |
11 | 12 | import java.util.List; |
12 | 13 | import java.util.Map; |
13 | 14 | |
14 | 15 | @Service |
16 | +@Transactional | |
15 | 17 | public class PatientServiceServiceImpl implements PatientServiceService { |
16 | 18 | |
17 | 19 | @Autowired |
... | ... | @@ -23,6 +25,11 @@ |
23 | 25 | } |
24 | 26 | |
25 | 27 | @Override |
28 | + public void addPatientServiceAll(List<PatientService> serviceList) { | |
29 | + patientServiceMapper.addPatientServiceAll(serviceList); | |
30 | + } | |
31 | + | |
32 | + @Override | |
26 | 33 | public void updatePatientService(PatientService obj) { |
27 | 34 | patientServiceMapper.updatePatientService(obj); |
28 | 35 | } |
... | ... | @@ -84,6 +91,11 @@ |
84 | 91 | @Override |
85 | 92 | public List<String> getHospitalIds(ServiceListQuery param, List<String> hospitalIds) { |
86 | 93 | return patientServiceMapper.getHospitalIds(param, hospitalIds); |
94 | + } | |
95 | + | |
96 | + @Override | |
97 | + public List<Map<String, String>> selectServiceByHospital(String hospitalId) { | |
98 | + return patientServiceMapper.selectServiceByHospital(hospitalId); | |
87 | 99 | } |
88 | 100 | |
89 | 101 | /** |
platform-biz-service/src/main/resources/mainOrm/master/PatientService.xml
View file @
ea6562a
... | ... | @@ -54,6 +54,20 @@ |
54 | 54 | ) |
55 | 55 | </insert> |
56 | 56 | |
57 | + <insert id="addPatientServiceAll" parameterType="java.util.List"> | |
58 | + INSERT INTO patient_service | |
59 | + (id,parentid,pid,ser_type,ser_doct,create_date,create_user_name,create_user,ser_status, | |
60 | + update_date,update_user_name,update_user,hospital_id,ser_code,status,receive_date,receive_user,back_date,back_user,order_id,syn_status,is_old,per_type | |
61 | + ,device,deviceCon,doctorWeek,serviceWeek,serStartWeek,serEndWeek,serStartTime,serEndTime,docStartWeek,docEndWeek,docStartTime,docEndTime | |
62 | + ) | |
63 | + VALUES | |
64 | + <foreach collection ="serviceList" item="patientService" separator =","> | |
65 | + (#{patientService.id},#{patientService.parentid},#{patientService.pid},#{patientService.serType},#{patientService.serDoct},#{patientService.createDate},#{patientService.createUserName},#{patientService.createUser},#{patientService.serStatus},#{patientService.updateDate}, | |
66 | + #{patientService.updateUserName},#{patientService.updateUser},#{patientService.hospitalId},#{patientService.serCode},#{patientService.status},#{patientService.receiveDate},#{patientService.receiveUser},#{patientService.backDate},#{patientService.backUser},#{patientService.orderId},#{patientService.synStatus},#{patientService.isOld},#{patientService.perType} | |
67 | + ,#{patientService.device},#{patientService.deviceCon},#{patientService.doctorWeek},#{patientService.serviceWeek},#{patientService.serStartWeek},#{patientService.serEndWeek},#{patientService.serStartTime},#{patientService.serEndTime},#{patientService.docStartWeek},#{patientService.docEndWeek},#{patientService.docStartTime},#{patientService.docEndTime} | |
68 | + ) | |
69 | + </foreach > | |
70 | + </insert> | |
57 | 71 | |
58 | 72 | <update id="updatePatientService" parameterType="com.lyms.platform.permission.model.PatientService"> |
59 | 73 | update patient_service |
... | ... | @@ -350,6 +364,16 @@ |
350 | 364 | from patient_service |
351 | 365 | <include refid="PatientServiceCondition"/> |
352 | 366 | <include refid="orderAndLimit"/> |
367 | + </select> | |
368 | + | |
369 | + <select id="selectServiceByHospital" resultType="java.util.HashMap"> | |
370 | + SELECT | |
371 | + hso.ser_type as serType,hds.doct_id as doctId | |
372 | +FROM | |
373 | + `hospital_service_content` hso | |
374 | +INNER JOIN hospital_doct_service hds | |
375 | +on hso.id=hds.hosp_service_id | |
376 | +where hso.hospital_id=#{hospitalId} and hso.ser_type in (3,4,6) | |
353 | 377 | </select> |
354 | 378 | |
355 | 379 | <!--查询只开通了标准服务的数据 --> |
platform-msg-generate/src/main/java/com/lyms/platform/msg/utils/DateUtils.java
View file @
ea6562a
... | ... | @@ -232,8 +232,12 @@ |
232 | 232 | return Math.abs(result); |
233 | 233 | } |
234 | 234 | public static void main(String[] args) { |
235 | - System.out.println(DateUtil.getyyyy_MM_dd(DateUtil.addDay(new Date(),33))); | |
236 | - System.out.println(DateUtil.daysBetween(DateUtil.addDay(DateUtil.addDay(new Date(),33),-33),new Date())); | |
235 | + /*Date startDate = DateUtils.getNewDate(new Date(), -18, "周", 1 + 1); | |
236 | + Date endDate = DateUtils.getNewDate(new Date(), -13, "周", 1); | |
237 | + System.out.println(DateUtils.getDateStr(DateUtils.formatDate(startDate, DateUtils.Y_M_D),DateUtils.Y_M_D)); | |
238 | + System.out.println(DateUtils.getDateStr(DateUtils.formatDate(endDate, DateUtils.Y_M_D),DateUtils.Y_M_D));*/ | |
239 | + | |
240 | + System.out.println(DateUtils.getNewDate(DateUtils.preaseDate("2023-09-26 8:00:00",DateUtils.Y_M_D_H_M_S),13, "周", -1)); | |
237 | 241 | } |
238 | 242 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
View file @
ea6562a
... | ... | @@ -24,6 +24,8 @@ |
24 | 24 | import com.lyms.platform.query.TServiceTimeRecordQuery; |
25 | 25 | import net.sf.json.JSONObject; |
26 | 26 | import org.apache.commons.collections.CollectionUtils; |
27 | +import org.slf4j.Logger; | |
28 | +import org.slf4j.LoggerFactory; | |
27 | 29 | import org.springframework.beans.factory.annotation.Autowired; |
28 | 30 | import org.springframework.stereotype.Component; |
29 | 31 | |
... | ... | @@ -81,7 +83,7 @@ |
81 | 83 | |
82 | 84 | @Autowired |
83 | 85 | private AreaCountFacade areaCountFacade; |
84 | - | |
86 | + private static Logger logger = LoggerFactory.getLogger(PatientServiceFacade.class); | |
85 | 87 | public BaseResponse babyServiceInit(Integer userId) { |
86 | 88 | Map map = new HashMap(); |
87 | 89 | //服务类型 |
... | ... | @@ -292,6 +294,105 @@ |
292 | 294 | baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
293 | 295 | baseResponse.setErrormsg("成功"); |
294 | 296 | return baseResponse; |
297 | + } | |
298 | + | |
299 | + /** | |
300 | + * 威县开通服务同步任务 | |
301 | + * 只同步 6围产小助理/3血糖管理服务/4血压管理服务 | |
302 | + */ | |
303 | + public void patientServiceSync(){ | |
304 | + logger.info("patientServiceSync start"); | |
305 | + String hospitalId="2100002421"; | |
306 | + List<Map<String, String>> mapList= patientServiceService.selectServiceByHospital(hospitalId); | |
307 | + if (CollectionUtils.isNotEmpty(mapList)){ | |
308 | + PatientsQuery patientsQuery=new PatientsQuery(); | |
309 | + patientsQuery.setHospitalId(hospitalId); | |
310 | + patientsQuery.setExtEnable(false); | |
311 | + patientsQuery.setBuildTypeNot(1); | |
312 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
313 | + List<Patients> patientsList= patientsService.queryPatient(patientsQuery); | |
314 | + if (CollectionUtils.isNotEmpty(patientsList)){ | |
315 | + List<PatientService> serviceList=new ArrayList<>(); | |
316 | + for (int i = 0,j=mapList.size(); i < j; i++) { | |
317 | + Map<String,String> params= mapList.get(i); | |
318 | + Integer serType= Integer.parseInt(params.get("serType")); | |
319 | + String createUser=params.get("doctId"); | |
320 | + for (int k = 0,f=patientsList.size(); k < f; k++) { | |
321 | + Patients patients= patientsList.get(k); | |
322 | + String parentId= patients.getId(); | |
323 | + //先根据孕妇id和开通服务类型、开通医生进行查询,如果已经开通过则开通失败 | |
324 | + PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
325 | + patientQuery.setParentid(parentId); | |
326 | + patientQuery.setSerType(serType); | |
327 | + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); | |
328 | + if (CollectionUtils.isNotEmpty(patientServices)) { | |
329 | + continue; | |
330 | + } | |
331 | + PatientService pser = new PatientService(); | |
332 | + pser.setCreateUser(createUser); | |
333 | + pser.setCreateDate(patients.getCreated()); | |
334 | + //设置服务对象类型 服务人类型(1-孕妇、2-儿童) | |
335 | + pser.setPerType(1); | |
336 | + pser.setPid(patients.getPid()); | |
337 | + //如果有数据源id,取主档案id | |
338 | + if (StringUtils.isNotEmpty(patients.getSource())) { | |
339 | + pser.setParentid(patients.getSource()); | |
340 | + }else { | |
341 | + pser.setParentid(parentId); | |
342 | + } | |
343 | + pser.setId(UUID.randomUUID().toString().replace("-", "")); | |
344 | + //开通医院 | |
345 | + pser.setHospitalId(hospitalId); | |
346 | + //默认开通状态 | |
347 | + pser.setSerStatus(PatientSerEnums.SerStatusEnums.kt.getId()); | |
348 | + //服务类型 | |
349 | + pser.setSerType(serType); | |
350 | + //默认已经领取 | |
351 | + pser.setStatus(2); | |
352 | + //默认待同步 | |
353 | + pser.setSynStatus(1); | |
354 | + //领取时间 | |
355 | + pser.setReceiveDate(new Date()); | |
356 | + //领取操作医生id | |
357 | + pser.setReceiveUser(createUser); | |
358 | + //服务开通操作时间 | |
359 | + pser.setUpdateDate(new Date()); | |
360 | + //服务开通操作人 | |
361 | + pser.setUpdateUser(createUser); | |
362 | + //默认是全孕周42 | |
363 | + pser.setDoctorWeek(42); | |
364 | + pser.setServiceWeek(42); | |
365 | + | |
366 | + setServiceRecordAdd(pser, patients); | |
367 | + | |
368 | + serviceList.add(pser); | |
369 | + | |
370 | + operateLogFacade.addAddOptLog(Integer.valueOf(createUser), Integer.valueOf(hospitalId), pser, OptActionEnums.ADD.getId(), "开通增值服务"); | |
371 | + | |
372 | + | |
373 | + if (PatientSerEnums.SerTypeEnums.bzfw.getId().intValue() == serType) { | |
374 | + PatientServiceQuery query = new PatientServiceQuery(); | |
375 | + query.setParentid(parentId); | |
376 | + query.setSerType(PatientSerEnums.SerTypeEnums.yqjzzd.getId()); | |
377 | + int count = patientServiceService.queryPatientServiceCount(query); | |
378 | + //是否有增值服务--没有则处理标准服务 | |
379 | + if (count == 0) { | |
380 | + Patients patient = new Patients(); | |
381 | + patient.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); | |
382 | + patient.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); | |
383 | + bookbuildingFacade.updatePatientSerById(parentId, patient); | |
384 | + } | |
385 | + } | |
386 | + } | |
387 | + } | |
388 | + if (CollectionUtils.isNotEmpty(serviceList)){ | |
389 | + logger.info("addPatientServiceAll start"); | |
390 | + patientServiceService.addPatientServiceAll(serviceList); | |
391 | + } | |
392 | + logger.info("addPatientServiceAll end"); | |
393 | + } | |
394 | + } | |
395 | + logger.info("patientServiceSync end"); | |
295 | 396 | } |
296 | 397 | |
297 | 398 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
View file @
ea6562a
... | ... | @@ -13,7 +13,6 @@ |
13 | 13 | import com.lyms.platform.pojo.*; |
14 | 14 | import com.lyms.platform.query.*; |
15 | 15 | |
16 | -import com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException; | |
17 | 16 | import org.apache.commons.codec.binary.*; |
18 | 17 | import org.apache.commons.codec.binary.Base64; |
19 | 18 | import org.apache.commons.collections.CollectionUtils; |
platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml
View file @
ea6562a
... | ... | @@ -651,11 +651,24 @@ |
651 | 651 | <!-- 配置一个触发器 0 0 19 * * ?--> |
652 | 652 | <bean id="coursesTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> |
653 | 653 | <property name="jobDetail" ref="coursesWork"></property> |
654 | - <property name="cronExpression" value="0 0 19 * * ?"></property> | |
654 | + <property name="cronExpression" value="0 5 15 * * ?"></property> | |
655 | 655 | </bean> |
656 | 656 | |
657 | 657 | |
658 | + <!-- 威县开通服务同步任务--> | |
659 | + <bean id="patientServiceSyncJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> | |
660 | + <!-- 要调用的bean --> | |
661 | + <property name="targetObject" ref="patientServiceFacade"/> | |
662 | + <!-- 要调用的Method --> | |
663 | + <property name="targetMethod" value="patientServiceSync"/> | |
664 | + <!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 --> | |
665 | + <property name="concurrent" value="false"/> | |
666 | + </bean> | |
658 | 667 | |
668 | + <bean id="patientServiceSyncJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> | |
669 | + <property name="jobDetail" ref="patientServiceSyncJob"/> | |
670 | + <property name="cronExpression" value="0 0 18 * * ?"/> | |
671 | + </bean> | |
659 | 672 | |
660 | 673 | |
661 | 674 | <!-- 总调度,用于启动定时器 --> |
... | ... | @@ -721,6 +734,8 @@ |
721 | 734 | <ref bean="babyBuildClassifyTrigger"/> |
722 | 735 | <!-- 南和课程发布19点推送--> |
723 | 736 | <ref bean="coursesTrigger"/> |
737 | + <!-- 威县开通服务同步--> | |
738 | + <ref bean="patientServiceSyncJobTrigger"/> | |
724 | 739 | </list> |
725 | 740 | </property> |
726 | 741 | </bean> |