Commit 7513d57999d630d18d192f6e7125cc85e88a2136

Authored by jiangjiazhi
1 parent b0f9875353

增加删除重复的数据

Showing 1 changed file with 215 additions and 222 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java View file @ 7513d57
... ... @@ -4,6 +4,7 @@
4 4 import com.lyms.hospitalapi.qhdfy.QhdfyHisService;
5 5 import com.lyms.platform.biz.JdbcUtil;
6 6 import com.lyms.platform.biz.service.*;
  7 +import com.lyms.platform.common.enums.SieveStatusEnums;
7 8 import com.lyms.platform.common.enums.YnEnums;
8 9 import com.lyms.platform.common.utils.CompressEncodeingUtil;
9 10 import com.lyms.platform.common.utils.DateUtil;
... ... @@ -41,7 +42,7 @@
41 42  
42 43  
43 44 @Autowired
44   - private MongoTemplate mongoTemplate;
  45 + private MongoTemplate mongoTemplate;
45 46  
46 47 @Autowired
47 48 private PatientsService patientsService;
... ... @@ -82,6 +83,7 @@
82 83  
83 84 @Autowired
84 85 private GenSequenceIdService genIdService;
  86 +
85 87 /**
86 88 * 获取科室
87 89 */
... ... @@ -89,7 +91,7 @@
89 91 @ResponseBody
90 92 public List getDepartment() {
91 93 List<Object> list = new ArrayList<>();
92   - Map<String, String> m = new HashMap<>();
  94 + Map<String, String> m = new HashMap<>();
93 95  
94 96 m = new HashMap<>();
95 97 m.put("id", String.valueOf(1));
... ... @@ -122,7 +124,7 @@
122 124 @ResponseBody
123 125 public List getSampleTypeEnum() {
124 126 List<Object> list = new ArrayList<>();
125   - Map<String, String> m = new HashMap<>();
  127 + Map<String, String> m = new HashMap<>();
126 128  
127 129 m = new HashMap<>();
128 130 m.put("id", String.valueOf(1));
129 131  
130 132  
131 133  
132 134  
... ... @@ -183,33 +185,36 @@
183 185 Long l = CompressEncodeingUtil.unCompressNumber(watermark);
184 186 String s = l.toString();
185 187 int len = s.length();
186   - return s.substring(0,len-6) + "," + s.substring(len-6);
  188 + return s.substring(0, len - 6) + "," + s.substring(len - 6);
187 189 }
188 190  
189 191 @RequestMapping(value = "/addSieveJob", method = RequestMethod.GET)
190 192 @ResponseBody
191 193 public String addSieveJob() {
192   - patientsService.addSieveJob();;
  194 + patientsService.addSieveJob();
  195 + ;
193 196 return "finish";
194 197 }
195 198  
196 199 @RequestMapping(value = "/autoMatDeliver", method = RequestMethod.GET)
197 200 @ResponseBody
198 201 public String autoMatDeliver() {
199   - patientsService.autoMatDeliver();;
  202 + patientsService.autoMatDeliver();
  203 + ;
200 204 return "finish";
201 205 }
202 206  
203 207 @RequestMapping(value = "/delSieve", method = RequestMethod.GET)
204 208 @ResponseBody
205 209 public String delSieve() {
206   - patientsService.delSieve();;
  210 + patientsService.delSieve();
  211 + ;
207 212 return "finish";
208 213 }
209 214  
210 215 @RequestMapping(value = "/syncLisReportTask", method = RequestMethod.GET)
211 216 @ResponseBody
212   - public String syncLisReportTask(@RequestParam(required = true)String time) {
  217 + public String syncLisReportTask(@RequestParam(required = true) String time) {
213 218 qhdfyHisService.syncLisReportTask(time);
214 219 return "finish";
215 220 }
... ... @@ -222,7 +227,7 @@
222 227 public String assayconfiginit(String json) {
223 228 try {
224 229 List<AssayConfig> list = JsonUtil.toList(json, AssayConfig.class);
225   - for (AssayConfig config:list) {
  230 + for (AssayConfig config : list) {
226 231 assayConfigService.save(config);
227 232 }
228 233 } catch (Exception e) {
229 234  
230 235  
231 236  
232 237  
233 238  
... ... @@ -265,33 +270,56 @@
265 270 syncDataTaskService.syncQhdSieve();
266 271 return "syncQhdSieve finish";
267 272 }
  273 +
268 274 @RequestMapping(value = "/execsieveorder", method = RequestMethod.GET)
269 275 @ResponseBody
270 276 public String sieveOrder() {
271 277 sieveService.correctSieveOrder();
272 278 return "sieveOrder finish";
273 279 }
  280 +
  281 + @RequestMapping(value = "/delsieveorder", method = RequestMethod.GET)
  282 + @ResponseBody
  283 + public String delMoreSieve() {
  284 + SieveQuery sieveQuery = new SieveQuery();
  285 + sieveQuery.setYn(YnEnums.YES.getId());
  286 + sieveQuery.setStatus(SieveStatusEnums.O.getId());
  287 +
  288 + List<SieveModel> modelList = sieveService.queryList(sieveQuery);
  289 +
  290 + SieveQuery sieveQuery1 = new SieveQuery();
  291 + sieveQuery1.setYn(YnEnums.YES.getId());
  292 + if (CollectionUtils.isNotEmpty(modelList)) {
  293 + for (SieveModel sieveModel : modelList) {
  294 + sieveQuery1.setParentId(sieveModel.getParentId());
  295 + List<SieveModel> list = sieveService.queryList(sieveQuery1);
  296 + if (CollectionUtils.isNotEmpty(list) &&list.size()>1) {
  297 + sieveModel.setYn(YnEnums.NO.getId());
  298 + sieveService.updateOneChanQianDiaSieve(sieveModel);
  299 + }
  300 + }
  301 + }
  302 + return "sieveOrder finish";
  303 + }
  304 +
274 305 /**
275 306 * 更新医院的孕妇的建档的预产期
  307 + *
276 308 * @param hospitalId
277 309 * @return
278 310 */
279 311 @RequestMapping(value = "/updateDueDate", method = RequestMethod.GET)
280 312 @ResponseBody
281   - public String updateDueDate(@RequestParam(required = true) String hospitalId) {
  313 + public String updateDueDate(@RequestParam(required = true) String hospitalId) {
282 314 PatientsQuery patientsQuery1 = new PatientsQuery();
283 315 patientsQuery1.setYn(YnEnums.YES.getId());
284 316 patientsQuery1.setHospitalId(hospitalId);
285 317 List<Patients> pats = patientsService.queryPatient(patientsQuery1);
286   - if (CollectionUtils.isNotEmpty(pats))
287   - {
288   - for (Patients pat : pats)
289   - {
290   - if (pat != null && pat.getLastMenses() != null)
291   - {
  318 + if (CollectionUtils.isNotEmpty(pats)) {
  319 + for (Patients pat : pats) {
  320 + if (pat != null && pat.getLastMenses() != null) {
292 321 Date dueDate = DateUtil.addDay(DateUtil.addMonth(pat.getLastMenses(), 9), 7);
293   - if (!DateUtil.getyyyy_MM_dd(dueDate).equals(DateUtil.getyyyy_MM_dd(pat.getDueDate())))
294   - {
  322 + if (!DateUtil.getyyyy_MM_dd(dueDate).equals(DateUtil.getyyyy_MM_dd(pat.getDueDate()))) {
295 323 System.out.println(pat.getPhone());
296 324 pat.setDueDate(dueDate);
297 325 patientsService.updatePatient(pat);
298 326  
... ... @@ -315,12 +343,13 @@
315 343  
316 344 /**
317 345 * 修改最后一次产检时间冗余到patient中
  346 + *
318 347 * @param hid
319 348 * @return
320 349 */
321 350 @RequestMapping(value = "/syncPatNextTime", method = RequestMethod.GET)
322 351 @ResponseBody
323   - public String syncPatNextTime(@RequestParam(required = true) String hid) {
  352 + public String syncPatNextTime(@RequestParam(required = true) String hid) {
324 353 PatientsQuery patientQuery = new PatientsQuery();
325 354 patientQuery.setYn(YnEnums.YES.getId());
326 355 patientQuery.setHospitalId(hid);
... ... @@ -338,8 +367,7 @@
338 367 new Thread(new Runnable() {
339 368 @Override
340 369 public void run() {
341   - if (CollectionUtils.isNotEmpty(tempList))
342   - {
  370 + if (CollectionUtils.isNotEmpty(tempList)) {
343 371 for (Patients pat : tempList) {
344 372 AntExChuQuery antExChuQuery = new AntExChuQuery();
345 373 antExChuQuery.setYn(YnEnums.YES.getId());
346 374  
... ... @@ -348,20 +376,17 @@
348 376 List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery);
349 377 if (CollectionUtils.isNotEmpty(chus)) {
350 378 Date nextTime = null;
351   - AntExChuModel chu = chus.get(0);
352   - if (chu != null)
353   - {
  379 + AntExChuModel chu = chus.get(0);
  380 + if (chu != null) {
354 381 nextTime = chu.getNextCheckTime();
355 382 AntExQuery antExQuery = new AntExQuery();
356 383 antExQuery.setParentId(pat.getId());
357 384 antExQuery.setYn(YnEnums.YES.getId());
358 385 antExQuery.setHospitalId(pat.getHospitalId());
359   - List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
360   - if (CollectionUtils.isNotEmpty(list))
361   - {
362   - AntenatalExaminationModel ae = list.get(0);
363   - if (ae != null)
364   - {
  386 + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
  387 + if (CollectionUtils.isNotEmpty(list)) {
  388 + AntenatalExaminationModel ae = list.get(0);
  389 + if (ae != null) {
365 390 nextTime = ae.getNextCheckTime();
366 391 }
367 392 }
... ... @@ -458,7 +483,7 @@
458 483 */
459 484 @ResponseBody
460 485 @RequestMapping(value = "/syncPatientsFmInfo", method = RequestMethod.GET)
461   - public String syncPatientsFmInfo(@RequestParam(required = false) String size,@RequestParam(required = false) String hospitalId) {
  486 + public String syncPatientsFmInfo(@RequestParam(required = false) String size, @RequestParam(required = false) String hospitalId) {
462 487 MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
463 488 matDeliverQuery.setYn(YnEnums.YES.getId());
464 489 if (StringUtils.isNotEmpty(hospitalId)) {
465 490  
466 491  
... ... @@ -543,29 +568,29 @@
543 568 if (CollectionUtils.isNotEmpty(tempList)) {
544 569 for (Patients patients : tempList) {
545 570  
546   - try {
547   - patients.setFmAge(DateUtil.getAge(patients.getBirth(), patients.getFmDate()));
548   - } catch (Exception e) {
549   - System.out.println(patients.getId() + ":这条数据的生日和分娩时间异常");
550   - // 跳过
551   - }
552   - try {
553   - patients.setFmWeek(DateUtil.getDays(patients.getLastMenses(), patients.getFmDate()));
554   - } catch (Exception e) {
555   - System.out.println(patients.getId() + ":这条数据的末日月经和分娩时间异常");
556   - // 跳过
557   - }
558   - if(StringUtils.isNotEmpty(patients.getFmHospital())){
559   - patients.setIsAutoFm(YnEnums.NO.getId());
560   - }else{
561   - patients.setIsAutoFm(YnEnums.YES.getId());
562   - }
  571 + try {
  572 + patients.setFmAge(DateUtil.getAge(patients.getBirth(), patients.getFmDate()));
  573 + } catch (Exception e) {
  574 + System.out.println(patients.getId() + ":这条数据的生日和分娩时间异常");
  575 + // 跳过
  576 + }
  577 + try {
  578 + patients.setFmWeek(DateUtil.getDays(patients.getLastMenses(), patients.getFmDate()));
  579 + } catch (Exception e) {
  580 + System.out.println(patients.getId() + ":这条数据的末日月经和分娩时间异常");
  581 + // 跳过
  582 + }
  583 + if (StringUtils.isNotEmpty(patients.getFmHospital())) {
  584 + patients.setIsAutoFm(YnEnums.NO.getId());
  585 + } else {
  586 + patients.setIsAutoFm(YnEnums.YES.getId());
  587 + }
563 588  
564   - System.out.println(patients.getFmAge());
565   - System.out.println(patients.getFmWeek());
  589 + System.out.println(patients.getFmAge());
  590 + System.out.println(patients.getFmWeek());
566 591  
567   - patientsService.updatePatient(patients);
568   - }
  592 + patientsService.updatePatient(patients);
  593 + }
569 594 }
570 595 }
571 596 }).start();
... ... @@ -581,7 +606,7 @@
581 606 query.setHospitalId("216");
582 607 List<Patients> list = patientsService.queryPatient(query);
583 608 int a = 0;
584   - for (Patients patients:list) {
  609 + for (Patients patients : list) {
585 610 if (org.apache.commons.lang.StringUtils.isBlank(patients.getCardNo())) {
586 611 Patients db = new Patients();
587 612 db.setId(patients.getId());
588 613  
... ... @@ -597,12 +622,13 @@
597 622  
598 623 /**
599 624 * 修改高危因素中包含健康的 把健康去掉
  625 + *
600 626 * @param hid
601 627 * @return
602 628 */
603 629 @RequestMapping(value = "/modifyRiskFactor", method = RequestMethod.GET)
604 630 @ResponseBody
605   - public String modifyRiskFactor(@RequestParam(required = true) String hid) {
  631 + public String modifyRiskFactor(@RequestParam(required = true) String hid) {
606 632 PatientsQuery patientQuery = new PatientsQuery();
607 633 patientQuery.setYn(YnEnums.YES.getId());
608 634 patientQuery.setHospitalId(hid);
609 635  
610 636  
611 637  
612 638  
613 639  
614 640  
... ... @@ -621,92 +647,77 @@
621 647 new Thread(new Runnable() {
622 648 @Override
623 649 public void run() {
624   - if (CollectionUtils.isNotEmpty(tempList))
625   - {
  650 + if (CollectionUtils.isNotEmpty(tempList)) {
626 651 for (Patients pat : tempList) {
627   - if (pat != null)
628   - {
629   - String levelStr = pat.getRiskLevelId();
630   - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(levelStr))
631   - {
632   - List<String> levels = JsonUtil.toList(levelStr, String.class);
633   - if (CollectionUtils.isNotEmpty(levels) && levels.contains("e637b361-99cf-41eb-84f2-f0dab596e928") && levels.size() > 1)
634   - {
635   - List<String> rFactors = pat.getRiskFactorId();
636   - if (CollectionUtils.isNotEmpty(rFactors) && rFactors.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6"))
637   - {
638   - rFactors.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
639   - levels.remove("e637b361-99cf-41eb-84f2-f0dab596e928");
640   - pat.setRiskFactorId(rFactors);
641   - String resultLevel = JsonUtil.array2JsonString(levels);
642   - pat.setRiskLevelId(resultLevel);
643   - patientsService.updatePatient(pat);
  652 + if (pat != null) {
  653 + String levelStr = pat.getRiskLevelId();
  654 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(levelStr)) {
  655 + List<String> levels = JsonUtil.toList(levelStr, String.class);
  656 + if (CollectionUtils.isNotEmpty(levels) && levels.contains("e637b361-99cf-41eb-84f2-f0dab596e928") && levels.size() > 1) {
  657 + List<String> rFactors = pat.getRiskFactorId();
  658 + if (CollectionUtils.isNotEmpty(rFactors) && rFactors.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6")) {
  659 + rFactors.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
  660 + levels.remove("e637b361-99cf-41eb-84f2-f0dab596e928");
  661 + pat.setRiskFactorId(rFactors);
  662 + String resultLevel = JsonUtil.array2JsonString(levels);
  663 + pat.setRiskLevelId(resultLevel);
  664 + patientsService.updatePatient(pat);
644 665  
645   - AntExChuQuery antExChuQuery = new AntExChuQuery();
646   - antExChuQuery.setYn(YnEnums.YES.getId());
647   - antExChuQuery.setParentId(pat.getId());
648   - antExChuQuery.setHospitalId(pat.getHospitalId());
649   - List<AntExChuModel> antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery);
650   - if (CollectionUtils.isNotEmpty(antExChuModelList))
651   - {
652   - for(AntExChuModel cmodel : antExChuModelList)
653   - {
654   - String highriskStr = cmodel.getHighrisk();
655   - String otherRisk = cmodel.getOtherHighRisk();
656   - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(highriskStr))
657   - {
658   - List<String> highrisks = JsonUtil.toList(highriskStr, String.class);
659   - if (CollectionUtils.isNotEmpty(highrisks) && highrisks.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && highrisks.size() > 1)
660   - {
661   - highrisks.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
662   - cmodel.setHighrisk(JsonUtil.array2JsonString(highrisks));
663   - antenatalExaminationService.updateAntExChu(cmodel,cmodel.getId());
664   - }
665   - else if (CollectionUtils.isNotEmpty(highrisks) && highrisks.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && !"{}".equals(otherRisk))
666   - {
667   - highrisks.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
668   - cmodel.setHighrisk(JsonUtil.array2JsonString(highrisks));
669   - antenatalExaminationService.updateAntExChu(cmodel,cmodel.getId());
670   - }
671   - }
672   - }
  666 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  667 + antExChuQuery.setYn(YnEnums.YES.getId());
  668 + antExChuQuery.setParentId(pat.getId());
  669 + antExChuQuery.setHospitalId(pat.getHospitalId());
  670 + List<AntExChuModel> antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery);
  671 + if (CollectionUtils.isNotEmpty(antExChuModelList)) {
  672 + for (AntExChuModel cmodel : antExChuModelList) {
  673 + String highriskStr = cmodel.getHighrisk();
  674 + String otherRisk = cmodel.getOtherHighRisk();
  675 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(highriskStr)) {
  676 + List<String> highrisks = JsonUtil.toList(highriskStr, String.class);
  677 + if (CollectionUtils.isNotEmpty(highrisks) && highrisks.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && highrisks.size() > 1) {
  678 + highrisks.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
  679 + cmodel.setHighrisk(JsonUtil.array2JsonString(highrisks));
  680 + antenatalExaminationService.updateAntExChu(cmodel, cmodel.getId());
  681 + } else if (CollectionUtils.isNotEmpty(highrisks) && highrisks.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && !"{}".equals(otherRisk)) {
  682 + highrisks.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
  683 + cmodel.setHighrisk(JsonUtil.array2JsonString(highrisks));
  684 + antenatalExaminationService.updateAntExChu(cmodel, cmodel.getId());
  685 + }
  686 + }
  687 + }
673 688  
674   - // 查询复诊
675   - AntExQuery antExQuery = new AntExQuery();
676   - antExQuery.setYn(YnEnums.YES.getId());
677   - antExQuery.setParentId(pat.getId());
678   - antExQuery.setHospitalId(pat.getHospitalId());
679   - List<AntenatalExaminationModel> antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
680   - if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) {
681   - for (AntenatalExaminationModel fmodel : antenatalExaminationModelList) {
682   - String highriskStr = fmodel.getRiskFactor();
683   - String otherRisk = fmodel.getOtherRisk();
684   - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(highriskStr))
685   - {
686   - List<String> highrisks = JsonUtil.toList(highriskStr, String.class);
687   - if (CollectionUtils.isNotEmpty(highrisks) && highrisks.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && highrisks.size() > 1)
688   - {
689   - highrisks.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
690   - fmodel.setRiskFactor(JsonUtil.array2JsonString(highrisks));
691   - antenatalExaminationService.updateOneAnt(fmodel,fmodel.getId());
692   - }
693   - else if (CollectionUtils.isNotEmpty(highrisks) && highrisks.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && !"{}".equals(otherRisk))
694   - {
695   - highrisks.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
696   - fmodel.setRiskFactor(JsonUtil.array2JsonString(highrisks));
697   - antenatalExaminationService.updateOneAnt(fmodel, fmodel.getId());
698   - }
699   - }
700   - }
701   - }
  689 + // 查询复诊
  690 + AntExQuery antExQuery = new AntExQuery();
  691 + antExQuery.setYn(YnEnums.YES.getId());
  692 + antExQuery.setParentId(pat.getId());
  693 + antExQuery.setHospitalId(pat.getHospitalId());
  694 + List<AntenatalExaminationModel> antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery());
  695 + if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) {
  696 + for (AntenatalExaminationModel fmodel : antenatalExaminationModelList) {
  697 + String highriskStr = fmodel.getRiskFactor();
  698 + String otherRisk = fmodel.getOtherRisk();
  699 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(highriskStr)) {
  700 + List<String> highrisks = JsonUtil.toList(highriskStr, String.class);
  701 + if (CollectionUtils.isNotEmpty(highrisks) && highrisks.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && highrisks.size() > 1) {
  702 + highrisks.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
  703 + fmodel.setRiskFactor(JsonUtil.array2JsonString(highrisks));
  704 + antenatalExaminationService.updateOneAnt(fmodel, fmodel.getId());
  705 + } else if (CollectionUtils.isNotEmpty(highrisks) && highrisks.contains("d42eec03-aa86-45b8-a4e0-78a0ff365fb6") && !"{}".equals(otherRisk)) {
  706 + highrisks.remove("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
  707 + fmodel.setRiskFactor(JsonUtil.array2JsonString(highrisks));
  708 + antenatalExaminationService.updateOneAnt(fmodel, fmodel.getId());
  709 + }
  710 + }
  711 + }
  712 + }
702 713  
703   - }
704   - }
705   - }
  714 + }
  715 + }
  716 + }
706 717  
707   - }
  718 + }
708 719  
709   - }
  720 + }
710 721 }
711 722 }
712 723 }
713 724  
... ... @@ -719,12 +730,13 @@
719 730  
720 731 /**
721 732 * 更新产妇当前产程最后一次高危因素冗余到 patient中
  733 + *
722 734 * @param hid
723 735 * @return
724 736 */
725 737 @RequestMapping(value = "/updateChanLaskRisk", method = RequestMethod.GET)
726 738 @ResponseBody
727   - public String updateChanLaskRisk(@RequestParam(required = true) String hid) {
  739 + public String updateChanLaskRisk(@RequestParam(required = true) String hid) {
728 740 PatientsQuery patientQuery = new PatientsQuery();
729 741 patientQuery.setYn(YnEnums.YES.getId());
730 742 patientQuery.setHospitalId(hid);
731 743  
732 744  
... ... @@ -743,15 +755,12 @@
743 755 new Thread(new Runnable() {
744 756 @Override
745 757 public void run() {
746   - if (CollectionUtils.isNotEmpty(tempList))
747   - {
  758 + if (CollectionUtils.isNotEmpty(tempList)) {
748 759 for (Patients pat : tempList) {
749   - if (pat != null)
750   - {
  760 + if (pat != null) {
751 761 Date min = pat.getLastMenses();
752   - Date max = pat.getFmDate();
753   - if (min != null && max != null)
754   - {
  762 + Date max = pat.getFmDate();
  763 + if (min != null && max != null) {
755 764 HighScoreResult highScoreResult = antenatalExaminationFacade.getPatLastRiskByDate(pat.getPid(), true, min, max);
756 765 PatientsQuery patientsQuery1 = new PatientsQuery();
757 766 patientsQuery1.setId(pat.getId());
758 767  
759 768  
... ... @@ -778,20 +787,20 @@
778 787  
779 788 /**
780 789 * 更新儿童检查表中的生长发育评价
  790 + *
781 791 * @param hid
782 792 * @return
783 793 */
784 794 @RequestMapping(value = "/updateBabyGrowth", method = RequestMethod.GET)
785 795 @ResponseBody
786   - public String updateBabyGrowth(@RequestParam(required = true) String hid) {
  796 + public String updateBabyGrowth(@RequestParam(required = true) String hid) {
787 797  
788 798 BabyModelQuery babyModelQuery = new BabyModelQuery();
789 799 babyModelQuery.setYn(YnEnums.YES.getId());
790 800 babyModelQuery.setHospitalId(hid);
791 801  
792   - List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
793   - if (CollectionUtils.isNotEmpty(models))
794   - {
  802 + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  803 + if (CollectionUtils.isNotEmpty(models)) {
795 804 int batchSize = 200;
796 805 int end = 0;
797 806 for (int i = 0; i < models.size(); i += batchSize) {
798 807  
799 808  
800 809  
801 810  
802 811  
803 812  
804 813  
805 814  
806 815  
... ... @@ -804,56 +813,48 @@
804 813 new Thread(new Runnable() {
805 814 @Override
806 815 public void run() {
807   - if (CollectionUtils.isNotEmpty(tempList))
808   - {
  816 + if (CollectionUtils.isNotEmpty(tempList)) {
809 817 for (BabyModel babyModel : tempList) {
810   - if (babyModel != null)
811   - {
  818 + if (babyModel != null) {
812 819 BabyCheckModelQuery query = new BabyCheckModelQuery();
813 820 query.setYn(YnEnums.YES.getId());
814 821 query.setBuildId(babyModel.getId());
815 822  
816 823 List<BabyCheckModel> checkModels = babyCheckService.queryBabyCheckRecord(query);
817   - if (CollectionUtils.isNotEmpty(checkModels))
818   - {
819   - for (BabyCheckModel checkModel : checkModels)
820   - {
821   - String height = checkModel.getHeight();
  824 + if (CollectionUtils.isNotEmpty(checkModels)) {
  825 + for (BabyCheckModel checkModel : checkModels) {
  826 + String height = checkModel.getHeight();
822 827 String birth = DateUtil.getyyyy_MM_dd(babyModel.getBirth());
823   - if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(birth))
824   - {
  828 + if (!com.lyms.platform.common.utils.StringUtils.isNotEmpty(birth)) {
825 829 continue;
826 830 }
827 831 // type 0 体重标准差数值表 1 身长/身高标准差数值表 2 头围标准差数值表 3身高别体重
828   - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(height))
829   - {
830   - String value = babyCheckFacade.getGrowthValue(birth,Double.parseDouble(height),babyModel.getSex(),1);
  832 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(height)) {
  833 + String value = babyCheckFacade.getGrowthValue(birth, Double.parseDouble(height), babyModel.getSex(), 1);
831 834 checkModel.setHeightEvaluate(value);
832 835  
833 836 }
834 837 String head = checkModel.getHead();
835 838 if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(head)) {
836   - String value = babyCheckFacade.getGrowthValue(birth,Double.parseDouble(head),babyModel.getSex(),2);
  839 + String value = babyCheckFacade.getGrowthValue(birth, Double.parseDouble(head), babyModel.getSex(), 2);
837 840 checkModel.setHeadEvaluate(value);
838 841 }
839 842  
840 843 String weight = checkModel.getWeight();
841 844 if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(weight)) {
842   - String value = babyCheckFacade.getGrowthValue(birth,Double.parseDouble(weight),babyModel.getSex(),0);
  845 + String value = babyCheckFacade.getGrowthValue(birth, Double.parseDouble(weight), babyModel.getSex(), 0);
843 846 checkModel.setWeightEvaluate(value);
844 847 }
845 848  
846 849 if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(height) &&
847   - com.lyms.platform.common.utils.StringUtils.isNotEmpty(weight))
848   - {
  850 + com.lyms.platform.common.utils.StringUtils.isNotEmpty(weight)) {
849 851 //发育评价
850 852 List<String> growthEvaluate = babyCheckFacade.getBabyGrowthEvaluate(Double.parseDouble(height), babyModel.getSex(), birth, Double.parseDouble(weight));
851   - if (CollectionUtils.isNotEmpty(growthEvaluate))
852   - {
  853 + if (CollectionUtils.isNotEmpty(growthEvaluate)) {
853 854 checkModel.setGrowthEvaluate(JsonUtil.array2JsonString(growthEvaluate));
854 855 }
855 856  
856   - String hw = babyCheckFacade.getBabyHW(Double.parseDouble(height),Double.parseDouble(weight),babyModel.getSex(),birth);
  857 + String hw = babyCheckFacade.getBabyHW(Double.parseDouble(height), Double.parseDouble(weight), babyModel.getSex(), birth);
857 858 checkModel.setHeightWeight(hw);
858 859  
859 860 }
... ... @@ -861,7 +862,7 @@
861 862 checkModel.setBirth(babyModel.getBirth());
862 863  
863 864 checkModel.setCheckMonth(DateUtil.getBabyAgeMonth(babyModel.getBirth(), checkModel.getCheckDate()));
864   - babyCheckService.updateBabyCheck(checkModel,checkModel.getId());
  865 + babyCheckService.updateBabyCheck(checkModel, checkModel.getId());
865 866 }
866 867 }
867 868 }
868 869  
869 870  
... ... @@ -880,20 +881,20 @@
880 881  
881 882 /**
882 883 * 修正儿童助产机构
  884 + *
883 885 * @param hid
884 886 * @return
885 887 */
886 888 @RequestMapping(value = "/updateBabyFmHospital", method = RequestMethod.GET)
887 889 @ResponseBody
888   - public String updateBabyFmHospital(@RequestParam(required = true) String hid) {
  890 + public String updateBabyFmHospital(@RequestParam(required = true) String hid) {
889 891  
890 892 BabyModelQuery babyModelQuery = new BabyModelQuery();
891 893 babyModelQuery.setYn(YnEnums.YES.getId());
892 894 babyModelQuery.setHospitalId(hid);
893 895  
894   - List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
895   - if (CollectionUtils.isNotEmpty(models))
896   - {
  896 + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  897 + if (CollectionUtils.isNotEmpty(models)) {
897 898 int batchSize = 200;
898 899 int end = 0;
899 900 for (int i = 0; i < models.size(); i += batchSize) {
900 901  
... ... @@ -906,35 +907,29 @@
906 907 new Thread(new Runnable() {
907 908 @Override
908 909 public void run() {
909   - if (CollectionUtils.isNotEmpty(tempList))
910   - {
  910 + if (CollectionUtils.isNotEmpty(tempList)) {
911 911 for (BabyModel babyModel : tempList) {
912   - if (babyModel != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(babyModel.getMcertNo()))
913   - {
914   - PatientsQuery patientsQuery = new PatientsQuery();
915   - patientsQuery.setYn(YnEnums.YES.getId());
916   - patientsQuery.setType(3);
917   - patientsQuery.setCardNo(babyModel.getMcertNo());
918   - List<Patients> patients = patientsService.queryPatient(patientsQuery);
919   - if (CollectionUtils.isNotEmpty(patients))
920   - {
921   - for(Patients pat : patients)
922   - {
923   - MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
924   - matDeliverQuery.setYn(YnEnums.YES.getId());
925   - matDeliverQuery.setParentId(pat.getId());
926   - List<MaternalDeliverModel> lists = matDeliverService.query(matDeliverQuery);
927   - if (CollectionUtils.isNotEmpty(lists))
928   - {
929   - if (lists.get(0) != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(lists.get(0).getFmHospital()))
930   - {
931   - babyModel.setDeliverOrg(lists.get(0).getFmHospital());
932   - babyBookbuildingService.updateBabyBuild(babyModel,babyModel.getId());
933   - break;
934   - }
935   - }
936   - }
937   - }
  912 + if (babyModel != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(babyModel.getMcertNo())) {
  913 + PatientsQuery patientsQuery = new PatientsQuery();
  914 + patientsQuery.setYn(YnEnums.YES.getId());
  915 + patientsQuery.setType(3);
  916 + patientsQuery.setCardNo(babyModel.getMcertNo());
  917 + List<Patients> patients = patientsService.queryPatient(patientsQuery);
  918 + if (CollectionUtils.isNotEmpty(patients)) {
  919 + for (Patients pat : patients) {
  920 + MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
  921 + matDeliverQuery.setYn(YnEnums.YES.getId());
  922 + matDeliverQuery.setParentId(pat.getId());
  923 + List<MaternalDeliverModel> lists = matDeliverService.query(matDeliverQuery);
  924 + if (CollectionUtils.isNotEmpty(lists)) {
  925 + if (lists.get(0) != null && com.lyms.platform.common.utils.StringUtils.isNotEmpty(lists.get(0).getFmHospital())) {
  926 + babyModel.setDeliverOrg(lists.get(0).getFmHospital());
  927 + babyBookbuildingService.updateBabyBuild(babyModel, babyModel.getId());
  928 + break;
  929 + }
  930 + }
  931 + }
  932 + }
938 933 }
939 934 }
940 935 }
941 936  
942 937  
943 938  
944 939  
... ... @@ -954,22 +949,21 @@
954 949 List<String> list = null;
955 950 try {
956 951 list = FileUtils.readLines(new File("D:\\QHD.csv"), "gbk");
957   - for (String line:list) {
  952 + for (String line : list) {
958 953 String ss[] = line.split(",");
959 954 if (ss.length > 1 && ss[0].trim().length() > 0) {
960   - if (ss[0] != null)
961   - {
  955 + if (ss[0] != null) {
962 956  
963   - String id = ss[0].replace("-","");
  957 + String id = ss[0].replace("-", "");
964 958 String name = ss[1];
965 959 String oid = String.valueOf(JdbcUtil.getQhdMysqlSingleObjBySql("select id from organization where name = '" + name + "'", JdbcUtil.getQhdMysqlConnection()));
966 960 BabyModelQuery babyModelQuery = new BabyModelQuery();
967 961 babyModelQuery.setYn(YnEnums.YES.getId());
968 962 babyModelQuery.setId(id);
969 963  
970   - List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
  964 + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery);
971 965 if (CollectionUtils.isNotEmpty(models) && com.lyms.platform.common.utils.StringUtils.isNotEmpty(oid)) {
972   - System.out.println(ss[0]+"==="+ss[1]);
  966 + System.out.println(ss[0] + "===" + ss[1]);
973 967 BabyModel model = models.get(0);
974 968 model.setDeliverOrg(oid);
975 969 babyBookbuildingService.updateBabyBuild(model, model.getId());
976 970  
977 971  
978 972  
... ... @@ -978,26 +972,24 @@
978 972 }
979 973 }
980 974 } catch (IOException e) {
981   - ExceptionUtils.catchException(e,"跟新异常");
  975 + ExceptionUtils.catchException(e, "跟新异常");
982 976 e.printStackTrace();
983 977 }
984 978 return "updateBabyFmHid finish";
985 979 }
986 980  
987 981  
988   -
989   -
990 982 @RequestMapping(value = "/syncFmData", method = RequestMethod.GET)
991 983 @ResponseBody
992   - public String syncFmData(@RequestParam(required = true) String start,@RequestParam(required = true) String end) {
993   - qhdfyFmService.syncWorker(start,end);
  984 + public String syncFmData(@RequestParam(required = true) String start, @RequestParam(required = true) String end) {
  985 + qhdfyFmService.syncWorker(start, end);
994 986 return "syncFmData finish";
995 987 }
996 988  
997 989 @RequestMapping(value = "/syncFmBySyxh", method = RequestMethod.GET)
998 990 @ResponseBody
999   - public String syncFmBySyxh(@RequestParam(required = true) String start,@RequestParam(required = true) String end,@RequestParam(required = false) String syxh) {
1000   - qhdfyFmService.syncByPhone(start,end,syxh);
  991 + public String syncFmBySyxh(@RequestParam(required = true) String start, @RequestParam(required = true) String end, @RequestParam(required = false) String syxh) {
  992 + qhdfyFmService.syncByPhone(start, end, syxh);
1001 993 return "syncFmBySyxh finish";
1002 994 }
1003 995  
1004 996  
... ... @@ -1005,10 +997,10 @@
1005 997 try {
1006 998 List<String> list = FileUtils.readLines(new File("D:\\QHD.csv"), "gbk");
1007 999 List<String> linenums = new ArrayList<>();
1008   - for (String line:list) {
  1000 + for (String line : list) {
1009 1001 String ss[] = line.split(",");
1010 1002 if (ss.length > 0 && ss[0].trim().length() > 0) {
1011   - System.out.println(ss[0]+" "+ ss[1]);
  1003 + System.out.println(ss[0] + " " + ss[1]);
1012 1004 }
1013 1005 }
1014 1006 // List<String> list1 = FileUtils.readLines(new File("D:\\temp\\qhd-jd.csv"), "utf-8");
1015 1007  
1016 1008  
... ... @@ -1025,15 +1017,16 @@
1025 1017 e.printStackTrace();
1026 1018 }
1027 1019 }
1028   -
  1020 +
1029 1021 @RequestMapping("/poll")
1030 1022 @ResponseBody
1031 1023 public String poll() {
1032   - return genIdService.poll("1234");
  1024 + return genIdService.poll("1234");
1033 1025 }
1034 1026  
1035 1027 /**
1036 1028 * 初始化优惠券的类型 全部设置位产检券
  1029 + *
1037 1030 * @return
1038 1031 */
1039 1032 @RequestMapping("/init/ticket")