Commit 4fd45372f5e26681965ee7cec569945ad875db7e

Authored by liquanyu
1 parent e3ba4db96a
Exists in master and in 1 other branch dev

服务

Showing 6 changed files with 75 additions and 1 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/TServiceTimeRecordMapper.java View file @ 4fd4537
... ... @@ -8,8 +8,10 @@
8 8 import java.util.List;
9 9  
10 10 public interface TServiceTimeRecordMapper {
11   -
  11 + void updateServiceTimeRecord(TServiceTimeRecord record);
12 12 void addServiceTimeRecord(TServiceTimeRecord record);
13 13 List<TServiceTimeRecord> selectServiceTimeRecords(TServiceTimeRecordQuery query);
  14 +
  15 + List<TServiceTimeRecord> queryServiceTimeRecordsEnd(TServiceTimeRecordQuery query);
14 16 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/TServiceTimeRecordService.java View file @ 4fd4537
... ... @@ -9,5 +9,8 @@
9 9 public interface TServiceTimeRecordService {
10 10 void addServiceTimeRecord(TServiceTimeRecord record);
11 11 List<TServiceTimeRecord> selectServiceTimeRecords(TServiceTimeRecordQuery query);
  12 + public void updateServiceTimeRecord(TServiceTimeRecord record);
  13 + List<TServiceTimeRecord> queryServiceTimeRecordsEnd(TServiceTimeRecordQuery query);
  14 +
12 15 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/TServiceTimeRecordServiceImpl.java View file @ 4fd4537
... ... @@ -26,5 +26,15 @@
26 26 public List<TServiceTimeRecord> selectServiceTimeRecords(TServiceTimeRecordQuery query) {
27 27 return tserviceTimeRecordMapper.selectServiceTimeRecords(query);
28 28 }
  29 +
  30 + @Override
  31 + public void updateServiceTimeRecord(TServiceTimeRecord record) {
  32 + tserviceTimeRecordMapper.updateServiceTimeRecord(record);
  33 + }
  34 +
  35 + @Override
  36 + public List<TServiceTimeRecord> queryServiceTimeRecordsEnd(TServiceTimeRecordQuery query) {
  37 + return tserviceTimeRecordMapper.queryServiceTimeRecordsEnd(query);
  38 + }
29 39 }
platform-biz-service/src/main/resources/mainOrm/master/TServiceTimeRecord.xml View file @ 4fd4537
... ... @@ -18,6 +18,15 @@
18 18 <include refid="orderAndLimit"/>
19 19 </select>
20 20  
  21 + <select id="queryServiceTimeRecordsEnd" parameterType="com.lymsh.mommybaby.maindata.model.TServiceTimeRecordQuery"
  22 + resultType="com.lymsh.mommybaby.maindata.model.TServiceTimeRecord">
  23 + SELECT s.id,s.serviceId,s.createTime,s.updateTime,s.startTime,s.endTime,s.type
  24 + ,s.weekStart,s.weekEnd,s.remark,s.patientId,s.memberId,s.foreignId from t_service_time_record s
  25 + INNER JOIN t_patient_service_record t on t.id= s.serviceId where t.service_status=1 and t.ser_type=1 and s.endType=0
  26 + <if test="endTime != null">
  27 + <![CDATA[ and s.endTime <= #{endTime,jdbcType=TIMESTAMP} ]]>
  28 + </if>
  29 + </select>
21 30  
22 31 <sql id="TServiceTimeRecordCondition">
23 32 <where>
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java View file @ 4fd4537
... ... @@ -995,6 +995,38 @@
995 995 return map;
996 996 }
997 997  
  998 + public void doServiceEndExcute()
  999 + {
  1000 + TServiceTimeRecordQuery stquery = new TServiceTimeRecordQuery();
  1001 + stquery.setEndTime(new Date());
  1002 + List<TServiceTimeRecord> tsList = serviceTimeRecordService.queryServiceTimeRecordsEnd(stquery);
  1003 + if (CollectionUtils.isNotEmpty(tsList)) {
  1004 + for (TServiceTimeRecord st : tsList)
  1005 + {
  1006 + st.setEndType(1);
  1007 + serviceTimeRecordService.updateServiceTimeRecord(st);
  1008 +
  1009 + PatientServiceQuery patientQuery = new PatientServiceQuery();
  1010 + patientQuery.setSerType(1);
  1011 + patientQuery.setParentid(st.getForeignId());
  1012 + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery);
  1013 + if (CollectionUtils.isNotEmpty(patientServices))
  1014 + {
  1015 + for (PatientService service : patientServices)
  1016 + {
  1017 + service.setSerType(1);
  1018 + service.setSerStatus(3);
  1019 + patientServiceService.updatePatientService(service);
  1020 + }
  1021 + }
  1022 +
  1023 + Patients patients = patientsService.findOnePatientById(st.getForeignId());
  1024 + patients.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId());
  1025 + patients.setServiceStatus(ServiceStatusEnums.ADD_OVERDUE.getId());
  1026 + patientsService.updatePatient(patients);
  1027 + }
  1028 + }
  1029 + }
998 1030  
999 1031 }
platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml View file @ 4fd4537
... ... @@ -315,6 +315,23 @@
315 315 </bean>
316 316  
317 317  
  318 + <!-- 服务结束任务-->
  319 + <bean id="patientSerivceEndJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
  320 + <!-- 要调用的bean -->
  321 + <property name="targetObject" ref="patientServiceFacade"/>
  322 + <!-- 要调用的Method -->
  323 + <property name="targetMethod" value="doServiceEndExcute"/>
  324 + <!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 -->
  325 + <property name="concurrent" value="false"/>
  326 + </bean>
  327 +
  328 + <bean id="patientSerivceEndJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
  329 + <property name="jobDetail" ref="patientSerivceEndJob"/>
  330 + <property name="cronExpression" value="0 0/2 * * * ?"/>
  331 + </bean>
  332 +
  333 +
  334 +
318 335 <!-- 总调度,用于启动定时器 -->
319 336 <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
320 337 <property name="triggers" >
... ... @@ -346,6 +363,7 @@
346 363 <!--<ref bean="qhdFmHistoryTrigger"/>-->
347 364  
348 365 <!--<ref bean="zcChanJianTrigger"/>-->
  366 + <ref bean="patientSerivceEndJobTrigger"/>
349 367 </list>
350 368 </property>
351 369 </bean>