Commit 0fa6fb4b69a795d16170b8b159df6708916184f2

Authored by [wangbo]
1 parent c76314e9f7

儿童历史结算bug修改

Showing 5 changed files with 166 additions and 128 deletions

platform-dal/src/main/java/com/lyms/platform/query/TrackDownRecordQuery.java View file @ 0fa6fb4
... ... @@ -7,6 +7,7 @@
7 7 import com.lyms.platform.common.dao.operator.MongoQuery;
8 8 import com.lyms.platform.common.utils.DateUtil;
9 9 import com.lyms.platform.common.utils.StringUtils;
  10 +import org.apache.commons.collections.CollectionUtils;
10 11 import org.springframework.data.mongodb.core.query.Criteria;
11 12  
12 13 import java.util.Date;
13 14  
... ... @@ -46,8 +47,8 @@
46 47 private String phone;
47 48 private Date startCreated;
48 49 private Date endCreated;
  50 + private List<String> hospitalIdList;
49 51  
50   -
51 52 /**
52 53 * 末次月经
53 54 */
... ... @@ -94,6 +95,15 @@
94 95 //
95 96 private boolean isHistory;
96 97  
  98 +
  99 + public List<String> getHospitalIdList() {
  100 + return hospitalIdList;
  101 + }
  102 +
  103 + public void setHospitalIdList(List<String> hospitalIdList) {
  104 + this.hospitalIdList = hospitalIdList;
  105 + }
  106 +
97 107 public boolean isHistory() {
98 108 return isHistory;
99 109 }
... ... @@ -366,6 +376,10 @@
366 376  
367 377 if (StringUtils.isNotEmpty(id)) {
368 378 condition = condition.and("id", id, MongoOper.IS);
  379 + }
  380 +
  381 + if (CollectionUtils.isNotEmpty(hospitalIdList)) {
  382 + condition = condition.and("hospitalId", hospitalIdList, MongoOper.IN);
369 383 }
370 384  
371 385 if (StringUtils.isNotEmpty(phone)) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveController.java View file @ 0fa6fb4
... ... @@ -312,6 +312,9 @@
312 312 * @param cqSieveQueryRequest
313 313 * @param request
314 314 * @param response
  315 + *
  316 + *
  317 + *
