From 7195e4040040d601c1c8ab240ecae1c9cd4a252f Mon Sep 17 00:00:00 2001 From: liquanyu Date: Fri, 25 Nov 2016 16:42:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/web/controller/TestController.java | 55 ++++++++++++++++++++++ .../platform/operate/web/facade/PatientFacade.java | 5 -- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java index 171c45f..c5e8d4d 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java @@ -2,6 +2,7 @@ package com.lyms.platform.operate.web.controller; import com.lyms.hospitalapi.qhdfy.QhdfyHisService; import com.lyms.platform.biz.JdbcUtil; +import com.lyms.platform.biz.service.AntenatalExaminationService; import com.lyms.platform.biz.service.AssayConfigService; import com.lyms.platform.biz.service.PatientsService; import com.lyms.platform.biz.service.SieveService; @@ -10,12 +11,17 @@ import com.lyms.platform.common.utils.DateUtil; import com.lyms.platform.common.utils.JsonUtil; import com.lyms.platform.operate.web.service.SyncDataTaskService; import com.lyms.platform.permission.service.OrganizationService; +import com.lyms.platform.pojo.AntExChuModel; +import com.lyms.platform.pojo.AntenatalExaminationModel; import com.lyms.platform.pojo.AssayConfig; import com.lyms.platform.pojo.Patients; +import com.lyms.platform.query.AntExChuQuery; +import com.lyms.platform.query.AntExQuery; import com.lyms.platform.query.PatientsQuery; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -53,6 +59,9 @@ public class TestController { @Autowired private OrganizationService organizationService; + @Autowired + private AntenatalExaminationService antenatalExaminationService; + /** * 获取科室 */ @@ -287,4 +296,50 @@ public class TestController { return "sieveOrder finish"; } + + @RequestMapping(value = "/syncPatNextTime", method = RequestMethod.GET) + @ResponseBody + public String syncPatNextTime() { + PatientsQuery patientQuery = new PatientsQuery(); + patientQuery.setYn(YnEnums.YES.getId()); + patientQuery.setHospitalId("221"); + patientQuery.setType(1); + List patientses = patientsService.queryPatient(patientQuery); + if (CollectionUtils.isNotEmpty(patientses)) + { + for (Patients pat : patientses) { + AntExChuQuery antExChuQuery = new AntExChuQuery(); + antExChuQuery.setYn(YnEnums.YES.getId()); + antExChuQuery.setHospitalId(pat.getHospitalId()); + antExChuQuery.setParentId(pat.getId()); + List chus = antenatalExaminationService.queryAntExChu(antExChuQuery); + if (CollectionUtils.isNotEmpty(chus)) { + Date nextTime = null; + AntExChuModel chu = chus.get(0); + if (chu != null) + { + nextTime = chu.getNextCheckTime(); + + AntExQuery antExQuery = new AntExQuery(); + antExQuery.setParentId(pat.getId()); + antExQuery.setYn(YnEnums.YES.getId()); + antExQuery.setHospitalId(pat.getHospitalId()); + List list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); + if (CollectionUtils.isNotEmpty(list)) + { + AntenatalExaminationModel ae = list.get(0); + if (ae != null) + { + nextTime = ae.getNextCheckTime(); + } + } + patientsService.updatePatientOneCol(pat.getId(), "nextCheckTime", nextTime); + } + + } + } + } + return "syncPatNextTime finish"; + } + } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java index 6f7c927..89a1136 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java @@ -16,24 +16,19 @@ import com.lyms.platform.operate.web.worker.QuanPatientWorker; import com.lyms.platform.operate.web.worker.WorkHR; import com.lyms.platform.permission.model.Organization; import com.lyms.platform.permission.model.OrganizationQuery; -import com.lyms.platform.permission.model.Users; import com.lyms.platform.permission.service.OrganizationService; import com.lyms.platform.permission.service.UsersService; import com.lyms.platform.pojo.*; import com.lyms.platform.query.*; -import com.sun.javafx.collections.MappingChange; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Sort; import org.springframework.stereotype.Component; import org.springframework.util.StopWatch; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.io.OutputStream; import java.util.*; import java.util.concurrent.*; -- 1.8.3.1