Commit 1392e76274cecd13337f0737a4192bbc85bea7ee

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 10 changed files

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java View file @ 1392e76
... ... @@ -30,5 +30,7 @@
30 30 void updatePatientByPid(Patients patientUpdate, String pid);
31 31  
32 32 void findAndModify(MongoQuery query,Patients obj);
  33 +
  34 + void updatePatientOneCol(String id, String colName, Object colValue);
33 35 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java View file @ 1392e76
... ... @@ -7,6 +7,7 @@
7 7 import com.lyms.platform.common.dao.operator.MongoQuery;
8 8 import com.lyms.platform.common.dao.operator.Page;
9 9 import com.lyms.platform.pojo.AntenatalExaminationModel;
  10 +import com.lyms.platform.pojo.BabyModel;
10 11 import com.lyms.platform.pojo.Patients;
11 12 import org.bson.types.ObjectId;
12 13 import org.springframework.data.mongodb.core.aggregation.Aggregation;
... ... @@ -15,6 +16,7 @@
15 16 import org.springframework.data.mongodb.core.aggregation.Field;
16 17 import org.springframework.data.mongodb.core.query.Criteria;
17 18 import org.springframework.data.mongodb.core.query.Query;
  19 +import org.springframework.data.mongodb.core.query.Update;
18 20 import org.springframework.stereotype.Repository;
19 21  
20 22 import java.util.List;
... ... @@ -34,6 +36,12 @@
34 36 public void findAndModify(MongoQuery query,Patients obj){
35 37 updateMulti(query.convertToMongoQuery(),obj);
36 38 }
  39 +
  40 + @Override
  41 + public void updatePatientOneCol(String id, String colName, Object colValue) {
  42 + this.mongoTemplate.updateFirst(new Query(Criteria.where("id").is(id)), Update.update(colName, colValue), Patients.class);
  43 + }
  44 +
37 45 @Override
38 46 public void updatePatient(Patients obj, String id) {
39 47 update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj);
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java View file @ 1392e76
... ... @@ -101,6 +101,11 @@
101 101 return iPatientDao.getPatient(id);
102 102 }
103 103  
  104 + public void updatePatientOneCol(String id,String colName,Object colValue)
  105 + {
  106 + iPatientDao.updatePatientOneCol(id,colName,colValue);
  107 + }
  108 +
104 109 /**
105 110 * 满足孕15+3至20+6之间和有产筛申请单的数据
106 111 */
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java View file @ 1392e76
... ... @@ -794,11 +794,11 @@
794 794 // Date startDate = getRangeDate(parseYMD("2016-09-07"),2,"周",-1);
795 795 // System.out.println(getyyyy_MM_dd(startDate));
796 796  
797   -// int a = daysBetween(parseYMD("2013-09-13"),new Date())/7;
798   -// System.out.println(a);
  797 + int a = daysBetween(parseYMD("2016-10-01"),new Date())/7;
  798 + System.out.println(a);
799 799  
800   - Date dueDate = DateUtil.addDay(DateUtil.addMonth(parseYMD("2016-02-08"), 9), 7);
801   - System.out.println(getyyyy_MM_dd(dueDate));
  800 +// Date dueDate = DateUtil.addDay(DateUtil.addMonth(parseYMD("2016-02-08"), 9), 7);
  801 +// System.out.println(getyyyy_MM_dd(dueDate));
802 802 } catch (Exception e)
803 803 {
804 804  
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ 1392e76
... ... @@ -153,6 +153,17 @@
153 153 this.hospitalList = hospitalList;
154 154 }
155 155  
  156 + //查询号
  157 + private String queryNo;
  158 +
  159 + public String getQueryNo() {
  160 + return queryNo;
  161 + }
  162 +
  163 + public void setQueryNo(String queryNo) {
  164 + this.queryNo = queryNo;
  165 + }
  166 +
