Commit 3397c6bdd2b3aded93d627bd36ccb2766b174e3b
1 parent
8965d1c404
Exists in
master
and in
6 other branches
日期格式化
Showing 3 changed files with 70 additions and 8 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PostReviewServiceImpl.java
View file @
3397c6b
| ... | ... | @@ -74,7 +74,7 @@ |
| 74 | 74 | for (PostReviewModel model : grid) { |
| 75 | 75 | Map<String, Object> tempMap = new HashMap<>(); |
| 76 | 76 | Patients p = mongoTemplate.findById(model.getParentId(), Patients.class); |
| 77 | - tempMap.put("checkTime", model.getCheckTime()); /** 复查日期 */ | |
| 77 | + tempMap.put("checkTime", model.getCheckTime() == null ? null : DateUtil.getyyyy_MM_dd(model.getCheckTime())); /** 复查日期 */ | |
| 78 | 78 | tempMap.put("hcertificateNum", p == null ? null : p.getCardNo()); /** 证件号 */ |
| 79 | 79 | tempMap.put("username", p == null ? null : p.getUsername()); /** 姓名 */ |
| 80 | 80 | tempMap.put("age", p == null ? null : DateUtil.getAge(p.getBirth())); /** 年龄 */ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
3397c6b
| ... | ... | @@ -1155,20 +1155,33 @@ |
| 1155 | 1155 | |
| 1156 | 1156 | @Override |
| 1157 | 1157 | public BaseObjectResponse getCheckNumber(Date startDate, Date endDate, Integer startWeek, Integer endWeek, Integer childBirth, Integer userId) { |
| 1158 | + List<Map<String, Object>> datas = new ArrayList<>(); | |
| 1158 | 1159 | BaseObjectResponse rest = new BaseObjectResponse(); |
| 1159 | - Criteria criteria = Criteria.where("hospitalId").is(autoMatchFacade.getHospitalId(userId)); | |
| 1160 | + String hid = autoMatchFacade.getHospitalId(userId); | |
| 1161 | + | |
| 1162 | + /** 查出所有符合条件的patients */ | |
| 1163 | + Criteria criteria = Criteria.where("hospitalId").is(hid).and("yn").ne("0"); | |
| 1160 | 1164 | if(startDate != null && endDate != null) { |
| 1161 | 1165 | criteria.and("bookbuildingDate").gte(startDate).lt(DateUtil.addDay(endDate, 1)); |
| 1162 | 1166 | } |
| 1163 | - if(startWeek != null) { /** 末次月经 到 现在相隔的周数 */ | |
| 1164 | - criteria.and("lastMenses").lt(DateUtil.addDay(DateUtil.getWeekDay(startWeek), 1)); | |
| 1167 | + if(startWeek != null && endWeek != null) { /** 末次月经 到 现在相隔的周数 */ | |
| 1168 | + criteria.and("lastMenses").lte(DateUtil.getWeekDay(startWeek)) | |
| 1169 | + .gte(DateUtil.getWeekDay(-startWeek)); | |
| 1165 | 1170 | } |
| 1166 | - if(endWeek != null) { /** 末次月经 到 现在相隔的周数 */ | |
| 1167 | - criteria.and("lastMenses").gte(DateUtil.addDay(DateUtil.getWeekDay(startWeek), 1)); | |
| 1171 | + List<Patients> patients = mongoUtil.findField(Patients.class, criteria,"id", "bookbuildingDate", "fmDate", "pid"); | |
| 1172 | + List<String> patientIds = CollectionUtils.getId(patients, "id", String.class); | |
| 1173 | + if(CollectionUtils.isNotEmpty(patientIds)) { | |
| 1174 | + /** 初诊数据 */ | |
| 1175 | + Criteria c = Criteria.where("hospitalId").is(hid).and("parentId").in(patientIds); | |
| 1176 | + List<AntExChuModel> antExChuModels = mongoUtil.findField(AntExChuModel.class, c, "id", "checkTime", "parentId"); | |
| 1177 | + | |
| 1178 | + /** 复诊数据 */ | |
| 1179 | + List<AntenatalExaminationModel> antExModels = mongoUtil.findField(AntenatalExaminationModel.class, c, "id", "checkDate", "parentId"); | |
| 1180 | + | |
| 1181 | + /** 组装数据 */ | |
| 1182 | + doMerge(datas, antExChuModels, antExModels, patients); | |
| 1168 | 1183 | } |
| 1169 | 1184 | |
| 1170 | - List<Patients> patients = mongoUtil.findField(Patients.class, criteria, "id"); | |
| 1171 | - System.out.println(patients.size()); | |
| 1172 | 1185 | // List<AntExChuModel> antExChuModels = mongoTemplate.find(antexcQuery, AntExChuModel.class); |
| 1173 | 1186 | |
| 1174 | 1187 | // mongoUtil.findField(AntExChuModel.class, antexcQuery, ""); |
| ... | ... | @@ -1184,6 +1197,44 @@ |
| 1184 | 1197 | |
| 1185 | 1198 | rest.setData(restMap);*/ |
| 1186 | 1199 | return rest; |
| 1200 | + } | |
| 1201 | + | |
| 1202 | + private void doMerge(List<Map<String, Object>> datas, List<AntExChuModel> antExChuModels, List<AntenatalExaminationModel> antExModels, List<Patients> patients) { | |
| 1203 | + for (AntExChuModel antExChuModel : antExChuModels) { | |
| 1204 | + for (Patients patient : patients) { | |
| 1205 | + if(patient.getId().equals(antExChuModel.getParentId())) { | |
| 1206 | + Map<String, Object> temp = new HashMap<>(); | |
| 1207 | + temp.put("pid", antExChuModel.getPid()); | |
| 1208 | + temp.put("checkTime", antExChuModel.getCheckTime()); | |
| 1209 | + temp.put("patientId", patient.getId()); | |
| 1210 | + temp.put("bookbuildingDate", patient.getBookbuildingDate()); | |
| 1211 | + temp.put("fmDate", patient.getFmDate()); | |
| 1212 | + datas.add(temp); | |
| 1213 | + break; | |
| 1214 | + } | |
| 1215 | + } | |
| 1216 | + } | |
| 1217 | + | |
| 1218 | + for (AntenatalExaminationModel antExModel : antExModels) { | |
| 1219 | + for (Patients patient : patients) { | |
| 1220 | + if(patient.getId().equals(antExModel.getParentId())) { | |
| 1221 | + Map<String, Object> temp = new HashMap<>(); | |
| 1222 | + temp.put("pid", antExModel.getPid()); | |
| 1223 | + temp.put("checkTime", antExModel.getCheckDate()); | |
| 1224 | + temp.put("patientId", antExModel.getId()); | |
| 1225 | + temp.put("bookbuildingDate", patient.getBookbuildingDate()); | |
| 1226 | + temp.put("fmDate", patient.getFmDate()); | |
| 1227 | + datas.add(temp); | |
| 1228 | + break; | |
| 1229 | + } | |
| 1230 | + } | |
| 1231 | + } | |
| 1232 | + System.out.println(antExChuModels.size()); | |
| 1233 | + System.out.println(antExModels.size()); | |
| 1234 | + System.out.println(datas.size()); | |
| 1235 | + for (Map<String, Object> data : datas) { | |
| 1236 | + System.out.println(data); | |
| 1237 | + } | |
| 1187 | 1238 | } |
| 1188 | 1239 | |
| 1189 | 1240 | private List<Series> createPatientSeries(List<Map<String, Object>> datas) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CollectionUtils.java
View file @
3397c6b
| 1 | 1 | package com.lyms.platform.operate.web.utils; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.pojo.Patients; | |
| 3 | 4 | import org.apache.commons.lang3.StringUtils; |
| 4 | 5 | import org.springframework.util.Assert; |
| 5 | 6 | |
| ... | ... | @@ -149,5 +150,15 @@ |
| 149 | 150 | } |
| 150 | 151 | return true; |
| 151 | 152 | } |
| 153 | + | |
| 154 | + public static <T> List<T> getId(List data, String field, Class<T> clazz) { | |
| 155 | + List<T> list = new ArrayList<>(); | |
| 156 | + for (Object o : data) { | |
| 157 | + Object id = ReflectUtil.invoke(o, "get" + field.substring(0, 1).toUpperCase() + field.substring(1)); | |
| 158 | + list.add((T) id); | |
| 159 | + } | |
| 160 | + return list; | |
| 161 | + } | |
| 162 | + | |
| 152 | 163 | } |