Commit 86ea0eebd75fa87953eb1f98a7401f925764dca7

Authored by liquanyu
1 parent 447e33a47f

产妇最后高危修正

Showing 2 changed files with 76 additions and 2 deletions

platform-job-index/src/main/java/com/lyms/platform/job/index/service/SyncDataService.java View file @ 86ea0ee
... ... @@ -768,7 +768,7 @@
768 768  
769 769 private void syncFuzhen(String pid, String parentId, MongoTemplate mongoTemplate,Date lastMenses,int weeks) {
770 770  
771   - String sql = "select * from TMP_QHD_FZ where replace(parentid,'-','') = '"+parentId+"'";
  771 + String sql = "select * from TMP_QHD_FZ where replace(parentid,'-','') = '"+parentId+"' order by CHECKDATE ASC ";
772 772 long startTimes = System.currentTimeMillis();
773 773 List<Map<String, Object>> list = JDBCUtil.getOracleListDataBySql(sql);
774 774 long endTimes = System.currentTimeMillis();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 86ea0ee
... ... @@ -9,6 +9,8 @@
9 9 import com.lyms.platform.common.utils.CompressEncodeingUtil;
10 10 import com.lyms.platform.common.utils.DateUtil;
11 11 import com.lyms.platform.common.utils.JsonUtil;
  12 +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade;
  13 +import com.lyms.platform.operate.web.result.HighScoreResult;
12 14 import com.lyms.platform.operate.web.service.SyncDataTaskService;
13 15 import com.lyms.platform.permission.service.OrganizationService;
14 16 import com.lyms.platform.pojo.AntExChuModel;
... ... @@ -61,6 +63,10 @@
61 63 @Autowired
62 64 private AntenatalExaminationService antenatalExaminationService;
63 65  
  66 +
  67 + @Autowired
  68 + private AntenatalExaminationFacade antenatalExaminationFacade;
  69 +
64 70 /**
65 71 * 获取科室
66 72 */
... ... @@ -292,6 +298,11 @@
292 298 }
293 299  
294 300  
  301 + /**
  302 + * 修改最后一次产检时间冗余到patient中
  303 + * @param hid
  304 + * @return
  305 + */
295 306 @RequestMapping(value = "/syncPatNextTime", method = RequestMethod.GET)
296 307 @ResponseBody
297 308 public String syncPatNextTime(@RequestParam(required = true) String hid) {
... ... @@ -442,7 +453,11 @@
442 453 }
443 454  
444 455  
445   -
  456 + /**
  457 + * 修改高危因素中包含健康的 把健康去掉
  458 + * @param hid
  459 + * @return
  460 + */
446 461 @RequestMapping(value = "/modifyRiskFactor", method = RequestMethod.GET)
447 462 @ResponseBody
448 463 public String modifyRiskFactor(@RequestParam(required = true) String hid) {
... ... @@ -498,6 +513,65 @@
498 513 return "modifyRiskFactor finish";
499 514 }
500 515  
  516 +
  517 + /**
  518 + * 更新产妇当前产程最后一次高危因素冗余到 patient中
  519 + * @param hid
  520 + * @return
  521 + */
  522 + @RequestMapping(value = "/updateChanLaskRisk", method = RequestMethod.GET)
  523 + @ResponseBody
  524 + public String updateChanLaskRisk(@RequestParam(required = true) String hid) {
  525 + PatientsQuery patientQuery = new PatientsQuery();
  526 + patientQuery.setYn(YnEnums.YES.getId());
  527 + patientQuery.setHospitalId(hid);
  528 + patientQuery.setType(3);
  529 +
  530 + List<Patients> patientses = patientsService.queryPatient(patientQuery);
  531 + int batchSize = 500;
  532 + int end = 0;
  533 + for (int i = 0; i < patientses.size(); i += batchSize) {
  534 + end = (end + batchSize);
  535 + if (end > patientses.size()) {
  536 + end = patientses.size();
  537 + }
  538 + System.out.println("start:" + i + ",end:" + end);
  539 + final List<Patients> tempList = patientses.subList(i, end);
  540 + new Thread(new Runnable() {
  541 + @Override
  542 + public void run() {
  543 + if (CollectionUtils.isNotEmpty(tempList))
  544 + {
  545 + for (Patients pat : tempList) {
  546 + if (pat != null)
  547 + {
  548 + Date min = pat.getLastMenses();
  549 + Date max = pat.getFmDate();
  550 + if (min != null && max != null)
  551 + {
  552 + HighScoreResult highScoreResult = antenatalExaminationFacade.getPatLastRiskByDate(pat.getPid(),true,min,max);
  553 + PatientsQuery patientsQuery1 = new PatientsQuery();
  554 + patientsQuery1.setId(pat.getId());
  555 + patientsQuery1.setYn(YnEnums.YES.getId());
  556 +
  557 + Patients patients1 = new Patients();
  558 + patients1.setModified(new Date());
  559 + patients1.setRiskScore(highScoreResult.getScore());
  560 + patients1.setRiskFactorId(highScoreResult.getHighId());
  561 + patients1.setRiskLevelId(JsonUtil.array2JsonString(highScoreResult.getLevelId()));
  562 + //设置其他的高危因素
  563 + patients1.setoRiskFactor(highScoreResult.getOtherRisk());
  564 + patientsService.findAndModify(patientsQuery1, patients1);
  565 + }
  566 + }
  567 + }
  568 + }
  569 + }
  570 + }).start();
  571 + }
  572 +
  573 + return "updateChanLaskRisk finish";
  574 + }
501 575  
502 576  
503 577 public static void main(String[] a) {