156 167 public Integer getPostViewTimes() {
157 168 return postViewTimes;
158 169 }
... ... @@ -301,6 +312,8 @@
301 312  
302 313 private Date fmDateStart;
303 314 private Date fmDateEnd;
  315 + private Date nextCheckTimeStart;
  316 + private Date nextCheckTimeEnd;
304 317  
305 318 //大于修改时间
306 319 private Date gteModified;
307 320  
... ... @@ -308,7 +321,45 @@
308 321 //大于创建时间
309 322 private Date gteCreated;
310 323  
  324 + //最后一次产检医生职工ID
  325 + private String lastCheckEmployeeId;
311 326  
  327 + //建档医生
  328 + private String bookbuildingDoctor;
  329 +
  330 +
  331 + public String getLastCheckEmployeeId() {
  332 + return lastCheckEmployeeId;
  333 + }
  334 +
  335 + public void setLastCheckEmployeeId(String lastCheckEmployeeId) {
  336 + this.lastCheckEmployeeId = lastCheckEmployeeId;
  337 + }
  338 +
  339 + public String getBookbuildingDoctor() {
  340 + return bookbuildingDoctor;
  341 + }
  342 +
  343 + public void setBookbuildingDoctor(String bookbuildingDoctor) {
  344 + this.bookbuildingDoctor = bookbuildingDoctor;
  345 + }
  346 +
  347 + public Date getNextCheckTimeStart() {
  348 + return nextCheckTimeStart;
  349 + }
  350 +
  351 + public void setNextCheckTimeStart(Date nextCheckTimeStart) {
  352 + this.nextCheckTimeStart = nextCheckTimeStart;
  353 + }
  354 +
  355 + public Date getNextCheckTimeEnd() {
  356 + return nextCheckTimeEnd;
  357 + }
  358 +
  359 + public void setNextCheckTimeEnd(Date nextCheckTimeEnd) {
  360 + this.nextCheckTimeEnd = nextCheckTimeEnd;
  361 + }
  362 +
312 363 public Date getLastCTimeStart() {
313 364 return lastCTimeStart;
314 365 }
... ... @@ -633,6 +684,7 @@
633 684  
634 685 public MongoQuery convertToQuery() {
635 686 MongoCondition condition = MongoCondition.newInstance();
  687 +
636 688 if (null != keyword) {
637 689 MongoCondition con1 = MongoCondition.newInstance("phone", "^" + keyword, MongoOper.LIKE);
638 690 MongoCondition con = MongoCondition.newInstance("username", "^" + keyword, MongoOper.LIKE);
639 691  
640 692  
... ... @@ -656,15 +708,19 @@
656 708 } else if (null != buildTypeList) {
657 709 MongoCondition mongoCondition = MongoCondition.newInstance("buildType", 3, MongoOper.IS);
658 710 MongoCondition condition1 = mongoCondition.and("enable", "1", MongoOper.IS);
659   -
660 711 MongoCondition condition2 = MongoCondition.newInstance("buildType", buildTypeList, MongoOper.IN);
661   -
662 712 condition = condition.orCondition(new MongoCondition[]{condition1, condition2});
663 713 }
664 714  
665 715 if (buildTypeEq != null) {
666 716 condition = condition.and("buildType", buildTypeEq, MongoOper.IS);
667 717 }
  718 + if (lastCheckEmployeeId != null) {
  719 + condition = condition.and("lastCheckEmployeeId", lastCheckEmployeeId, MongoOper.IS);
  720 + }
  721 + if (bookbuildingDoctor != null) {
  722 + condition = condition.and("bookbuildingDoctor", bookbuildingDoctor, MongoOper.IS);
  723 + }
668 724 if (visitstatus != -1) {
669 725 condition = condition.and("isVisit", visitstatus, MongoOper.IS);
670 726 }
... ... @@ -742,6 +798,14 @@
742 798 condition = condition.and("pid", pid, MongoOper.IS);
743 799 }
744 800 Criteria c1 = null;
  801 + if (null != queryNo) {
  802 + MongoCondition c = MongoCondition.newInstance();
  803 + MongoCondition con1 = MongoCondition.newInstance("phone", queryNo, MongoOper.IS);
  804 + MongoCondition con2 = MongoCondition.newInstance("username", queryNo, MongoOper.IS);
  805 + MongoCondition con3 = MongoCondition.newInstance("cardNo", queryNo, MongoOper.IS);
  806 + c1= c.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria();
  807 + }
  808 +
