Commit 65ef5b3624203907ebe1e0e46cd75ef812944c83

Authored by jiangjiazhi
1 parent c4bb380ba7

修改转诊

Showing 1 changed file with 21 additions and 17 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 65ef5b3
... ... @@ -67,7 +67,7 @@
67 67 */
68 68 private void setLashCTimes(String hospitalId, String id, int type) {
69 69  
70   - Patients patients = patientsService.findOnePatientById(id);
  70 + /* Patients patients = patientsService.findOnePatientById(id);
71 71 List<Date> list = new ArrayList<>();
72 72 if (type == 2) {
73 73 AntExQuery antExQuery = new AntExQuery();
74 74  
75 75  
... ... @@ -91,24 +91,28 @@
91 91 list.add(antEx.getCheckTime());
92 92 }
93 93 }
94   - }
95   -
96   - if (CollectionUtils.isNotEmpty(list)) {
97   - Collections.sort(list, new Comparator<Date>() {
98   - @Override
99   - public int compare(Date o1, Date o2) {
100   - if (o1 != null && o1.after(o2)) {
101   - return -1;
102   - }
103   - if (o1 != null && o1.before(o2)) {
104   - return 1;
105   - }
106   - return 0;
  94 + }*/
  95 + AntExQuery antExQuery = new AntExQuery();
  96 + antExQuery.setParentId(id);
  97 + antExQuery.setYn(YnEnums.YES.getId());
  98 + Date date=null;
  99 + List<AntenatalExaminationModel> antEx = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "checkDate"));
  100 + if (CollectionUtils.isNotEmpty(antEx)) {
  101 + date= antEx.get(0).getCheckDate();
  102 + } else {
  103 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  104 + antExChuQuery.setParentId(id);
  105 + antExChuQuery.setYn(YnEnums.YES.getId());
  106 + List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery);
  107 + if (CollectionUtils.isNotEmpty(antExChu)) {
  108 + date= antExChu.get(0).getCheckTime();
107 109 }
108   - });
  110 + }
  111 +
  112 + if (null!=date) {
109 113 Patients patients1 = new Patients();
110   - patients1.setLastCTime(list.get(0));
111   - patients1.setId(patients.getId());
  114 + patients1.setLastCTime(date);
  115 + patients1.setId(id);
112 116 patientsService.updatePatient(patients1);
113 117 }
114 118 }