Commit c481a98d345fbfe5a54f07972e1a8c497819173e

Authored by wtt
1 parent 281035119b

update

Showing 3 changed files with 120 additions and 19 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java View file @ c481a98
... ... @@ -2,6 +2,8 @@
2 2  
3 3 import java.math.BigDecimal;
4 4 import java.text.DecimalFormat;
  5 +import java.text.ParseException;
  6 +import java.text.SimpleDateFormat;
5 7 import java.util.*;
6 8 import java.util.regex.Matcher;
7 9 import java.util.regex.Pattern;
... ... @@ -51,7 +53,7 @@
51 53 // }
52 54 int day = (days % 7);
53 55 return "孕" + str + (day > 0 ? "+" + day + "天" : "");
54   - }
  56 + }
55 57 /**
56 58 * 孕周转天数
57 59 * @param dueWeek 入参实例 1周2天
... ... @@ -383,6 +385,35 @@
383 385 {
384 386 return obj == null ? null : String.valueOf(obj);
385 387 }
  388 + /**
  389 + * 根据身份证号获取年龄
  390 + * @param certId
  391 + * @return
  392 + */
  393 + public static Integer getAgeByCertId(String certId) {
  394 + try {
  395 + String birthday = "";
  396 + if (certId.length() == 18) {
  397 + birthday = certId.substring(6, 10) + "/"
  398 + + certId.substring(10, 12) + "/"
  399 + + certId.substring(12, 14);
  400 + }
  401 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
  402 + Date now = new Date();
  403 + Date birth = new Date();
  404 + try {
  405 + birth = sdf.parse(birthday);
  406 + } catch (ParseException e) {
  407 + }
  408 + long intervalMilli = now.getTime() - birth.getTime();
  409 + int age = (int) (intervalMilli/(24 * 60 * 60 * 1000))/365;
  410 + return age;
  411 + } catch (Exception e) {
  412 + e.printStackTrace();
  413 + }
  414 + return null;
  415 + }
  416 +
386 417  
387 418 }
platform-operate-api/src/main/java/com/lyms/hospitalapi/linchengfy/LcfyFmService.java View file @ c481a98
... ... @@ -292,6 +292,63 @@
292 292 this.allList = list;
293 293 }
294 294  
  295 + /*public void run() {
  296 +
  297 + SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  298 + try {
  299 + System.out.println("fm=" + allList.toString());
  300 +
  301 + List <Users> users = new ArrayList <Users>();
  302 + Date dueDate = null;
  303 + List <MatDeliverAddRequest.Baby> babies = new ArrayList <>();
  304 + MatDeliverAddRequest deliverAddRequest = new MatDeliverAddRequest();
  305 + Patients patient =null;
  306 + for (Fm allFm : allList) {
  307 + System.out.println("0-------------" + allFm.getBABY_PREGNANCY_OUT());
  308 + if (!"1".equals(allFm.getBABY_PREGNANCY_OUT())) {
  309 + continue;
  310 + }
  311 + if (StringUtils.isEmpty(allFm.getPHONE()) && StringUtils.isEmpty(allFm.getIDCARD())) {
  312 + continue;
  313 + }
  314 + PatientsQuery query = new PatientsQuery();
  315 + query.setYn(YnEnums.YES.getId());
  316 + query.setType(3); //孕妇
  317 + query.setHospitalId(HOSPITALID);
  318 + query.setBookbuildingDoctor("2100006056");
  319 + String[] strs = new String[]{allFm.getPHONE(), allFm.getIDCARD()};
  320 + query.setPc(strs);
  321 + //查询该孕妇是否在孕产婴系统中建档
  322 + System.out.println("1----query--" + query.convertToQuery().convertToMongoQuery());
  323 + List <Patients> patientses = patientsService.queryPatient(query);
  324 + System.out.println("2----patientses--" + ( CollectionUtils.isNotEmpty(patientses)?patientses.size():null));
  325 + if (CollectionUtils.isNotEmpty(patientses)) {
  326 + patient = patientses.get(0);
  327 + Patients pat1 = new Patients();
  328 + pat1.setAge(StringUtils.getAgeByCertId(allFm.getIDCARD()));
  329 + if(StringUtils.isNotEmpty(allFm.getIDCARD()) && allFm.getIDCARD().length() == 18){
  330 + String birthstr = allFm.getIDCARD().substring(6, 14);
  331 + pat1.setBirth(DateUtil.parseYYYYMMDD(birthstr));
  332 + }
  333 + yunBookbuildingService.updatePregnant(pat1,patient.getId());
  334 +
  335 + PersonModel per = new PersonModel();
  336 + if(StringUtils.isNotEmpty(allFm.getIDCARD()) && allFm.getIDCARD().length() == 18){
  337 + String birthstr = allFm.getIDCARD().substring(6, 14);
  338 + per.setBirth(DateUtil.parseYYYYMMDD(birthstr));
  339 + }
  340 + personService.updatePerson(per ,patient.getPid());
  341 + }
  342 +
  343 + }
  344 +
  345 +
  346 + } catch (Exception e) {
  347 + ExceptionUtils.catchException(e, "执行异常");
  348 + e.printStackTrace();
  349 + }
  350 +
  351 + }*/