745 809 if (fmDateStart != null && fmDateEnd != null) {
746 810 c1 = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd);
747 811 }
... ... @@ -807,6 +871,24 @@
807 871 c1 = Criteria.where("lastRhTime").lte(lastRhTimeEnd);
808 872 }
809 873 }
  874 +
  875 + if (null != nextCheckTimeStart) {
  876 + if (null != c1) {
  877 + c1 = c1.and("nextCheckTime").gte(nextCheckTimeStart);
  878 + } else {
  879 + c1 = Criteria.where("nextCheckTime").gte(nextCheckTimeStart);
  880 + }
  881 + }
  882 +
  883 + if (null != nextCheckTimeEnd) {
  884 + if (null != c1) {
  885 + c1 = c1.lte(nextCheckTimeEnd);
  886 + } else {
  887 + c1 = Criteria.where("nextCheckTime").lte(nextCheckTimeEnd);
  888 + }
  889 + }
  890 +
  891 +
810 892 if (null != hScoreStart) {
811 893 if (null != hScoreStart) {
812 894 if (null != c1) {
813 895  
... ... @@ -915,7 +997,9 @@
915 997 }
916 998 if (null != c1) {
917 999 condition = condition.andCondition(new MongoCondition(c1));
  1000 +
918 1001 }
  1002 +
919 1003 return condition.toMongoQuery();
920 1004 }
921 1005  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java View file @ 1392e76
... ... @@ -26,23 +26,24 @@
26 26  
27 27 public static void main(String[] args){
28 28 PatientsQuery patientsQuery1 = new PatientsQuery();
29   - patientsQuery1.setPid("pid");
  29 + patientsQuery1.setHospitalId("221");
30 30 patientsQuery1.setYn(YnEnums.YES.getId());
31 31 patientsQuery1.setType(1);
32   - Patients patients1 = new Patients();
33   - patients1.setModified(new Date());
34 32  
35   - List<String> ids = new ArrayList<>();
36   - ids.add("id1");
37   - ids.add("id12");
38   - ids.add("id134");
39   - patients1.setRiskScore(12);
40   - patients1.setRiskFactorId(ids);
41   - patients1.setRiskLevelId(JsonUtil.array2JsonString(ids));
42   - Update update = MongoConvertHelper
43   - .convertToNativeUpdate(ReflectionUtils.getUpdateField(patients1));
44   - System.out.println(JsonUtil.obj2JsonString(patientsQuery1.convertToQuery().convertToMongoQuery()));
45   - System.out.println(JsonUtil.obj2JsonString(update));
  33 + List buildType = new ArrayList();
  34 + buildType.add(0);
  35 + buildType.add(2);
  36 + patientsQuery1.setBuildTypeList(buildType);
  37 +
  38 + patientsQuery1.setQueryNo("q");
  39 +
  40 +
  41 +
  42 + patientsQuery1.setBookbuildingDateStart(DateUtil.parseYMD("1999-11-11"));
  43 + patientsQuery1.setBookbuildingDateEnd(DateUtil.parseYMD("2016-12-08"));
  44 +
  45 +
  46 + System.out.println(patientsQuery1.convertToQuery().convertToMongoQuery());
46 47  
47 48 }
48 49 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 1392e76
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.hospitalapi.qhdfy.QhdfyHisService;
4 4 import com.lyms.platform.biz.JdbcUtil;
  5 +import com.lyms.platform.biz.service.AntenatalExaminationService;
5 6 import com.lyms.platform.biz.service.AssayConfigService;
6 7 import com.lyms.platform.biz.service.PatientsService;
7 8 import com.lyms.platform.biz.service.SieveService;
8 9  
9 10  
... ... @@ -10,12 +11,17 @@
10 11 import com.lyms.platform.common.utils.JsonUtil;
11 12 import com.lyms.platform.operate.web.service.SyncDataTaskService;
12 13 import com.lyms.platform.permission.service.OrganizationService;
  14 +import com.lyms.platform.pojo.AntExChuModel;
  15 +import com.lyms.platform.pojo.AntenatalExaminationModel;
13 16 import com.lyms.platform.pojo.AssayConfig;
14 17 import com.lyms.platform.pojo.Patients;
  18 +import com.lyms.platform.query.AntExChuQuery;
  19 +import com.lyms.platform.query.AntExQuery;
15 20 import com.lyms.platform.query.PatientsQuery;
16 21 import org.apache.commons.collections.CollectionUtils;
17 22 import org.apache.commons.io.FileUtils;
18 23 import org.springframework.beans.factory.annotation.Autowired;
  24 +import org.springframework.data.domain.Sort;
19 25 import org.springframework.data.mongodb.core.MongoTemplate;
20 26 import org.springframework.stereotype.Controller;
21 27 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -53,6 +59,9 @@
53 59 @Autowired
54 60 private OrganizationService organizationService;
55 61  
  62 + @Autowired
  63 + private AntenatalExaminationService antenatalExaminationService;
  64 +
56 65 /**
57 66 * 获取科室
58 67 */
... ... @@ -285,6 +294,52 @@
285 294 public String rebuildDefaultRoles() {
286 295 organizationService.rebuildDefaultRoles();
287 296 return "sieveOrder finish";
  297 + }
  298 +
  299 +
  300 + @RequestMapping(value = "/syncPatNextTime", method = RequestMethod.GET)
  301 + @ResponseBody
  302 + public String syncPatNextTime() {
  303 + PatientsQuery patientQuery = new PatientsQuery();
  304 + patientQuery.setYn(YnEnums.YES.getId());
  305 + patientQuery.setHospitalId("221");
  306 + patientQuery.setType(1);
  307 + List<Patients> patientses = patientsService.queryPatient(patientQuery);
  308 + if (CollectionUtils.isNotEmpty(patientses))
  309 + {
  310 + for (Patients pat : patientses) {
  311 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  312 + antExChuQuery.setYn(YnEnums.YES.getId());
  313 + antExChuQuery.setHospitalId(pat.getHospitalId());
  314 + antExChuQuery.setParentId(pat.getId());
  315 + List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery);
  316 + if (CollectionUtils.isNotEmpty(chus)) {
  317 + Date nextTime = null;
  318 + AntExChuModel chu = chus.get(0);
  319 + if (chu != null)
  320 + {
  321 + nextTime = chu.getNextCheckTime();
  322 +
  323 + AntExQuery antExQuery = new AntExQuery();
  324 + antExQuery.setParentId(pat.getId());
  325 + antExQuery.setYn(YnEnums.YES.getId());
  326 + antExQuery.setHospitalId(pat.getHospitalId());
  327 + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
  328 + if (CollectionUtils.isNotEmpty(list))
  329 + {
  330 + AntenatalExaminationModel ae = list.get(0);
  331 + if (ae != null)
  332 + {
  333 + nextTime = ae.getNextCheckTime();
  334 + }
  335 + }
  336 + patientsService.updatePatientOneCol(pat.getId(), "nextCheckTime", nextTime);
  337 + }
  338 +
  339 + }
  340 + }
  341 + }
  342 + return "syncPatNextTime finish";
288 343 }
289 344  
290 345 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 1392e76
... ... @@ -136,7 +136,7 @@
136 136 Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
137 137  
138 138 patients.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor());
139   -
  139 + patientsService.updatePatientOneCol(patients.getId(), "nextCheckTime", com.lyms.platform.common.utils.StringUtils.isEmpty(antExAddRequest.getNextCheckTime()) == true ? null : DateUtil.parseYMD(antExAddRequest.getNextCheckTime()));
