Commit c3f9f3265094cc4574483c09be7a4fd243a14728

Authored by wtt
1 parent e89938f516

秦皇岛初诊定时同步

Showing 3 changed files with 411 additions and 293 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java View file @ c3f9f32
... ... @@ -98,6 +98,20 @@
98 98 }
99 99  
100 100 /**
  101 + * 秦皇岛初诊手动同步接口
  102 + *
  103 + * @param startDate
  104 + * @param endDate
  105 + * @return
  106 + */
  107 + @RequestMapping(value = "/AntExChuTongbuSync", method = RequestMethod.GET)
  108 + @ResponseBody
  109 + public BaseObjectResponse AntExChuTongbuSync(@RequestParam("startDate") String startDate,
  110 + @RequestParam("endDate") String endDate) {
  111 + BaseObjectResponse br = antenatalExaminationFacade.AntExChuTongbuSync(startDate, endDate, true);
  112 + return br;
  113 + }
  114 + /**
101 115 * 下载初诊word
102 116 *
103 117 * @param id
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ c3f9f32
Diff suppressed. Click to show
1 1 package com.lyms.platform.operate.web.facade;
2 2  
  3 +import com.google.gson.Gson;
3 4 import com.lyms.hospitalapi.dzfy.DzfyHisService;
4 5 import com.lyms.hospitalapi.pojo.QhdDjq;
5 6 import com.lyms.hospitalapi.zcfy.ZcPrenatalService;
6 7  
... ... @@ -13,10 +14,11 @@
13 14 import com.lyms.platform.common.dao.BaseQuery;
14 15 import com.lyms.platform.common.dao.operator.MongoQuery;
15 16 import com.lyms.platform.common.enums.*;
16   -import com.lyms.platform.common.result.*;
17   -import com.lyms.platform.common.utils.*;
18   -import com.lyms.platform.common.utils.BeanUtils;
  17 +import com.lyms.platform.common.result.BaseListResponse;
  18 +import com.lyms.platform.common.result.BaseObjectResponse;
  19 +import com.lyms.platform.common.result.BaseResponse;
19 20 import com.lyms.platform.common.utils.HttpClientUtil;
  21 +import com.lyms.platform.common.utils.*;
20 22 import com.lyms.platform.operate.web.request.*;
21 23 import com.lyms.platform.operate.web.result.*;
22 24 import com.lyms.platform.operate.web.service.ITrackDownService;
23 25  
... ... @@ -36,10 +38,8 @@
36 38 import org.apache.commons.collections.map.HashedMap;
37 39 import org.apache.commons.lang.StringUtils;
38 40 import org.apache.commons.lang.math.NumberUtils;
39   -import org.codehaus.jackson.map.util.BeanUtil;
40 41 import org.slf4j.Logger;
41 42 import org.slf4j.LoggerFactory;
42   -import org.springframework.beans.*;
43 43 import org.springframework.beans.factory.annotation.Autowired;
44 44 import org.springframework.beans.factory.annotation.Qualifier;
45 45 import org.springframework.data.domain.Sort;
... ... @@ -356,9 +356,8 @@
356 356 couponService.use(autoMatchFacade.getHospitalId(userId), antExAddRequest.getCouponCode(), userId, model.getId());
357 357  
358 358 //秦皇岛妇幼使用完优惠劵后需要把对应优惠劵插入到秦皇岛妇幼his
359   - if ("216".equals(hospitalId))
360   - {
361   - qhdCouponUse( hospitalId, antExAddRequest.getCouponCode(), userId);
  359 + if ("216".equals(hospitalId)) {
  360 + qhdCouponUse(hospitalId, antExAddRequest.getCouponCode(), userId);
362 361 }
363 362 }
364 363 }
... ... @@ -405,7 +404,7 @@
405 404 antenatalExaminationService.addOneBabyAnt(model);
406 405 antExAddRequest.setId(model.getId());
407 406 //自动诊断高危
408   - autoExRisk(antExAddRequest,patients);
  407 + autoExRisk(antExAddRequest, patients);
409 408 /** 验证产检券是否可用 可用就改为已使用状态 */
410 409 if (StringUtils.isNotBlank(antExAddRequest.getCouponCode()) && antExAddRequest.getCouponType() != null) {
411 410 BaseObjectResponse resp = couponService.validate(antExAddRequest.getCouponCode(), antExAddRequest.getCouponType(), autoMatchFacade.getHospitalId(userId));
... ... @@ -415,9 +414,8 @@
415 414 couponService.use(autoMatchFacade.getHospitalId(userId), antExAddRequest.getCouponCode(), userId, model.getId());
416 415  
417 416 //秦皇岛妇幼使用完优惠劵后需要把对应优惠劵插入到秦皇岛妇幼his
418   - if ("216".equals(hospitalId))
419   - {
420   - qhdCouponUse( hospitalId, antExAddRequest.getCouponCode(), userId);
  417 + if ("216".equals(hospitalId)) {
  418 + qhdCouponUse(hospitalId, antExAddRequest.getCouponCode(), userId);
421 419 }
422 420 }
423 421 }
424 422  
... ... @@ -1127,15 +1125,13 @@
1127 1125 } catch (Exception e) {
1128 1126 }
1129 1127 try {
1130   - if (StringUtils.isNotEmpty(excAddRequest.getCouponCode()))
1131   - {
  1128 + if (StringUtils.isNotEmpty(excAddRequest.getCouponCode())) {
1132 1129 /** 把优惠券设置为已使用状态 */
1133 1130 couponService.use(hospitalId, excAddRequest.getCouponCode(), userId, excAddRequest.getId());
1134 1131  
1135 1132 //秦皇岛妇幼使用完优惠劵后需要把对应优惠劵插入到秦皇岛妇幼his
1136   - if ("216".equals(hospitalId))
1137   - {
1138   - qhdCouponUse( hospitalId, excAddRequest.getCouponCode(), userId);
  1133 + if ("216".equals(hospitalId)) {
  1134 + qhdCouponUse(hospitalId, excAddRequest.getCouponCode(), userId);
1139 1135 }
1140 1136 }
1141 1137 } catch (Exception e) {
1142 1138  
1143 1139  
... ... @@ -1183,24 +1179,21 @@
1183 1179  
1184 1180 try {
1185 1181 //处方计划
1186   - if (excAddRequest.getNextCheckTime() != null)
1187   - {
1188   - saveCheckItem(DateUtil.parseYMD(excAddRequest.getNextCheckTime()),patients);
  1182 + if (excAddRequest.getNextCheckTime() != null) {
  1183 + saveCheckItem(DateUtil.parseYMD(excAddRequest.getNextCheckTime()), patients);
1189 1184 }
1190 1185 } catch (Exception e) {
1191 1186 }
1192 1187 try {
1193 1188 //处方计划
1194   - if (excAddRequest.getCheckTime()!= null)
1195   - {
  1189 + if (excAddRequest.getCheckTime() != null) {
1196 1190 saveCheckActual(DateUtil.parseYMD(excAddRequest.getCheckTime()), patients);
1197 1191 }
1198 1192 } catch (Exception e) {
1199 1193 }
1200 1194  
1201 1195 try {
1202   - if (excAddRequest.getNextCheckTime() != null)
1203   - {
  1196 + if (excAddRequest.getNextCheckTime() != null) {
1204 1197 //追访统计
1205 1198 saveTrackCount(DateUtil.parseYMD(excAddRequest.getNextCheckTime()), patients);
1206 1199 }
... ... @@ -1210,8 +1203,7 @@
1210 1203 });
1211 1204 }
1212 1205  
1213   - private void qhdCouponUse(final String hospitalId,final String code,final Integer userId)
1214   - {
  1206 + private void qhdCouponUse(final String hospitalId, final String code, final Integer userId) {
1215 1207  
1216 1208 commonThreadPool.execute(new Runnable() {
1217 1209 @Override
... ... @@ -1300,9 +1292,8 @@
1300 1292 });
1301 1293 }
1302 1294  
1303   - public TrackCountRecord saveTrackCount(Date nextCheckTime,Patients patients)
1304   - {
1305   - TrackCountRecord record = new TrackCountRecord();
  1295 + public TrackCountRecord saveTrackCount(Date nextCheckTime, Patients patients) {
  1296 + TrackCountRecord record = new TrackCountRecord();
1306 1297 record.setHospitalId(patients.getHospitalId());
1307 1298 record.setPid(patients.getPid());
1308 1299 record.setPatientId(patients.getId());
1309 1300  
... ... @@ -1313,11 +1304,9 @@
1313 1304 return record;
1314 1305 }
1315 1306  
1316   - public void updateTrackCount(Date checkTime,Date nextCheckTime,Patients patients)
1317   - {
  1307 + public void updateTrackCount(Date checkTime, Date nextCheckTime, Patients patients) {
1318 1308 TrackDayConfig trackDayConfig = mongoTemplate.findOne(Query.query(Criteria.where("hospitalId").is(patients.getHospitalId())), TrackDayConfig.class);
1319   - if (trackDayConfig == null || trackDayConfig.getConfis() == null || trackDayConfig.getConfis().size() == 0)
1320   - {
  1309 + if (trackDayConfig == null || trackDayConfig.getConfis() == null || trackDayConfig.getConfis().size() == 0) {
1321 1310 return;
1322 1311 }
1323 1312  
1324 1313  
1325 1314  
1326 1315  
1327 1316  
1328 1317  
1329 1318  
... ... @@ -1325,40 +1314,33 @@
1325 1314 antExRecordQuery.setPid(patients.getPid());
1326 1315 List<AntExRecordModel> recordModels = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "created");
1327 1316 System.out.println(recordModels.size());
1328   - if (CollectionUtils.isNotEmpty(recordModels) && recordModels.size() > 1)
1329   - {
  1317 + if (CollectionUtils.isNotEmpty(recordModels) && recordModels.size() > 1) {
1330 1318 TrackCountRecord record = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patients.getPid())).with(new Sort(Sort.Direction.DESC, "created")), TrackCountRecord.class);
1331 1319  
1332   - if (record == null)
1333   - {
1334   - record = saveTrackCount(nextCheckTime,patients);
  1320 + if (record == null) {
  1321 + record = saveTrackCount(nextCheckTime, patients);
1335 1322 }
1336 1323  
1337   - System.out.println("record="+record);
  1324 + System.out.println("record=" + record);
1338 1325 AntExRecordModel recordModel = recordModels.get(1);
1339   - System.out.println("recordModel="+recordModel);
  1326 + System.out.println("recordModel=" + recordModel);
1340 1327 System.out.println(recordModel.getId());
1341 1328 System.out.println(DateUtil.getyyyy_MM_dd(recordModel.getNextCheckTime()));
1342 1329 System.out.println(DateUtil.getyyyy_MM_dd(checkTime));
1343   - if (DateUtil.getyyyy_MM_dd(recordModel.getNextCheckTime()).equals(DateUtil.getyyyy_MM_dd(checkTime)))
1344   - {
  1330 + if (DateUtil.getyyyy_MM_dd(recordModel.getNextCheckTime()).equals(DateUtil.getyyyy_MM_dd(checkTime))) {
1345 1331  
1346 1332 record.setZsCheckStatus(1);
1347 1333 Query query = Query.query(Criteria.where("_id").is(record.getId()));
1348 1334 Update update = MongoConvertHelper
1349 1335 .convertToNativeUpdate(ReflectionUtils.getUpdateField(record));
1350 1336 mongoTemplate.updateFirst(query, update, TrackCountRecord.class);
1351   - }
1352   - else if (checkTime.getTime() < DateUtil.addDay(recordModel.getNextCheckTime(),4).getTime() && checkTime.getTime() > recordModel.getNextCheckTime().getTime())
1353   - {
  1337 + } else if (checkTime.getTime() < DateUtil.addDay(recordModel.getNextCheckTime(), 4).getTime() && checkTime.getTime() > recordModel.getNextCheckTime().getTime()) {
1354 1338 record.setJsCheckStatus(1);
1355 1339 Query query = Query.query(Criteria.where("_id").is(record.getId()));
1356 1340 Update update = MongoConvertHelper
1357 1341 .convertToNativeUpdate(ReflectionUtils.getUpdateField(record));
1358 1342 mongoTemplate.updateFirst(query, update, TrackCountRecord.class);
1359   - }
1360   - else if (checkTime.getTime() > DateUtil.addDay(recordModel.getNextCheckTime(),3).getTime())
1361   - {
  1343 + } else if (checkTime.getTime() > DateUtil.addDay(recordModel.getNextCheckTime(), 3).getTime()) {
1362 1344 record.setLoseStatus(1);
1363 1345 Query query = Query.query(Criteria.where("_id").is(record.getId()));
1364 1346 Update update = MongoConvertHelper
1365 1347  
1366 1348  
1367 1349  
... ... @@ -1366,20 +1348,17 @@
1366 1348 mongoTemplate.updateFirst(query, update, TrackCountRecord.class);
1367 1349 }
1368 1350 //有效期召回人次
1369   - List<Map<String, String>> configs = trackDayConfig.getConfis();
  1351 + List<Map<String, String>> configs = trackDayConfig.getConfis();
1370 1352 String riskLevelId = patients.getRiskLevelId();
1371   - System.out.println("riskLevelId="+riskLevelId);
1372   - if (StringUtils.isNotEmpty(riskLevelId) && !"[]".equals(riskLevelId))
1373   - {
  1353 + System.out.println("riskLevelId=" + riskLevelId);
  1354 + if (StringUtils.isNotEmpty(riskLevelId) && !"[]".equals(riskLevelId)) {
1374 1355 List<String> rlevel = JsonUtil.jkstr2Obj(patients.getRiskLevelId(), List.class);
1375 1356 Integer day = getTrackDay(rlevel, configs);
1376   - System.out.println("day="+day);
1377   - if (day != null)
1378   - {
1379   - System.out.println(checkTime.getTime() < DateUtil.addDay(recordModel.getNextCheckTime(),day+1).getTime());
  1357 + System.out.println("day=" + day);
  1358 + if (day != null) {
  1359 + System.out.println(checkTime.getTime() < DateUtil.addDay(recordModel.getNextCheckTime(), day + 1).getTime());
1380 1360 System.out.println(checkTime.getTime() >= recordModel.getNextCheckTime().getTime());
1381   - if (checkTime.getTime() < DateUtil.addDay(recordModel.getNextCheckTime(),day+1).getTime() && checkTime.getTime() >= recordModel.getNextCheckTime().getTime())
1382   - {
  1361 + if (checkTime.getTime() < DateUtil.addDay(recordModel.getNextCheckTime(), day + 1).getTime() && checkTime.getTime() >= recordModel.getNextCheckTime().getTime()) {
1383 1362  
1384 1363 record.setBackStatus(1);
1385 1364 Query query = Query.query(Criteria.where("_id").is(record.getId()));
1386 1365  
1387 1366  
1388 1367  
1389 1368  
1390 1369  
1391 1370  
1392 1371  
1393 1372  
1394 1373  
1395 1374  
... ... @@ -1393,82 +1372,62 @@
1393 1372 }
1394 1373 }
1395 1374  
1396   - private Integer getTrackDay(List<String> rlevel,List<Map<String,String>> configs)
1397   - {
1398   - Integer day = null;
  1375 + private Integer getTrackDay(List<String> rlevel, List<Map<String, String>> configs) {
  1376 + Integer day = null;
1399 1377 //紫色
1400   - if (rlevel.contains("224b2329-cb82-4da3-a071-8527f8283aab"))
1401   - {
1402   - day = getDay(configs,"224b2329-cb82-4da3-a071-8527f8283aab");
  1378 + if (rlevel.contains("224b2329-cb82-4da3-a071-8527f8283aab")) {
  1379 + day = getDay(configs, "224b2329-cb82-4da3-a071-8527f8283aab");
1403 1380 }
1404 1381 //
1405   - else if (rlevel.contains("eb146c03-b19f-4e28-b85f-fda574b2283b"))
1406   - {
1407   - day = getDay(configs,"eb146c03-b19f-4e28-b85f-fda574b2283b");
  1382 + else if (rlevel.contains("eb146c03-b19f-4e28-b85f-fda574b2283b")) {
  1383 + day = getDay(configs, "eb146c03-b19f-4e28-b85f-fda574b2283b");
  1384 + } else if (rlevel.contains("49a36aea-c5b6-4162-87d2-9eb3c6ec00c2")) {
  1385 + day = getDay(configs, "49a36aea-c5b6-4162-87d2-9eb3c6ec00c2");
  1386 + } else if (rlevel.contains("315107bd-91fe-42a1-9237-752f3c046a40")) {
  1387 + day = getDay(configs, "315107bd-91fe-42a1-9237-752f3c046a40");
  1388 + } else if (rlevel.contains("e637b361-99cf-41eb-84f2-f0dab596e928")) {
  1389 + day = getDay(configs, "e637b361-99cf-41eb-84f2-f0dab596e928");
1408 1390 }
1409   - else if (rlevel.contains("49a36aea-c5b6-4162-87d2-9eb3c6ec00c2"))
1410   - {
1411   - day = getDay(configs,"49a36aea-c5b6-4162-87d2-9eb3c6ec00c2");
1412   - }
1413   - else if (rlevel.contains("315107bd-91fe-42a1-9237-752f3c046a40"))
1414   - {
1415   - day = getDay(configs,"315107bd-91fe-42a1-9237-752f3c046a40");
1416   - }
1417   - else if (rlevel.contains("e637b361-99cf-41eb-84f2-f0dab596e928"))
1418   - {
1419   - day = getDay(configs,"e637b361-99cf-41eb-84f2-f0dab596e928");
1420   - }
1421 1391 return day;
1422 1392 }
1423 1393  
1424   - private Integer getDay(List<Map<String,String>> configs,String rlevel)
1425   - {
1426   - for (Map<String, String> config : configs)
1427   - {
1428   - if (config.get("riskLevel").equals(rlevel))
1429   - {
  1394 + private Integer getDay(List<Map<String, String>> configs, String rlevel) {
  1395 + for (Map<String, String> config : configs) {
  1396 + if (config.get("riskLevel").equals(rlevel)) {
1430 1397 return Integer.parseInt(config.get("day"));
1431 1398 }
1432 1399 }
1433   - return null;
  1400 + return null;
1434 1401 }
1435 1402  
1436   - public void saveCheckItem(Date nextCheckTime,Patients patients)
1437   - {
  1403 + public void saveCheckItem(Date nextCheckTime, Patients patients) {
1438 1404 List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(patients.getHospitalId())), CheckItemConfig.class);
1439   - if (CollectionUtils.isNotEmpty(itemConfigs))
1440   - {
1441   - for(CheckItemConfig checkItemConfig : itemConfigs)
1442   - {
1443   - //末次月经加一天的原因是 列表中展示的孕周是不包含末次月经那天,计算周数所以也要不包含末次月经当天
1444   - int currentWeek = DateUtil.getWeek(DateUtil.addDay(patients.getLastMenses(), 1),nextCheckTime);
1445   - if (checkItemConfig.getStartWeek() <= currentWeek && checkItemConfig.getEndWeek() >= currentWeek)
1446   - {
1447   - CheckItemOrder order = new CheckItemOrder();
1448   - order.setCreated(new Date());
1449   - order.setHospitalId(patients.getHospitalId());
1450   - order.setNextCheckTime(nextCheckTime);
1451   - order.setItemId(checkItemConfig.getId());
1452   - order.setPatientId(patients.getId());
1453   - mongoTemplate.save(order);
1454   - }
1455   - }
  1405 + if (CollectionUtils.isNotEmpty(itemConfigs)) {
  1406 + for (CheckItemConfig checkItemConfig : itemConfigs) {
  1407 + //末次月经加一天的原因是 列表中展示的孕周是不包含末次月经那天,计算周数所以也要不包含末次月经当天
  1408 + int currentWeek = DateUtil.getWeek(DateUtil.addDay(patients.getLastMenses(), 1), nextCheckTime);
  1409 + if (checkItemConfig.getStartWeek() <= currentWeek && checkItemConfig.getEndWeek() >= currentWeek) {
  1410 + CheckItemOrder order = new CheckItemOrder();
  1411 + order.setCreated(new Date());
  1412 + order.setHospitalId(patients.getHospitalId());
  1413 + order.setNextCheckTime(nextCheckTime);
  1414 + order.setItemId(checkItemConfig.getId());
  1415 + order.setPatientId(patients.getId());
  1416 + mongoTemplate.save(order);
  1417 + }
  1418 + }
1456 1419 }
1457 1420 }
1458 1421  
1459 1422  
1460   - public void saveCheckActual(Date checkTime,Patients patients)
1461   - {
  1423 + public void saveCheckActual(Date checkTime, Patients patients) {
1462 1424 List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(patients.getHospitalId())), CheckItemConfig.class);
1463   - if (CollectionUtils.isNotEmpty(itemConfigs))
1464   - {
1465   - for(CheckItemConfig checkItemConfig : itemConfigs)
1466   - {
  1425 + if (CollectionUtils.isNotEmpty(itemConfigs)) {
  1426 + for (CheckItemConfig checkItemConfig : itemConfigs) {
1467 1427 //末次月经加一天的原因是 列表中展示的孕周是不包含末次月经那天,计算周数所以也要不包含末次月经当天
1468   - int currentWeek = DateUtil.getWeek(DateUtil.addDay(patients.getLastMenses(), 1),checkTime);
1469   - if (checkItemConfig.getStartWeek() <= currentWeek && checkItemConfig.getEndWeek() >= currentWeek)
1470   - {
1471   - CheckItemActual actual = new CheckItemActual();
  1428 + int currentWeek = DateUtil.getWeek(DateUtil.addDay(patients.getLastMenses(), 1), checkTime);
  1429 + if (checkItemConfig.getStartWeek() <= currentWeek && checkItemConfig.getEndWeek() >= currentWeek) {
  1430 + CheckItemActual actual = new CheckItemActual();
1472 1431 actual.setCreated(new Date());
1473 1432 actual.setHospitalId(patients.getHospitalId());
1474 1433 actual.setCheckTime(checkTime);
... ... @@ -2579,6 +2538,7 @@
2579 2538 }
2580 2539 return new BaseObjectResponse().setData(resultMap).setErrorcode(ErrorCodeConstants.SUCCESS);
2581 2540 }
  2541 +
2582 2542 public static Date strToDateLong(String strDate) {
2583 2543 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
2584 2544 ParsePosition pos = new ParsePosition(0);
... ... @@ -2619,7 +2579,7 @@
2619 2579 return stringBuffer;
2620 2580 }
2621 2581  
2622   - public void bChaoTimerWork() {
  2582 + public void bChaoTimerWork() {
2623 2583 /*
2624 2584 需求:
2625 2585 初诊B超数据一般在初诊后两天内产生结果,要求将B超结果出来更新初诊B超数据值。
2626 2586  
2627 2587  
2628 2588  
2629 2589  
2630 2590  
2631 2591  
2632 2592  
2633 2593  
2634 2594  
2635 2595  
2636 2596  
2637 2597  
2638 2598  
2639 2599  
2640 2600  
... ... @@ -2629,96 +2589,242 @@
2629 2589 String startDate1 = getDateOther(new Date(), 2);//当前时间的前两天
2630 2590 String endDate1 = DateUtil.getyyyy_MM_dd(new Date());//当前时间
2631 2591 System.out.println("start=" + startDate1 + "end=" + endDate1);
2632   - AntExChuSync(startDate1,endDate1,true);
  2592 + AntExChuSync(startDate1, endDate1, true);
2633 2593 }
2634 2594  
  2595 + public void bChuZhengTimerWork() {
  2596 + String startDate1 = DateUtil.getyyyy_MM_dd(new Date());//当前时间
  2597 + String endDate1 = DateUtil.getyyyy_MM_dd(new Date());//当前时间
  2598 + System.out.println("start=" + startDate1 + "end=" + endDate1);
  2599 + AntExChuTongbuSync(startDate1, endDate1, true);
  2600 + }
  2601 +
2635 2602 /**
2636 2603 * 初诊B超同步接口
2637 2604 * @param startDate
2638 2605 * @param endDate
2639 2606 * @return
2640 2607 */
2641   - public BaseObjectResponse AntExChuSync(String startDate, String endDate,boolean b) {
  2608 + public BaseObjectResponse AntExChuSync(String startDate, String endDate, boolean b) {
2642 2609  
2643   - //1 获取2018-10-01 到 2019-09-10,秦皇岛说有的初证数据。
2644   - AntExChuQuery antExChuQuery = new AntExChuQuery();
2645   - antExChuQuery.setCheckTimeStart(strToDateLong(startDate));
2646   - antExChuQuery.setCheckTimeEnd(strToDateLong(endDate));
2647   - antExChuQuery.setHospitalId("216");
2648   - antExChuQuery.setYn(YnEnums.YES.getId());
2649   - List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery);
2650   - System.out.println("获取秦皇岛初诊条数:"+antExChu.size());
2651   - if (CollectionUtils.isNotEmpty(antExChu)) {
2652   - for (int i = 0; i <antExChu.size() ; i++)
2653   - try {
  2610 + //1 获取2018-10-01 到 2019-09-10,秦皇岛说有的初证数据。
  2611 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  2612 + antExChuQuery.setCheckTimeStart(strToDateLong(startDate));
  2613 + antExChuQuery.setCheckTimeEnd(strToDateLong(endDate));
  2614 + antExChuQuery.setHospitalId("216");
  2615 + antExChuQuery.setYn(YnEnums.YES.getId());
  2616 + List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery);
  2617 + System.out.println("获取秦皇岛初诊条数:" + antExChu.size());
  2618 + if (CollectionUtils.isNotEmpty(antExChu)) {
  2619 + for (int i = 0; i < antExChu.size(); i++)
  2620 + try {
2654 2621  
2655   - if (antExChu.get(i) == null || antExChu.get(i).getCheckTime() == null) {
2656   - if(b){
2657   - operateLogFacade.addModifyOptLog(null, 2160001, antExChu.get(i), antExChu.get(i), OptActionEnums.ADD.getId(), "初诊产检日期为空");
2658   - }
2659   - continue;
  2622 + if (antExChu.get(i) == null || antExChu.get(i).getCheckTime() == null) {
  2623 + if (b) {
  2624 + operateLogFacade.addModifyOptLog(null, 2160001, antExChu.get(i), antExChu.get(i), OptActionEnums.ADD.getId(), "初诊产检日期为空");
2660 2625 }
2661   - Date checkTime = antExChu.get(i).getCheckTime();//产检日期
2662   - if(checkTime.equals(null) || checkTime==null ){
2663   - checkTime = antExChu.get(i).getCreated();//初诊创建时间
  2626 + continue;
  2627 + }
  2628 + Date checkTime = antExChu.get(i).getCheckTime();//产检日期
  2629 + if (checkTime.equals(null) || checkTime == null) {
  2630 + checkTime = antExChu.get(i).getCreated();//初诊创建时间
  2631 + }
  2632 + //2 遍历初证数据,获取单个初诊数据的初证日期,根据初证日志调用接口 获取B超检查结果。更新初证B超数据。
  2633 + Patients patients = iPatientDao.getPatient(antExChu.get(i).getParentId());
  2634 + if (patients == null || patients.getVcCardNo() == null) {
  2635 + if (b) {
  2636 + operateLogFacade.addModifyOptLog(null, 2160002, patients, patients.getVcCardNo(), OptActionEnums.ADD.getId(), "就诊卡号为空");
2664 2637 }
2665   - //2 遍历初证数据,获取单个初诊数据的初证日期,根据初证日志调用接口 获取B超检查结果。更新初证B超数据。
2666   - Patients patients = iPatientDao.getPatient(antExChu.get(i).getParentId());
2667   - if (patients == null || patients.getVcCardNo() == null) {
2668   - if(b){
2669   - operateLogFacade.addModifyOptLog(null, 2160002, patients, patients.getVcCardNo(), OptActionEnums.ADD.getId(), "就诊卡号为空");
2670   - }
2671   - continue;
2672   - }
2673   - String s = null;
2674   - String vcCardNo = patients.getVcCardNo();
2675   - Map<String, String> map = new HashMap<String, String>();
  2638 + continue;
  2639 + }
  2640 + String s = null;
  2641 + String vcCardNo = patients.getVcCardNo();
  2642 + Map<String, String> map = new HashMap<String, String>();
2676 2643  
2677   - String startDate1 = DateUtil.getyyyy_MM_dd(checkTime);
2678   - String endDate1 = getDateAfter(checkTime, 2);
2679   - map.put("vcCardNo", vcCardNo);
2680   - map.put("startDate", startDate1);
2681   - map.put("endDate", endDate1);
2682   - s = HttpClientUtil.doGet("http://localhost:9090/lis/qhdris", map, "utf-8", null);
2683   - System.out.println("获取B超信息:" + s);
2684   - if (("[]"==s || "[]".equals(s)) || StringUtils.isEmpty(s)) {
2685   - if(b){
2686   - operateLogFacade.addModifyOptLog(null, 2160003, map, s, OptActionEnums.ADD.getId(), "获取B超信息失败或为空");
2687   - }
2688   - continue;
  2644 + String startDate1 = DateUtil.getyyyy_MM_dd(checkTime);
  2645 + String endDate1 = getDateAfter(checkTime, 2);
  2646 + map.put("vcCardNo", vcCardNo);
  2647 + map.put("startDate", startDate1);
  2648 + map.put("endDate", endDate1);
  2649 + s = HttpClientUtil.doGet("http://localhost:9090/lis/qhdris", map, "utf-8", null);
  2650 + System.out.println("获取B超信息:" + s);
  2651 + if (("[]" == s || "[]".equals(s)) || StringUtils.isEmpty(s)) {
  2652 + if (b) {
  2653 + operateLogFacade.addModifyOptLog(null, 2160003, map, s, OptActionEnums.ADD.getId(), "获取B超信息失败或为空");
2689 2654 }
2690   - if(StringUtils.isEmpty(antExChu.get(i).getbChao())){
2691   - AntExChuModel antExChuModel = antExChu.get(i);
2692   - antExChuModel.setbChao(getStrings(s).toString());
2693   - iAntExChuDao.updateOneAntEx(antExChu.get(i), antExChu.get(i).getId());
2694   - if(b){
2695   - operateLogFacade.addModifyOptLog(null, 2160004, null, antExChuModel, OptActionEnums.ADD.getId(), "初诊更新B超成功");
2696   - }
2697   - }else if(b){
2698   - operateLogFacade.addModifyOptLog(null, 2160005, null, antExChu.get(i), OptActionEnums.ADD.getId(), "无需更新B超信息");
  2655 + continue;
  2656 + }
  2657 + if (StringUtils.isEmpty(antExChu.get(i).getbChao())) {
  2658 + AntExChuModel antExChuModel = antExChu.get(i);
  2659 + antExChuModel.setbChao(getStrings(s).toString());
  2660 + iAntExChuDao.updateOneAntEx(antExChuModel, antExChu.get(i).getId());
  2661 + if (b) {
  2662 + operateLogFacade.addModifyOptLog(null, 2160004, null, antExChuModel, OptActionEnums.ADD.getId(), "初诊更新B超成功");
2699 2663 }
2700   -
2701   - } catch (Exception e) {
2702   - e.printStackTrace();
2703   - if(b){
2704   - operateLogFacade.addModifyOptLog(null, 2160006, null, antExChu.get(i), OptActionEnums.ADD.getId(), "初诊B超同步接口异常");
2705   - }
2706   - return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION);
  2664 + } else if (b) {
  2665 + operateLogFacade.addModifyOptLog(null, 2160005, null, antExChu.get(i), OptActionEnums.ADD.getId(), "无需更新B超信息");
2707 2666 }
2708 2667  
2709   - }else {
2710   - if(b){
2711   - operateLogFacade.addModifyOptLog(null, 2160007, startDate, endDate, OptActionEnums.ADD.getId(), "初诊数据为空");
  2668 + } catch (Exception e) {
  2669 + e.printStackTrace();
  2670 + if (b) {
  2671 + operateLogFacade.addModifyOptLog(null, 2160006, null, antExChu.get(i), OptActionEnums.ADD.getId(), "初诊B超同步接口异常");
  2672 + }
  2673 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION);
2712 2674 }
2713   - return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("获取"+startDate+" 到 "+endDate+",秦皇岛的初诊数据条数:"+antExChu.size());
  2675 +
  2676 + } else {
  2677 + if (b) {
  2678 + operateLogFacade.addModifyOptLog(null, 2160007, startDate, endDate, OptActionEnums.ADD.getId(), "初诊数据为空");
2714 2679 }
  2680 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("获取" + startDate + " 到 " + endDate + ",秦皇岛的初诊数据条数:" + antExChu.size());
  2681 + }
2715 2682  
2716 2683 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
2717 2684 }
2718 2685  
2719 2686  
  2687 + public BaseObjectResponse AntExChuTongbuSync(String startDate, String endDate, boolean b) {
  2688 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  2689 + antExChuQuery.setCheckTimeStart(strToDateLong(startDate));
  2690 + antExChuQuery.setCheckTimeEnd(DateUtil.getDayLastSecond(strToDateLong(endDate)));
  2691 + antExChuQuery.setHospitalId("216");
  2692 + antExChuQuery.setYn(YnEnums.YES.getId());
  2693 + List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery);
  2694 + System.out.println("获取秦皇岛初诊条数:" + antExChu.size());
  2695 + if (CollectionUtils.isNotEmpty(antExChu)) {
  2696 + for (int i = 0; i < antExChu.size(); i++) {
  2697 + try {
  2698 + AntExChuModel antExChuModel = antExChu.get(i);
2720 2699  
  2700 + Patients patients = iPatientDao.getPatient(antExChuModel.getParentId());
  2701 + if (patients == null || patients.getVcCardNo() == null || patients.getCardNo() == null || patients.getUsername() == null || patients.getPhone() == null) {
  2702 + continue;
  2703 + }
  2704 + String s = null;
  2705 + Map<String, String> map = new HashMap<String, String>();
  2706 + map.put("vcCardNo", patients.getVcCardNo());
  2707 + map.put("cardNo", patients.getCardNo());
  2708 + map.put("name", patients.getUsername());
  2709 + map.put("phone", patients.getPhone());
  2710 + s = HttpClientUtil.doGet("http://localhost:9090/his/qhdToChuzheng", map, "utf-8", null);
  2711 + System.out.println("获取初诊信息信息:" + s);
  2712 + if(StringUtils.isEmpty(s)){
  2713 + continue;
  2714 + }
  2715 + Gson gson = new Gson();
  2716 + Map<String, String> maps = new HashMap<String, String>();
  2717 + maps = gson.fromJson(s, maps.getClass());
  2718 + if (StringUtils.isEmpty(antExChu.get(i).getXhdb())) {
  2719 + antExChuModel.setXhdb(maps.get("xhdb"));
  2720 + }
  2721 + if (StringUtils.isEmpty(antExChu.get(i).getBxbjs())) {
  2722 + antExChuModel.setBxbjs(maps.get("bxbjs"));
  2723 + }
  2724 + if (StringUtils.isEmpty(antExChu.get(i).getPlatelet())) {
  2725 + antExChuModel.setPlatelet(maps.get("xxbjs"));
  2726 + }
  2727 + if (StringUtils.isEmpty(antExChu.get(i).getNdb())) {//尿蛋白
  2728 + antExChuModel.setNdb(maps.get("ndb"));
  2729 + }
  2730 + if (StringUtils.isEmpty(antExChu.get(i).getUrineKetone())) {//尿酮体
  2731 + antExChuModel.setUrineKetone(maps.get("nt"));
  2732 + }
  2733 + if (StringUtils.isEmpty(antExChu.get(i).getBld())) {//尿潜血
  2734 + antExChuModel.setBld(maps.get("nqx"));
  2735 + }
  2736 + if (StringUtils.isEmpty(antExChu.get(i).getNt())) {//尿糖
  2737 + antExChuModel.setNt(maps.get("nt"));
  2738 + }
  2739 + if (StringUtils.isEmpty(antExChu.get(i).getAbo())) {//血型
  2740 + antExChuModel.setAbo(maps.get("xx"));
  2741 + }
  2742 + if (StringUtils.isEmpty(antExChu.get(i).getRh())) {//RH血型
  2743 + antExChuModel.setRh(maps.get("rhxx"));
  2744 + }
  2745 + if (StringUtils.isEmpty(antExChu.get(i).getBloodSugar())) {//血糖
  2746 + antExChuModel.setBloodSugar(maps.get("xt"));
  2747 + }
  2748 + if (StringUtils.isEmpty(antExChu.get(i).getXqgbzam())) {//血清谷丙转氨酶
  2749 + antExChuModel.setXqgbzam(maps.get("xqgbzam"));
  2750 + }
  2751 + if (StringUtils.isEmpty(antExChu.get(i).getXqgczam())) {//血清谷草转氨酶
  2752 + antExChuModel.setXqgczam(maps.get("xqgczam"));
  2753 + }
  2754 + if (StringUtils.isEmpty(antExChu.get(i).getAlbumin())) {//白蛋白
  2755 + antExChuModel.setAlbumin(maps.get("bdb"));
  2756 + }
  2757 + if (StringUtils.isEmpty(antExChu.get(i).getTotalBilirubin())) {//总胆红素
  2758 + antExChuModel.setTotalBilirubin(maps.get("zdhs"));
  2759 + }
  2760 + if (StringUtils.isEmpty(antExChu.get(i).getJhBilirubin())) {//直接胆红素
  2761 + antExChuModel.setJhBilirubin(maps.get("zjdhs"));
  2762 + }
  2763 + if (StringUtils.isEmpty(antExChu.get(i).getBg())) {//丙肝
  2764 + antExChuModel.setBg(maps.get("bg"));
  2765 + }
  2766 + if (StringUtils.isEmpty(antExChu.get(i).getYgbmky())) {//乙肝表面抗原
  2767 + antExChuModel.setYgbmky(maps.get("ygbmky"));
  2768 + }
  2769 + if (StringUtils.isEmpty(antExChuModel.getYgbmkyValue())) {
  2770 + antExChuModel.setYgbmkyValue(maps.get("ygbmkyValue"));
  2771 + }
  2772 + if (StringUtils.isEmpty(antExChu.get(i).getYgbmkt())) {//乙肝表面抗体
  2773 + antExChuModel.setYgbmkt(maps.get("ygbmkt"));
  2774 + }
  2775 + if (StringUtils.isEmpty(antExChuModel.getYgbmktValue())) {
  2776 + antExChuModel.setYgbmktValue(maps.get("ygbmktValue"));
  2777 + }
  2778 + if (StringUtils.isEmpty(antExChu.get(i).getYgeky())) {//乙肝E抗原
  2779 + antExChuModel.setYgeky(maps.get("ygeky"));
  2780 + }
  2781 + if (StringUtils.isEmpty(antExChuModel.getYgekyValue())) {
  2782 + antExChuModel.setYgekyValue(maps.get("ygekyValue"));
  2783 + }
  2784 + if (StringUtils.isEmpty(antExChu.get(i).getYgekt())) {//乙肝E抗体
  2785 + antExChuModel.setYgekt(maps.get("ygekt"));
  2786 + }
  2787 + if (StringUtils.isEmpty(antExChuModel.getYgektValue())) {
  2788 + antExChuModel.setYgektValue(maps.get("ygektValue"));
  2789 + }
  2790 + if (StringUtils.isEmpty(antExChu.get(i).getYghxkt())) {//乙肝核心抗体
  2791 + antExChuModel.setYghxkt(maps.get("yghxkt"));
  2792 + }
  2793 + if (StringUtils.isEmpty(antExChuModel.getYghxktValue())) {
  2794 + antExChuModel.setYghxktValue(maps.get("yghxktValue"));
  2795 + }
  2796 + if (StringUtils.isEmpty(antExChu.get(i).getXqjq())) {//血清肌酐
  2797 + antExChuModel.setXqjq(maps.get("xqjg"));
  2798 + }
  2799 + if (StringUtils.isEmpty(antExChu.get(i).getXnsd())) {//血尿素氮
  2800 + antExChuModel.setXnsd(maps.get("xnsd"));
  2801 + }
  2802 + if (StringUtils.isEmpty(antExChu.get(i).getSyjg())) {//梅毒
  2803 + antExChuModel.setSyjg(maps.get("md"));
  2804 + }
  2805 + if (StringUtils.isEmpty(antExChuModel.getSyjgValue())) {
  2806 + antExChuModel.setSyjgValue(maps.get("mdValue"));
  2807 + }
  2808 + if (StringUtils.isEmpty(antExChu.get(i).getHivkt())) {//HIV抗体
  2809 + antExChuModel.setHivkt(maps.get("hivkt"));
  2810 + }
  2811 + if (StringUtils.isEmpty(antExChuModel.getHivktValue())) {
  2812 + antExChuModel.setHivktValue(maps.get("hivktValue"));
  2813 + }
  2814 + if (StringUtils.isEmpty(antExChu.get(i).getYdqjd())) {//阴道清洁度
  2815 + antExChuModel.setYdqjd(maps.get("ydqjd"));
  2816 + }
  2817 + iAntExChuDao.updateOneAntEx(antExChuModel, antExChu.get(i).getId());
  2818 + } catch (Exception e) {
  2819 + e.printStackTrace();
  2820 + }
  2821 + }
  2822 + }
2721 2823  
  2824 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  2825 + }
  2826 +
  2827 +
2722 2828 public class SortIn {
2723 2829  
2724 2830 public SortIn(Patients patients) {
... ... @@ -3061,7 +3167,7 @@
3061 3167  
3062 3168 if (StringUtils.isNotEmpty(vcCardNo)) {
3063 3169 //德州市妇幼保健院医院通过(就诊卡号、银行卡号,社保卡号) 查询出对应的用过的卡号 add lqy
3064   - if (CollectionUtils.isNotEmpty(hospitalId) && hospitalId.contains("1000000114")) {
  3170 + if (CollectionUtils.isNotEmpty(hospitalId) && hospitalId.contains("1000000114")) {
3065 3171 patientsQuery.setVcCardNos(dzfyHisService.getDzVcCardNos(vcCardNo));
3066 3172 } else {
3067 3173 patientsQuery.setVcCardNo(vcCardNo);
3068 3174  
3069 3175  
3070 3176  
3071 3177  
3072 3178  
... ... @@ -4250,31 +4356,30 @@
4250 4356 }
4251 4357  
4252 4358  
4253   - public void autoPatientRisk(Patients pat,Integer userId)
4254   - {
  4359 + public void autoPatientRisk(Patients pat, Integer userId) {
4255 4360 AutoRiskRequest autoRiskRequest = new AutoRiskRequest();
4256 4361 autoRiskRequest.setParentId(pat.getId());
4257   - List<Map<String, String>> riskList = autoRisk(autoRiskRequest, pat.getHospitalId(),0);
4258   - saveAutoRisk(riskList,null,pat.getHospitalId(),pat.getPid(),pat.getId(),0);
  4362 + List<Map<String, String>> riskList = autoRisk(autoRiskRequest, pat.getHospitalId(), 0);
  4363 + saveAutoRisk(riskList, null, pat.getHospitalId(), pat.getPid(), pat.getId(), 0);
4259 4364 }
4260 4365  
4261 4366  
4262 4367 /**
4263 4368 * 初诊自动诊断高危
  4369 + *
4264 4370 * @param antExcAddRequest
4265 4371 * @param pat
4266 4372 */
4267   - public void autoExcRisk(final AntExcAddRequest antExcAddRequest,final Patients pat)
4268   - {
  4373 + public void autoExcRisk(final AntExcAddRequest antExcAddRequest, final Patients pat) {
4269 4374 commonThreadPool.execute(new Runnable() {
4270 4375 @Override
4271 4376 public void run() {
4272   - AutoRiskRequest autoRiskRequest = new AutoRiskRequest();
  4377 + AutoRiskRequest autoRiskRequest = new AutoRiskRequest();
4273 4378 org.springframework.beans.BeanUtils.copyProperties(antExcAddRequest, autoRiskRequest);
4274 4379 String fid = antExcAddRequest.getId();
4275   - System.out.println("autoExcRisk fid = "+fid);
4276   - List<Map<String, String>> riskList = autoRisk(autoRiskRequest, pat.getHospitalId(),1);
4277   - saveAutoRisk(riskList,fid,pat.getHospitalId(),pat.getPid(),pat.getId(),1);
  4380 + System.out.println("autoExcRisk fid = " + fid);
  4381 + List<Map<String, String>> riskList = autoRisk(autoRiskRequest, pat.getHospitalId(), 1);
  4382 + saveAutoRisk(riskList, fid, pat.getHospitalId(), pat.getPid(), pat.getId(), 1);
4278 4383 }
4279 4384 });
4280 4385 }
4281 4386  
4282 4387  
4283 4388  
... ... @@ -4282,15 +4387,15 @@
4282 4387  
4283 4388 /**
4284 4389 * 复诊自动诊断高危
  4390 + *
4285 4391 * @param antExAddRequest
4286   - * @param pat 档案信息
  4392 + * @param pat 档案信息
4287 4393 */
4288   - public void autoExRisk(final AntExAddRequest antExAddRequest,final Patients pat)
4289   - {
  4394 + public void autoExRisk(final AntExAddRequest antExAddRequest, final Patients pat) {
4290 4395 commonThreadPool.execute(new Runnable() {
4291 4396 @Override
4292 4397 public void run() {
4293   - AutoRiskRequest autoRiskRequest = new AutoRiskRequest();
  4398 + AutoRiskRequest autoRiskRequest = new AutoRiskRequest();
4294 4399  
4295 4400 autoRiskRequest.setBp(antExAddRequest.getBp());
4296 4401 autoRiskRequest.setGonggao(antExAddRequest.getGongGao());
4297 4402  
4298 4403  
4299 4404  
4300 4405  
4301 4406  
4302 4407  
4303 4408  
4304 4409  
4305 4410  
4306 4411  
4307 4412  
4308 4413  
... ... @@ -4305,101 +4410,95 @@
4305 4410 autoRiskRequest.setBloodSugar(antExAddRequest.getBloodSugar());
4306 4411  
4307 4412 String fid = antExAddRequest.getId();
4308   - System.out.println("autoExRisk fid = "+fid);
4309   - List<Map<String, String>> riskList = autoRisk(autoRiskRequest, pat.getHospitalId(),2);
4310   - saveAutoRisk(riskList,fid,pat.getHospitalId(),pat.getPid(),pat.getId(),2);
  4413 + System.out.println("autoExRisk fid = " + fid);
  4414 + List<Map<String, String>> riskList = autoRisk(autoRiskRequest, pat.getHospitalId(), 2);
  4415 + saveAutoRisk(riskList, fid, pat.getHospitalId(), pat.getPid(), pat.getId(), 2);
4311 4416 }
4312 4417 });
4313 4418  
4314 4419 }
4315 4420  
4316 4421 /**
4317   - *
4318   - * @param risks 高危因素
4319   - * @param fid 产检id(初诊、复诊)
  4422 + * @param risks 高危因素
  4423 + * @param fid 产检id(初诊、复诊)
4320 4424 * @param hospitalId 医院id
4321 4425 * @param pid
4322 4426 * @param patientId
4323   - * @param type 0 建档诊断 1产检诊断
  4427 + * @param type 0 建档诊断 1产检诊断
4324 4428 */
4325   - private void saveAutoRisk(List<Map<String, String>> risks,String fid,String hospitalId,String pid,String patientId,Integer type)
4326   - {
4327   - if (CollectionUtils.isNotEmpty(risks))
4328   - {
4329   - List rLevel = new ArrayList();
4330   - List hRisk = new ArrayList();
4331   - Integer score = 0;
4332   - for(Map<String, String> risk : risks)
4333   - {
4334   - rLevel.add(risk.get("riskLevel"));
4335   - hRisk.add(risk.get("id"));
4336   - score+= StringUtils.isNotEmpty(risk.get("code")) ? Integer.parseInt(risk.get("code")) : 0;
4337   - }
  4429 + private void saveAutoRisk(List<Map<String, String>> risks, String fid, String hospitalId, String pid, String patientId, Integer type) {
  4430 + if (CollectionUtils.isNotEmpty(risks)) {
  4431 + List rLevel = new ArrayList();
  4432 + List hRisk = new ArrayList();
  4433 + Integer score = 0;
  4434 + for (Map<String, String> risk : risks) {
  4435 + rLevel.add(risk.get("riskLevel"));
  4436 + hRisk.add(risk.get("id"));
  4437 + score += StringUtils.isNotEmpty(risk.get("code")) ? Integer.parseInt(risk.get("code")) : 0;
  4438 + }
4338 4439  
4339   - if (StringUtils.isNotEmpty(fid))
4340   - {
4341   - Query query = new Query();
4342   - query.addCriteria(Criteria.where("fid").is(fid));
4343   - AutoRiskRecord autoRisk = mongoTemplate.findOne(query, AutoRiskRecord.class);
4344   - if (autoRisk != null)
4345   - {
4346   - return;
4347   - }
4348   - }
4349   - AutoRiskRecord riskRecord = new AutoRiskRecord();
4350   - riskRecord.setPatientId(patientId);
4351   - riskRecord.setFid(fid);
4352   - riskRecord.setPid(pid);
4353   - riskRecord.setHospitalId(hospitalId);
4354   - riskRecord.setStatus(0);
4355   - riskRecord.setType(type);
4356   - riskRecord.sethRisk(hRisk);
4357   - riskRecord.sethLevel(rLevel);
4358   - riskRecord.sethScore(score);
4359   - riskRecord.setCreated(new Date());
4360   - riskRecord.setModified(new Date());
4361   - mongoTemplate.save(riskRecord);
  4440 + if (StringUtils.isNotEmpty(fid)) {
  4441 + Query query = new Query();
  4442 + query.addCriteria(Criteria.where("fid").is(fid));
  4443 + AutoRiskRecord autoRisk = mongoTemplate.findOne(query, AutoRiskRecord.class);
  4444 + if (autoRisk != null) {
  4445 + return;
  4446 + }
  4447 + }
  4448 + AutoRiskRecord riskRecord = new AutoRiskRecord();
  4449 + riskRecord.setPatientId(patientId);
  4450 + riskRecord.setFid(fid);
  4451 + riskRecord.setPid(pid);
  4452 + riskRecord.setHospitalId(hospitalId);
  4453 + riskRecord.setStatus(0);
  4454 + riskRecord.setType(type);
  4455 + riskRecord.sethRisk(hRisk);
  4456 + riskRecord.sethLevel(rLevel);
  4457 + riskRecord.sethScore(score);
  4458 + riskRecord.setCreated(new Date());
  4459 + riskRecord.setModified(new Date());
  4460 + mongoTemplate.save(riskRecord);
4362 4461  
4363   - }
  4462 + }
4364 4463  
4365 4464 }
4366 4465  
4367 4466  
4368 4467 /**
4369   - *
4370 4468 * 由初诊页面调用该方法
4371 4469 * 初诊自动判定高危因素
  4470 + *
4372 4471 * @param antExcAddRequest
4373 4472 * @param userId
4374 4473 * @return
4375 4474 */
4376 4475 public BaseResponse getAntexExRisk(AutoRiskRequest antExcAddRequest, Integer userId) {
4377 4476 String hospitalId = autoMatchFacade.getHospitalId(userId);
4378   - List<Map<String, String>> riskList = autoRisk(antExcAddRequest,hospitalId,1);
  4477 + List<Map<String, String>> riskList = autoRisk(antExcAddRequest, hospitalId, 1);
4379 4478  
4380 4479 return new BaseObjectResponse().setData(riskList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
4381 4480 }
4382 4481  
4383 4482 /**
4384 4483 * 自动判定高危因素
  4484 + *
4385 4485 * @param antExcAddRequest
4386 4486 * @param hospitalId
4387 4487 * @return
4388 4488 */
4389   - private List<Map<String, String>> autoRisk(AutoRiskRequest antExcAddRequest,String hospitalId,Integer type)
4390   - {
  4489 + private List<Map<String, String>> autoRisk(AutoRiskRequest antExcAddRequest, String hospitalId, Integer type) {
4391 4490 Set<String> list = new HashSet<>();
4392 4491  
4393 4492 DiagnoseConfigQuery diagnoseConfigQuery = new DiagnoseConfigQuery();
4394 4493 diagnoseConfigQuery.setHospitalId(hospitalId);
4395 4494 List<DiagnoseConfigModel> configModels = diagnoseConfigService.queryDiagnoseConfigs(diagnoseConfigQuery);
4396   - System.out.println("configModels"+configModels);
  4495 + System.out.println("configModels" + configModels);
4397 4496 List<Map<String, String>> riskList = new ArrayList<>();
4398 4497  
4399 4498 Map<String, String> status = new HashMap<>();
4400 4499 if (CollectionUtils.isNotEmpty(configModels)) {
4401 4500 DiagnoseConfigModel model = configModels.get(0);
4402   - System.out.println("model"+model);
  4501 + System.out.println("model" + model);
4403 4502 List<Map<String, String>> configs = model.getConfigs();
4404 4503  
4405 4504 if (model == null || "0".equals(model.getEnable()) || configs == null || configs.size() == 0) {
... ... @@ -4412,7 +4511,7 @@
4412 4511 }
4413 4512 }
4414 4513 Map<Integer, List<DiagnoseItemModel>> mapItems = getRiskConfig(configModels);
4415   - System.out.println("mapItems"+mapItems);
  4514 + System.out.println("mapItems" + mapItems);
4416 4515 if (mapItems != null && mapItems.size() > 0) {
4417 4516 if (isEnableItem(status, DiagnoseEnums.DiagnoseItemEnums.age.getId()) && type == 0) {
4418 4517 Patients patients = patientsService.findOnePatientById(antExcAddRequest.getParentId());
... ... @@ -5506,7 +5605,7 @@
5506 5605 }
5507 5606 riskList = diagnoseConfigFacde.getRiskName(ids);
5508 5607 }
5509   - return riskList;
  5608 + return riskList;
5510 5609 }
5511 5610  
5512 5611  
5513 5612  
... ... @@ -5613,15 +5712,11 @@
5613 5712 if (StringUtils.isNotEmpty(antExManagerQueryRequest.getQueryNo())) {
5614 5713 patientsQuery.setQueryNo(antExManagerQueryRequest.getQueryNo());
5615 5714 patientses = patientsService.queryPatient1(patientsQuery, "created");
5616   - if (CollectionUtils.isEmpty(patientses))
5617   - {
5618   - return new BaseListResponse().setData(riskList).
  5715 + if (CollectionUtils.isEmpty(patientses)) {
  5716 + return new BaseListResponse().setData(riskList).
5619 5717 setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(baseQuery.getPageInfo());
5620   - }
5621   - else
5622   - {
5623   - for (Patients pat : patientses)
5624   - {
  5718 + } else {
  5719 + for (Patients pat : patientses) {
5625 5720 patientIds.add(pat.getId());
5626 5721 }
5627 5722 }
5628 5723  
5629 5724  
5630 5725  
5631 5726  
5632 5727  
... ... @@ -5655,34 +5750,32 @@
5655 5750 baseQuery.setPage(antExManagerQueryRequest.getPage());
5656 5751 baseQuery.setLimit(antExManagerQueryRequest.getLimit());
5657 5752 baseQuery.mysqlBuild((int) count);
5658   - System.out.println(baseQuery.getOffset()+" "+antExManagerQueryRequest.getLimit());
  5753 + System.out.println(baseQuery.getOffset() + " " + antExManagerQueryRequest.getLimit());
5659 5754 query.skip(baseQuery.getOffset()).limit(antExManagerQueryRequest.getLimit());
5660 5755  
5661 5756 System.out.println(query.toString());
5662 5757 List<AutoRiskRecord> models = mongoTemplate.find(query.with(new Sort(Sort.Direction.DESC, "created")), AutoRiskRecord.class);
5663   - if (CollectionUtils.isNotEmpty(models))
5664   - {
5665   - for(AutoRiskRecord model : models)
5666   - {
  5758 + if (CollectionUtils.isNotEmpty(models)) {
  5759 + for (AutoRiskRecord model : models) {
5667 5760 Map map = new HashMap();
5668   - map.put("id",model.getId());
  5761 + map.put("id", model.getId());
5669 5762  
5670 5763 Patients pat = patientsService.findOnePatientById(model.getPatientId());
5671   - map.put("name",pat.getUsername());
5672   - map.put("cardNo",pat.getCardNo());
5673   - map.put("phone",pat.getPhone());
5674   - map.put("autoTime",DateUtil.getyyyy_MM_dd(model.getCreated()));
5675   - map.put("week",DateUtil.getWeekDesc(pat.getLastMenses(), model.getCreated()));
5676   - map.put("riskLevel",commonService.findRiskLevel(model.gethLevel()));
  5764 + map.put("name", pat.getUsername());
  5765 + map.put("cardNo", pat.getCardNo());
  5766 + map.put("phone", pat.getPhone());
  5767 + map.put("autoTime", DateUtil.getyyyy_MM_dd(model.getCreated()));
  5768 + map.put("week", DateUtil.getWeekDesc(pat.getLastMenses(), model.getCreated()));
  5769 + map.put("riskLevel", commonService.findRiskLevel(model.gethLevel()));
5677 5770 String risk = commonService.resloveFactor(model.gethRisk());
5678 5771  
5679   - map.put("risk",risk);
5680   - map.put("score",model.gethScore());
5681   - map.put("status",model.getStatus() == 0 ? "未确诊" : "已确诊");
  5772 + map.put("risk", risk);
  5773 + map.put("score", model.gethScore());
  5774 + map.put("status", model.getStatus() == 0 ? "未确诊" : "已确诊");
5682 5775 riskList.add(map);
5683 5776 }
5684 5777 }
5685   - return new BaseListResponse().setData(riskList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(baseQuery.getPageInfo());
  5778 + return new BaseListResponse().setData(riskList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(baseQuery.getPageInfo());
5686 5779 }
5687 5780  
5688 5781 public BaseResponse getAutoRiskCount(Integer userId) {
... ... @@ -5691,7 +5784,7 @@
5691 5784 query.addCriteria(Criteria.where("hospitalId").is(hospitalId));
5692 5785 query.addCriteria(Criteria.where("status").is(0));
5693 5786 long count = mongoTemplate.count(query.with(new Sort(Sort.Direction.DESC, "created")), AutoRiskRecord.class);
5694   - return new BaseObjectResponse().setData(count).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  5787 + return new BaseObjectResponse().setData(count).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
5695 5788 }
5696 5789  
5697 5790  
... ... @@ -5699,8 +5792,7 @@
5699 5792 Query query = new Query();
5700 5793 query.addCriteria(Criteria.where("_id").is(id));
5701 5794 AutoRiskRecord autoRisk = mongoTemplate.findOne(query, AutoRiskRecord.class);
5702   - if (autoRisk != null)
5703   - {
  5795 + if (autoRisk != null) {
5704 5796 if (autoRisk.getType() == 0) {
5705 5797 AntExChuQuery antExChuQuery = new AntExChuQuery();
5706 5798 antExChuQuery.setYn(YnEnums.YES.getId());
... ... @@ -5716,8 +5808,7 @@
5716 5808 } catch (Exception e) {
5717 5809 }
5718 5810 List<String> riskList = new ArrayList<>(autoRisk.gethRisk());
5719   - if (CollectionUtils.isNotEmpty(li))
5720   - {
  5811 + if (CollectionUtils.isNotEmpty(li)) {
5721 5812 riskList.addAll(li);
5722 5813 }
5723 5814  
... ... @@ -5725,9 +5816,7 @@
5725 5816 excAddRequest.setParentId(autoRisk.getPatientId());
5726 5817 addOneAnetExChu(excAddRequest, userId);
5727 5818 }
5728   - }
5729   - else if (autoRisk.getType() == 1)
5730   - {
  5819 + } else if (autoRisk.getType() == 1) {
5731 5820 AntExChuQuery antExChuQuery = new AntExChuQuery();
5732 5821 antExChuQuery.setYn(YnEnums.YES.getId());
5733 5822 antExChuQuery.setId(autoRisk.getFid());
5734 5823  
5735 5824  
... ... @@ -5742,23 +5831,19 @@
5742 5831 } catch (Exception e) {
5743 5832 }
5744 5833 List<String> riskList = autoRisk.gethRisk();
5745   - if (CollectionUtils.isNotEmpty(li))
5746   - {
  5834 + if (CollectionUtils.isNotEmpty(li)) {
5747 5835 riskList.addAll(li);
5748 5836 }
5749 5837 excAddRequest.setHighrisk(riskList);
5750 5838 excAddRequest.setParentId(autoRisk.getPatientId());
5751 5839 addOneAnetExChu(excAddRequest, userId);
5752 5840 }
5753   - }
5754   - else if (autoRisk.getType() == 2)
5755   - {
  5841 + } else if (autoRisk.getType() == 2) {
5756 5842 AntExQuery antExQuery = new AntExQuery();
5757 5843 antExQuery.setId(autoRisk.getFid());
5758 5844 antExQuery.setYn(YnEnums.YES.getId());
5759 5845 List<AntenatalExaminationModel> examinationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.ASC, "created"));
5760   - if (CollectionUtils.isNotEmpty(examinationModelList))
5761   - {
  5846 + if (CollectionUtils.isNotEmpty(examinationModelList)) {
5762 5847 AntenatalExaminationModel model = examinationModelList.get(0);
5763 5848 AntExAddRequest excAddRequest = new AntExAddRequest();
5764 5849 excAddRequest.setId(model.getId());
5765 5850  
... ... @@ -5768,13 +5853,12 @@
5768 5853 } catch (Exception e) {
5769 5854 }
5770 5855 List<String> riskList = autoRisk.gethRisk();
5771   - if (CollectionUtils.isNotEmpty(li))
5772   - {
  5856 + if (CollectionUtils.isNotEmpty(li)) {
5773 5857 riskList.addAll(li);
5774 5858 }
5775 5859 excAddRequest.setRiskFactor(riskList);
5776 5860 excAddRequest.setParentId(autoRisk.getPatientId());
5777   - addOneAntEx(excAddRequest,userId);
  5861 + addOneAntEx(excAddRequest, userId);
5778 5862 }
5779 5863 }
5780 5864 Query updateQuery = Query.query(Criteria.where("_id").is(autoRisk.getId()));
... ... @@ -5783,7 +5867,7 @@
5783 5867 .convertToNativeUpdate(ReflectionUtils.getUpdateField(autoRisk));
5784 5868 mongoTemplate.updateFirst(updateQuery, update, AutoRiskRecord.class);
5785 5869 }
5786   - return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  5870 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
5787 5871 }
5788 5872 }
platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml View file @ c3f9f32
... ... @@ -115,6 +115,18 @@
115 115 <!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 -->
116 116 <property name="concurrent" value="false"></property>
117 117 </bean>
  118 +
  119 + <!-- 秦皇岛医院自动更新初诊数据-->
  120 + <bean id="qhdChuZhengTimerWork" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
  121 + <!-- 要调用的bean -->
  122 + <property name="targetObject" ref="antenatalExaminationFacade"></property>
  123 + <!-- 要调用的Method -->
  124 + <property name="targetMethod" value="bChuZhengTimerWork"></property>
  125 + <!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 -->
  126 + <property name="concurrent" value="false"></property>
  127 + </bean>
  128 +
  129 +
118 130 <!-- 秦皇岛医院分娩接口-->
119 131 <bean id="qhdFmTimerWork" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
120 132 <!-- 要调用的bean -->
... ... @@ -195,6 +207,12 @@
195 207 <property name="jobDetail" ref="qhdBchaoTimerWork"></property>
196 208 <property name="cronExpression" value="0 0 22 * * ?"></property>
197 209 </bean>
  210 + <!-- 配置一个触发器 0 0 0/1 * * ?-->
  211 + <bean id="qhdChuZhengTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
  212 + <property name="jobDetail" ref="qhdChuZhengTimerWork"></property>
  213 + <property name="cronExpression" value="0 0 0/1 * * ? "></property>
  214 + <!--<property name="cronExpression" value="0/5 * * * * ? "></property>-->
  215 + </bean>
198 216  
199 217 <!-- 配置一个触发器 0 0 1 * * ?-->
200 218 <bean id="qhdFmHistoryTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
... ... @@ -446,6 +464,8 @@
446 464 <bean id="schedulerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
447 465 <property name="triggers" >
448 466 <list>
  467 + <ref bean="qhdChuZhengTrigger"/>
  468 +
449 469 <ref bean="autoMatDeliverTrigger"/>
450 470 <ref bean="delSieveTrigger"/>
451 471 <ref bean="addSieveJobTrigger"/>