295 352 public void run() {
296 353  
297 354 SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
... ... @@ -313,8 +370,9 @@
313 370 }
314 371 PatientsQuery query = new PatientsQuery();
315 372 query.setYn(YnEnums.YES.getId());
316   - query.setType(1); //孕妇
317   - query.setDueStatus(0); //未终止妊娠
  373 + //20201230 半年后把这个打开
  374 +// query.setType(1); //孕妇
  375 +// query.setDueStatus(0); //未终止妊娠
318 376 String[] strs = new String[]{allFm.getPHONE(), allFm.getIDCARD()};
319 377 query.setPc(strs);
320 378 //查询该孕妇是否在孕产婴系统中建档
321 379  
... ... @@ -334,9 +392,9 @@
334 392 }
335 393 System.out.println("3----users--" +( CollectionUtils.isNotEmpty(users)?users.size():null));
336 394  
337   - if (CollectionUtils.isNotEmpty(patientses)) {
  395 + if (CollectionUtils.isNotEmpty(patientses) && patientses.size()>0) {
338 396 patient = patientses.get(0);
339   - System.out.println("4----patient.getId()--" +patient.getId());
  397 + System.out.println("4.1----patient.getId()--" +patient.getId());
340 398  
341 399 } else if (StringUtils.isNotEmpty(allFm.getNAME())
342 400 && StringUtils.isNotEmpty(allFm.getBABY_DELIVERY_TIME())
343 401  
344 402  
345 403  
... ... @@ -344,12 +402,14 @@
344 402 && StringUtils.isNotEmpty(allFm.getIDCARD())
345 403 && StringUtils.isNotEmpty(allFm.getNAME())
346 404 && CollectionUtils.isNotEmpty(users)
  405 + && CollectionUtils.isEmpty(patientses)
347 406 ) {
  407 + //20201230 半年后把这个注释了,不在添加
348 408 patient = addPatients(users, allFm);
349   - System.out.println("4.1----patient.getId()--" +patient.getId());
  409 + System.out.println("4.2----patient.getId()--" +patient.getId());
350 410 }
351 411  
352   - if (patient != null) {
  412 + if (patient != null && StringUtils.isNotEmpty(patient.getId())) {
353 413 System.out.println("5-----------");
354 414 if (CollectionUtils.isNotEmpty(users) && users.get(0).getId() != null) {
355 415  
356 416  
... ... @@ -389,11 +449,12 @@
389 449 map.put("three", map3);
390 450 }
391 451  
392   - /* int hProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())/60;//总产程小时数
  452 + if (StringUtils.isNotEmpty(allFm.getTOTAL_PROCESS())){
  453 + int hProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())/60;//总产程小时数
393 454 int mProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())%60;//总产程分钟数
394 455 totalMap.put("h",String.valueOf(hProcess));
395   - totalMap.put("m",String.valueOf(mProcess));*/
396   -
  456 + totalMap.put("m",String.valueOf(mProcess));
  457 + }
397 458 deliverAddRequest.setProdprocess(map);
398 459 deliverAddRequest.setTotalprocess(totalMap);
399 460 System.out.println("6----------" + allFm.getDELIVER_DOCTOR());
400 461  
... ... @@ -499,10 +560,10 @@
499 560  
500 561 baby.setDeformity((allFm.getBABY_DEFORMITY() == null ? 0 : 1)); //畸形 0非畸形 1畸形
501 562  
502   - /* String baby_Pregnancy_Out = allFm.getBABY_PREGNANCY_OUT()=="1"?"活产":"";
  563 + String baby_Pregnancy_Out = allFm.getBABY_PREGNANCY_OUT()=="1"?"活产":"";
503 564 if(baby_Pregnancy_Out!=null && StringUtils.isNotEmpty(baby_Pregnancy_Out)){
504 565 baby.setPregnancyOut(RenShenJieJuEnums.getIdByName("活产")); // 妊娠结局
505   - }*/
  566 + }
506 567  
507 568 System.out.println("7-------------" + allFm.getBABY_PREGNANCY_OUT() == "1" ? "活产" : "");
508 569 baby.setPregnancyOut(RenShenJieJuEnums.getIdByName("活产")); // 妊娠结局
... ... @@ -514,7 +575,7 @@
514 575 }
515 576 }
516 577  
517   - if (patient != null && CollectionUtils.isNotEmpty(babies)) {
  578 + if (patient != null && StringUtils.isNotEmpty(patient.getId()) && CollectionUtils.isNotEmpty(babies)) {
518 579 deliverAddRequest.setBabies(babies);
519 580 deliverAddRequest.setFmHospital(HOSPITALID); //设置为临城
520 581 ExceptionUtils.catchException("deliverAddRequest===" + deliverAddRequest);
... ... @@ -535,7 +596,10 @@
535 596 try {
536 597 PersonModel pmodel = new PersonModel();
537 598 pmodel.setName(allFm.getNAME());
538   - pmodel.setBirth(DateUtil.parseYMD(allFm.getBABY_DELIVERY_TIME()));
  599 + if(allFm.getIDCARD().length() == 18){
  600 + String birthstr = allFm.getIDCARD().substring(6, 14);
  601 + pmodel.setBirth(DateUtil.parseYYYYMMDD(birthstr));
  602 + }
539 603 pmodel.setPhone(allFm.getPHONE());
540 604 pmodel.setCardNo(allFm.getIDCARD());
541 605 pmodel.setType(3);
542 606  
... ... @@ -549,11 +613,15 @@
549 613 pat1.setUsername(allFm.getNAME());
550 614 pat1.setPcerteTypeId("");
551 615 pat1.setCardNo(allFm.getIDCARD());
552   - pat1.setBirth(DateUtil.parseYMD(allFm.getBABY_DELIVERY_TIME()));
  616 + if(StringUtils.isNotEmpty(allFm.getIDCARD()) && allFm.getIDCARD().length() == 18){
  617 + String birthstr = allFm.getIDCARD().substring(6, 14);
  618 + pat1.setBirth(DateUtil.parseYYYYMMDD(birthstr));
  619 + }
  620 + if(StringUtils.getAgeByCertId(allFm.getIDCARD()) != 0){
  621 + pat1.setAge(StringUtils.getAgeByCertId(allFm.getIDCARD()));
  622 + }
553 623 pat1.setPhone(allFm.getPHONE());
554 624 pat1.setFmDate(DateUtil.parseYMD(allFm.getBABY_DELIVERY_TIME()));
555   -// pat1.setServiceStatus(request.getServiceStatus());
556   -// pat1.setServiceType(request.getServiceType());
557 625 pat1.setHospitalId(HOSPITALID);
558 626 pat1.setBookbuildingDate(new Date());
559 627 pat1.setYn(YnEnums.YES.getId());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyAfterVisitServiceImpl.java View file @ c481a98
... ... @@ -811,8 +811,10 @@
811 811 if (Objects.equals(STATUS_TYPE_TEMPORARY_DOCUMENT, statusType)) {
812 812 // 新增数据
813 813 Future<List<BabyAfterVisitStatisticsModel>> listFuture = service.submit(new BabyAfterVisitStatisticsModelWork(models, mongoTemplate, screenMapper, false));
814   - List<BabyAfterVisitStatisticsModel> statisticsModels = listFuture.get();
815   - mongoTemplate.insert(statisticsModels, BabyAfterVisitStatisticsModel.class);
  814 + if(listFuture != null){//空指针异常处理
  815 + List<BabyAfterVisitStatisticsModel> statisticsModels = listFuture.get();
  816 + mongoTemplate.insert(statisticsModels, BabyAfterVisitStatisticsModel.class);
  817 + }
816 818 }
817 819 // 更新儿保数量
818 820 if (Objects.equals(STATUS_TYPE_CHECK, statusType)) {