140 140 patientsService.updatePatient(patients);
141 141 //修改孕妇高危等级
142 142 updateLastRisk(antExAddRequest.getParentId());
... ... @@ -160,6 +160,7 @@
160 160 }
161 161 Patients patients = patientsService.findOnePatientById(antExAddRequest.getParentId());
162 162 patients.setLastCheckEmployeeId(antExAddRequest.getCheckDoctor());
  163 + patientsService.updatePatientOneCol(patients.getId(), "nextCheckTime", com.lyms.platform.common.utils.StringUtils.isEmpty(antExAddRequest.getNextCheckTime()) == true ? null : DateUtil.parseYMD(antExAddRequest.getNextCheckTime()));
163 164 model.setPid(patients.getPid());
164 165 if (StringUtils.isNotEmpty(patients.getEnable()) && "0".equals(patients.getEnable())) {
165 166 patients.setEnable("1");
... ... @@ -247,7 +248,7 @@
247 248  
248 249 Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
249 250 patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
250   -
  251 + patientsService.updatePatientOneCol(patients.getId(), "nextCheckTime", com.lyms.platform.common.utils.StringUtils.isEmpty(excAddRequest.getNextCheckTime()) == true ? null : DateUtil.parseYMD(excAddRequest.getNextCheckTime()));
251 252 if (StringUtils.isNotEmpty(patients.getEnable()) && "0".equals(patients.getEnable())) {
252 253 patients.setEnable("1");
253 254 }
... ... @@ -291,6 +292,7 @@
291 292 antExChuModel.setHospitalId(autoMatchFacade.getHospitalId(userId));
292 293 antenatalExaminationService.addOneAntEx(antExChuModel);
293 294 //修改患者风险等级
  295 + patientsService.updatePatientOneCol(patients.getId(), "nextCheckTime", com.lyms.platform.common.utils.StringUtils.isEmpty(excAddRequest.getNextCheckTime()) == true ? null : DateUtil.parseYMD(excAddRequest.getNextCheckTime()));
294 296 patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
295 297 // updatePatientRiskLevel(antExChuModel, patients);
296 298 patientsService.updatePatient(patients);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 1392e76
... ... @@ -16,24 +16,19 @@
16 16 import com.lyms.platform.operate.web.worker.WorkHR;
17 17 import com.lyms.platform.permission.model.Organization;
18 18 import com.lyms.platform.permission.model.OrganizationQuery;
19   -import com.lyms.platform.permission.model.Users;
20 19 import com.lyms.platform.permission.service.OrganizationService;
21 20 import com.lyms.platform.permission.service.UsersService;
22 21 import com.lyms.platform.pojo.*;
23 22 import com.lyms.platform.query.*;
24   -import com.sun.javafx.collections.MappingChange;
25 23 import org.apache.commons.collections.CollectionUtils;
26 24 import org.apache.commons.lang.StringUtils;
27   -import org.apache.commons.lang.math.NumberUtils;
28 25 import org.slf4j.Logger;
29 26 import org.slf4j.LoggerFactory;
30 27 import org.springframework.beans.factory.annotation.Autowired;
31   -import org.springframework.data.domain.Sort;
32 28 import org.springframework.stereotype.Component;
33 29 import org.springframework.util.StopWatch;
34 30  
35 31 import javax.servlet.http.HttpServletResponse;
36   -import java.io.IOException;
37 32 import java.io.OutputStream;
38 33 import java.util.*;
39 34 import java.util.concurrent.*;
... ... @@ -257,6 +252,20 @@
257 252 }
258 253 }
259 254  
  255 + //下次预约时间
  256 + if (StringUtils.isNotEmpty(riskPatientsQueryRequest.getNextCheckTime())) {
  257 + String nextDateStr = riskPatientsQueryRequest.getNextCheckTime();
  258 + String[] dates = nextDateStr.split(" - ");
  259 + patientsQuery.setNextCheckTimeStart(DateUtil.parseYMD(dates[0]));
  260 + if (dates.length == 2) {
  261 + patientsQuery.setNextCheckTimeEnd(DateUtil.parseYMD(dates[1]));
  262 + }
  263 + }
  264 + patientsQuery.setBookbuildingDoctor(riskPatientsQueryRequest.getBuildUserId());
  265 + patientsQuery.setLastCheckEmployeeId(riskPatientsQueryRequest.getLastCheckDoctorId());
  266 +
  267 +
  268 +