315 318 */
316 319 @TokenRequired
317 320 @RequestMapping(value = "exportSieveReportExcl", method = RequestMethod.POST)
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java View file @ 0fa6fb4
... ... @@ -147,8 +147,8 @@
147 147 */
148 148 @RequestMapping(value = "/historyData", method = RequestMethod.GET)
149 149 @ResponseBody
150   - public void historyData(Date startTime, Date endTime, String hospitalId) {
151   - downFacade.historyData(startTime, endTime, hospitalId);
  150 + public void historyData(Date startTime, Date endTime, String hospitalId, String provinceId, String cityId, String areaId) {
  151 + downFacade.historyData(startTime, endTime, hospitalId, provinceId, cityId, areaId);
152 152 }
153 153  
154 154 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyNutritionFacade.java View file @ 0fa6fb4
... ... @@ -330,8 +330,6 @@
330 330 map.put("recordTime", DateUtil.getyyyy_MM_dd(model.getNutritiTime()));
331 331  
332 332  
333   -
334   -
335 333 // 回退版本
336 334 String currInterpretDoctorId = model.getInterpretDoctorId();
337 335 // 新增报表解读人和结算状态
... ... @@ -1032,7 +1030,7 @@
1032 1030 }
1033 1031 String doctorId = healthChargeModel.getDoctorId();
1034 1032 String doctorName = "";
1035   - if (doctorId != null) {
  1033 + if (StringUtils.isNotEmpty(doctorName)) {
1036 1034 Users users = usersService.getUsers(Integer.parseInt(doctorId));
1037 1035 if (users != null) {
1038 1036 doctorName = users.getName();
... ... @@ -1293,7 +1291,7 @@
1293 1291 /**
1294 1292 * 秦皇岛精简版儿童膳食报告
1295 1293 */
1296   - public BaseObjectResponse queryBabyDietReport(String id, Integer userId ,String doctorId
  1294 + public BaseObjectResponse queryBabyDietReport(String id, Integer userId, String doctorId
1297 1295 ) {
1298 1296 BaseObjectResponse objectResponse = new BaseObjectResponse();
1299 1297 Map data = new HashMap();
1300 1298  
1301 1299  
1302 1300  
1303 1301  
... ... @@ -1471,34 +1469,28 @@
1471 1469 }
1472 1470 }
1473 1471  
1474   - if (month > 36 && month <= 60)
1475   - {
  1472 + if (month > 36 && month <= 60) {
1476 1473  
1477 1474 int kcal = getThreeAfterKcal(model.getWeight());
1478 1475  
1479   - map.put("kaul", String.format("%.2f", 44 * model.getWeight() / 0.6) + "kacl");
  1476 + map.put("kaul", String.format("%.2f", 44 * model.getWeight() / 0.6) + "kacl");
1480 1477  
1481 1478 int shape = kaupEvaluate.equals("超重") ? 2 : (kaupEvaluate.equals("消瘦") ? 0 : 1);
1482 1479 List<BabyDietReportModel> babyDietReportList1 = mongoTemplate.find(Query.query(Criteria.where("shape").is(shape).and("type").is(1)), BabyDietReportModel.class);
1483 1480  
1484   - for (BabyDietReportModel babyDietReportModel : babyDietReportList1)
1485   - {
1486   - if (babyDietReportModel.getStartMonthAge() <= month && month <= babyDietReportModel.getEndMonthAge())
1487   - {
  1481 + for (BabyDietReportModel babyDietReportModel : babyDietReportList1) {
  1482 + if (babyDietReportModel.getStartMonthAge() <= month && month <= babyDietReportModel.getEndMonthAge()) {
1488 1483 data.put("feedingGuide", babyDietReportModel.getFeedingGuide());
1489 1484 }
1490 1485 }
1491 1486  
1492 1487  
1493 1488 List<BabyDietReportModel> babyDietReportList = mongoTemplate.find(Query.query(Criteria.where("kcal").is(kcal).and("type").is(1)), BabyDietReportModel.class);
1494   - for (BabyDietReportModel babyDietReportModel : babyDietReportList)
1495   - {
1496   - if (CollectionUtils.isNotEmpty(babyDietReportModel.getDietStructure()))
1497   - {
  1489 + for (BabyDietReportModel babyDietReportModel : babyDietReportList) {
  1490 + if (CollectionUtils.isNotEmpty(babyDietReportModel.getDietStructure())) {
1498 1491 data.put("dietStructure", babyDietReportModel.getDietStructure());
1499 1492 }
1500   - if (CollectionUtils.isNotEmpty(babyDietReportModel.getBreakfast()))
1501   - {
  1493 + if (CollectionUtils.isNotEmpty(babyDietReportModel.getBreakfast())) {
1502 1494 data.put("breakfast", babyDietReportModel.getBreakfast());
1503 1495 data.put("breakfastAdd", babyDietReportModel.getBreakfastAdd());
1504 1496 data.put("lunch", babyDietReportModel.getLunch());
... ... @@ -1506,8 +1498,7 @@
1506 1498 data.put("dinner", babyDietReportModel.getDinner());
1507 1499 data.put("dinnerAdd", babyDietReportModel.getDinnerAdd());
1508 1500 }
1509   - if (CollectionUtils.isNotEmpty(babyDietReportModel.getRecommendRecipes()))
1510   - {
  1501 + if (CollectionUtils.isNotEmpty(babyDietReportModel.getRecommendRecipes())) {
1511 1502 data.put("recommendRecipes", babyDietReportModel.getRecommendRecipes());
1512 1503 }
1513 1504 }
1514 1505  
1515 1506  
1516 1507  
1517 1508  
... ... @@ -1525,21 +1516,18 @@
1525 1516  
1526 1517 /**
1527 1518 * 3-5岁热量计算
1528   - *
  1519 + * <p>
1529 1520 * 3-5岁儿童能量计算规则
1530   - 每日能量=44×体重÷60%
  1521 + * 每日能量=44×体重÷60%
  1522 + *
1531 1523 * @return
1532 1524 */
1533   - private int getThreeAfterKcal(double weight)
1534   - {
  1525 + private int getThreeAfterKcal(double weight) {
1535 1526 double result = 44 * weight / 0.6;
1536   - int kcal = ((int)result/100)*100;
1537   - if (kcal < 800)
1538   - {
  1527 + int kcal = ((int) result / 100) * 100;
  1528 + if (kcal < 800) {
1539 1529 kcal = 800;
1540   - }
1541   - else if (kcal > 2100)
1542   - {
  1530 + } else if (kcal > 2100) {
1543 1531 kcal = 2100;
1544 1532 }
1545 1533 return kcal;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TrackDownFacade.java View file @ 0fa6fb4
... ... @@ -16,6 +16,9 @@
16 16 import com.lyms.platform.operate.web.worker.ChaseVisitHistory;
17 17 import com.lyms.platform.operate.web.worker.GravidaVisitHistory;
18 18 import com.lyms.platform.operate.web.worker.TrackDownHistory;
  19 +import com.lyms.platform.permission.model.Organization;
  20 +import com.lyms.platform.permission.model.OrganizationQuery;
  21 +import com.lyms.platform.permission.service.OrganizationService;
19 22 import com.lyms.platform.pojo.*;
20 23 import com.lyms.platform.query.*;
21 24 import org.apache.commons.collections.CollectionUtils;
22 25  
23 26  
24 27  
25 28  
26 29  
27 30  
28 31  
29 32  
30 33  
31 34  
32 35  
33 36  
34 37  
35 38  
36 39  
37 40  
38 41  
... ... @@ -1099,124 +1102,154 @@
1099 1102 private ThreadPoolTaskExecutor commonThreadPool;
1100 1103  
1101 1104 @Autowired
1102   - private PremaritalCheckupService premaritalCheckupService;
  1105 + private AntenatalExaminationService antenatalExaminationService;
1103 1106  
1104 1107 @Autowired
1105   - private AntenatalExaminationService antenatalExaminationService;
  1108 + private OrganizationService organizationService;
1106 1109  
  1110 + public void historyData(Date startTime, Date endTime, String hospitalId, String provinceId, String cityId, String areaId) {
1107 1111  
1108   - public void historyData(Date startTime, Date endTime, String hospitalId) {
  1112 + List<String> orgHospitalList = new ArrayList<>();
  1113 + ResidentsArchiveQuery query = new ResidentsArchiveQuery();
  1114 + PatientsQuery patients = new PatientsQuery();
  1115 + TrackDownRecordQuery trackDownRecordQuery = new TrackDownRecordQuery();
1109 1116 List<Map<String, Integer>> dataRequest = new ArrayList<>();
1110   - if (null != startTime && null != endTime && StringUtils.isNotEmpty(hospitalId)) {
1111   - //1.处理是否妇女是否有婚检
1112   - ResidentsArchiveQuery query = new ResidentsArchiveQuery();
  1117 + if (StringUtils.isNotEmpty(hospitalId)) {
  1118 + query.setHospitalId(hospitalId);
  1119 + patients.setHospitalId(hospitalId);
  1120 + trackDownRecordQuery.setHospitalId(hospitalId);
  1121 + } else if (null != startTime && null != endTime) {
1113 1122 query.setCreatedStart(startTime);
1114 1123 query.setCreatedEnd(endTime);
1115   - query.setHospitalId(hospitalId);
1116   - query.setHistory(true);
1117   - List<ResidentsArchiveModel> archiveModels = residentsArchiveService.queryResident(query);
1118   - if (CollectionUtils.isNotEmpty(archiveModels)) {
1119   - int batchSize = 5;
1120   - int ends = 0;
1121   - List<Future> futures = new ArrayList<>();
1122   - for (int i = 0; i < archiveModels.size(); i += batchSize) {
1123   - ends = (ends + batchSize);
1124   - if (ends > archiveModels.size()) {
1125   - ends = archiveModels.size();
  1124 + patients.setCreatedTimeStart(startTime);
  1125 + patients.setCreatedTimeEnd(endTime);
  1126 + trackDownRecordQuery.setStartCreated(startTime);
  1127 + trackDownRecordQuery.setEndCreated(endTime);
  1128 + } else if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(provinceId)) {
  1129 + OrganizationQuery organizationQuery = new OrganizationQuery();
  1130 + organizationQuery.setYn(YnEnums.YES.getId());
  1131 +
  1132 + organizationQuery.setProvinceId(provinceId);
  1133 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(cityId)) {
  1134 + organizationQuery.setCityId(cityId);
  1135 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(areaId)) {
  1136 + organizationQuery.setAreaId(areaId);
  1137 + }
  1138 + }
  1139 + List<Organization> organizations = organizationService.queryOrganization(organizationQuery);
  1140 + if (CollectionUtils.isNotEmpty(organizations)) {
  1141 + for (Organization org : organizations) {
  1142 + if (null != org.getId()) {
  1143 + orgHospitalList.add(org.getId() + "");
1126 1144 }
1127   - List<ResidentsArchiveModel> mlist = archiveModels.subList(i, ends);
1128   - Callable c = new ChaseVisitHistory(mlist, residentsArchiveService, mongoTemplate);
1129   - Future f = commonThreadPool.submit(c);
1130   - if (f != null) {
1131   - futures.add(f);
1132   - }
1133 1145 }
1134   - if (CollectionUtils.isNotEmpty(futures)) {
1135   - for (Future f : futures) {
1136   - try {
1137   - dataRequest.add((Map<String, Integer>) f.get());
1138   - } catch (Exception e) {
1139   - ExceptionUtils.catchException(e, "fm list error.");
1140   - }
  1146 +
  1147 + }
  1148 + if (CollectionUtils.isNotEmpty(orgHospitalList)) {
  1149 + query.setHospitalIds(orgHospitalList);
  1150 + patients.setHospitalList(orgHospitalList);
  1151 + trackDownRecordQuery.setHospitalIdList(orgHospitalList);
  1152 + }
  1153 + }
  1154 + //1.处理是否妇女是否有婚检
  1155 + query.setHistory(true);
  1156 + List<ResidentsArchiveModel> archiveModels = residentsArchiveService.queryResident(query);
  1157 + if (CollectionUtils.isNotEmpty(archiveModels)) {
  1158 + int batchSize = 5;
  1159 + int ends = 0;
  1160 + List<Future> futures = new ArrayList<>();
  1161 + for (int i = 0; i < archiveModels.size(); i += batchSize) {
  1162 + ends = (ends + batchSize);
  1163 + if (ends > archiveModels.size()) {
  1164 + ends = archiveModels.size();
  1165 + }
  1166 + List<ResidentsArchiveModel> mlist = archiveModels.subList(i, ends);
  1167 + Callable c = new ChaseVisitHistory(mlist, residentsArchiveService, mongoTemplate);
  1168 + Future f = commonThreadPool.submit(c);
  1169 + if (f != null) {
  1170 + futures.add(f);
  1171 + }
  1172 + }
  1173 + if (CollectionUtils.isNotEmpty(futures)) {
  1174 + for (Future f : futures) {
  1175 + try {
  1176 + dataRequest.add((Map<String, Integer>) f.get());
  1177 + } catch (Exception e) {
  1178 + ExceptionUtils.catchException(e, "fm list error.");
1141 1179 }
1142 1180 }
1143 1181 }
1144   - //处理孕妇建档处历史数据
1145   - PatientsQuery patients = new PatientsQuery();
1146   - patients.setCreatedTimeStart(startTime);
1147   - patients.setCreatedTimeEnd(endTime);
1148   - patients.setHospitalId(hospitalId);
1149   - patients.setHistory(true);
1150   - List<Patients> patientsList = patientsService.queryPatient(patients);
  1182 + }
  1183 + //处理孕妇建档处历史数据
1151 1184  
1152 1185  
1153   - if (CollectionUtils.isNotEmpty(patientsList)) {
1154   - int batchSize = 5;
1155   - int ends = 0;
1156   - List<Future> futures = new ArrayList<>();
1157   - for (int i = 0; i < patientsList.size(); i += batchSize) {
1158   - ends = (ends + batchSize);
1159   - if (ends > patientsList.size()) {
1160   - ends = patientsList.size();
1161   - }
1162   - List<Patients> mlist = patientsList.subList(i, ends);
1163   - Callable c = new GravidaVisitHistory(mlist, matDeliverService, patientsService, antenatalExaminationService);
1164   - Future f = commonThreadPool.submit(c);
1165   - if (f != null) {
1166   - futures.add(f);
1167   - }
  1186 + patients.setHistory(true);
  1187 + List<Patients> patientsList = patientsService.queryPatient(patients);
  1188 +
  1189 +
  1190 + if (CollectionUtils.isNotEmpty(patientsList)) {
  1191 + int batchSize = 5;
  1192 + int ends = 0;
  1193 + List<Future> futures = new ArrayList<>();
  1194 + for (int i = 0; i < patientsList.size(); i += batchSize) {
  1195 + ends = (ends + batchSize);
  1196 + if (ends > patientsList.size()) {
  1197 + ends = patientsList.size();
1168 1198 }
1169   - if (CollectionUtils.isNotEmpty(futures)) {
1170   - for (Future f : futures) {
1171   - try {
1172   - dataRequest.add((Map<String, Integer>) f.get());
1173   - } catch (Exception e) {
1174   - ExceptionUtils.catchException(e, "fm list error.");
1175   - }
1176   - }
  1199 + List<Patients> mlist = patientsList.subList(i, ends);
  1200 + Callable c = new GravidaVisitHistory(mlist, matDeliverService, patientsService, antenatalExaminationService);
  1201 + Future f = commonThreadPool.submit(c);
  1202 + if (f != null) {
  1203 + futures.add(f);
1177 1204 }
1178 1205 }
1179   - //追访详情历史数据处理
1180   - TrackDownRecordQuery trackDownRecordQuery = new TrackDownRecordQuery();
1181   - trackDownRecordQuery.setStartCreated(startTime);
1182   - trackDownRecordQuery.setEndCreated(endTime);
1183   - trackDownRecordQuery.setHospitalId(hospitalId);
1184   - trackDownRecordQuery.setHistory(true);
1185   - List<TrackDownRecord> trackDownRecords = trackDownRecordService.queryTrackDown(trackDownRecordQuery);
1186   - if (CollectionUtils.isNotEmpty(trackDownRecords)) {
1187   - int batchSize = 5;
1188   - int ends = 0;
1189   - List<Future> futures = new ArrayList<>();
1190   - for (int i = 0; i < trackDownRecords.size(); i += batchSize) {
1191   - ends = (ends + batchSize);
1192   - if (ends > trackDownRecords.size()) {
1193   - ends = trackDownRecords.size();
  1206 + if (CollectionUtils.isNotEmpty(futures)) {
  1207 + for (Future f : futures) {
  1208 + try {
  1209 + dataRequest.add((Map<String, Integer>) f.get());
  1210 + } catch (Exception e) {
  1211 + ExceptionUtils.catchException(e, "fm list error.");
1194 1212 }
1195   - List<TrackDownRecord> mlist = trackDownRecords.subList(i, ends);
1196   - Callable c = new TrackDownHistory(mlist, antenatalExaminationService, trackDownRecordService);
1197   - Future f = commonThreadPool.submit(c);
1198   - if (f != null) {
1199   - futures.add(f);
1200   - }
1201 1213 }
1202   - if (CollectionUtils.isNotEmpty(futures)) {
1203   - for (Future f : futures) {
1204   - try {
1205   - dataRequest.add((Map<String, Integer>) f.get());
1206   - } catch (Exception e) {
1207   - ExceptionUtils.catchException(e, "fm list error.");
1208   - }
1209   - }
1210   - }
1211 1214 }
1212   - System.out.println("妇女处理历史数据 " + archiveModels.size());
1213   - System.out.println("孕妇处理历史数据 " + patientsList.size());
1214   - System.out.println("追访详情处理历史数据" + trackDownRecords.size());
1215   - System.out.println("处理范围 时间" + DateUtil.getyyyy_MM_dd(startTime) + "到" + DateUtil.getyyyy_MM_dd(endTime) + "医院id" + hospitalId);
1216 1215 }
  1216 + //追访详情历史数据处理
1217 1217  
1218 1218  
  1219 + trackDownRecordQuery.setHistory(true);
  1220 + List<TrackDownRecord> trackDownRecords = trackDownRecordService.queryTrackDown(trackDownRecordQuery);
  1221 + if (CollectionUtils.isNotEmpty(trackDownRecords)) {
  1222 + int batchSize = 5;
  1223 + int ends = 0;
  1224 + List<Future> futures = new ArrayList<>();
  1225 + for (int i = 0; i < trackDownRecords.size(); i += batchSize) {
  1226 + ends = (ends + batchSize);
  1227 + if (ends > trackDownRecords.size()) {
  1228 + ends = trackDownRecords.size();
  1229 + }
  1230 + List<TrackDownRecord> mlist = trackDownRecords.subList(i, ends);
  1231 + Callable c = new TrackDownHistory(mlist, antenatalExaminationService, trackDownRecordService);
  1232 + Future f = commonThreadPool.submit(c);
  1233 + if (f != null) {
  1234 + futures.add(f);
  1235 + }
  1236 + }
  1237 + if (CollectionUtils.isNotEmpty(futures)) {
  1238 + for (Future f : futures) {
  1239 + try {
  1240 + dataRequest.add((Map<String, Integer>) f.get());
  1241 + } catch (Exception e) {
  1242 + ExceptionUtils.catchException(e, "fm list error.");
  1243 + }
  1244 + }
  1245 + }
  1246 + }
  1247 + System.out.println("妇女处理历史数据 " + archiveModels.size());
  1248 + System.out.println("孕妇处理历史数据 " + patientsList.size());
  1249 + System.out.println("追访详情处理历史数据" + trackDownRecords.size());
  1250 + System.out.println("处理范围 时间" + DateUtil.getyyyy_MM_dd(startTime) + "到" + DateUtil.getyyyy_MM_dd(endTime) + "医院id" + hospitalId);
1219 1251 }
  1252 +
1220 1253  
1221 1254 }