260 269 patientsQuery.setrLevel(riskPatientsQueryRequest.getrLevel());
261 270 patientsQuery.setLastMensesStart(riskPatientsQueryRequest.capEnd());
262 271 patientsQuery.setLastMensesEnd(riskPatientsQueryRequest.capStart());
... ... @@ -369,6 +378,9 @@
369 378 patientsQuery.setHospitalId(hospital);
370 379 }
371 380 patientsQuery.setNeed(needPage);
  381 +
  382 + patientsQuery.setQueryNo(riskPatientsQueryRequest.getQueryNo());
  383 +
372 384 return patientsQuery;
373 385 }
374 386  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/RiskPatientsQueryRequest.java View file @ 1392e76
... ... @@ -61,8 +61,6 @@
61 61 //体验会员 0非会员 1会员
62 62 @FormParam
63 63 private Integer expVip;
64   - //建档时间
65   - private String buildTime;
66 64 //最后一次医院定义的高危
67 65 private String lastRhTime;
68 66 //本院最后一次产检时间
69 67  
... ... @@ -93,7 +91,29 @@
93 91 // 医院id
94 92 private String hId;
95 93  
  94 + //建档时间
  95 + private String buildTime;
96 96  
  97 + //下次预约时间
  98 + private String nextCheckTime;
  99 +
  100 + //查询号
  101 + private String queryNo;
  102 +
  103 + //建档人
  104 + private String buildUserId;
  105 +
  106 + //产检医生
  107 + private String lastCheckDoctorId;
  108 +
  109 + public String getQueryNo() {
  110 + return queryNo;
  111 + }
  112 +
  113 + public void setQueryNo(String queryNo) {
  114 + this.queryNo = queryNo;
  115 + }
  116 +
97 117 public String getProvinceRegisterId() {
98 118 return provinceRegisterId;
99 119 }
... ... @@ -172,6 +192,33 @@
172 192  
173 193 public void sethId(String hId) {
174 194 this.hId = hId;
  195 + }
  196 +
  197 +
  198 +
  199 +
  200 + public String getNextCheckTime() {
  201 + return nextCheckTime;
  202 + }
  203 +
  204 + public void setNextCheckTime(String nextCheckTime) {
  205 + this.nextCheckTime = nextCheckTime;
  206 + }
  207 +
  208 + public String getBuildUserId() {
  209 + return buildUserId;
  210 + }
  211 +
  212 + public void setBuildUserId(String buildUserId) {
  213 + this.buildUserId = buildUserId;
  214 + }
  215 +
  216 + public String getLastCheckDoctorId() {
  217 + return lastCheckDoctorId;
  218 + }
  219 +
  220 + public void setLastCheckDoctorId(String lastCheckDoctorId) {
  221 + this.lastCheckDoctorId = lastCheckDoctorId;
175 222 }
176 223  
177 224 public Integer getPostViewTimes() {