Commit f634234fdac1d8fe7c2905099b0eb4628470d9dc

Authored by shiyang
1 parent 1c4619a9f3

update

Showing 1 changed file with 131 additions and 35 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LivelihoodProjectsFacade.java View file @ f634234
... ... @@ -280,11 +280,9 @@
280 280 //系统录入时间
281 281 map.put("entering_time",null!=model.getCreated()?DateUtil.getyyyy_MM_dd_hms(model.getCreated()):DateUtil.getyyyy_MM_dd_hms(new Date()));
282 282 //所属机构编码
283   - String organ_id="/";
284   - if(StringUtils.isNotEmpty(model.getHospitalId())){
285   - organ_id =organizationService.getPlatHosNewCode(model.getHospitalId());
286   - }
287   - map.put("organ_id",organ_id);
  283 + String hospital_name = couponMapper.findHospitalNameById(model.getHospitalId());
  284 + String organ_id=organizationService.getPlatHosNewCode(hospital_name);
  285 + map.put("organ_id", StringUtils.isNotEmpty(organ_id)?organ_id:"/");
288 286 //现住址国家区划编码(现住址国家区划编码(村/居委会)取 县/区 级的编码
289 287 String areaName="";
290 288 if(StringUtils.isNotEmpty(model.getAreaId())){
291 289  
... ... @@ -429,13 +427,13 @@
429 427 map.put("age", age);
430 428 //身高(cm) 默认取 最小值
431 429 Integer babyHeight=20;
432   - if(StringUtils.isNotEmpty(model.getBabyHeight())){
  430 + if(StringUtils.isNotEmpty(model.getBabyHeight()) && NumberUtils.isNumber(model.getBabyHeight())){
433 431 babyHeight=Integer.parseInt(String.valueOf(Math.round(Double.parseDouble(model.getBabyHeight()))));
434 432 }
435 433 map.put("height", babyHeight);
436 434 //体重(g) 默认取 最小值
437 435 Integer babyWeight=200;
438   - if(StringUtils.isNotEmpty(model.getBabyWeight())){
  436 + if(StringUtils.isNotEmpty(model.getBabyWeight()) && NumberUtils.isNumber(model.getBabyHeight())){
439 437 babyWeight=Integer.parseInt(String.valueOf(Math.round(Double.parseDouble(model.getBabyWeight()))));
440 438 }
441 439 map.put("weight", babyWeight);
... ... @@ -490,11 +488,9 @@
490 488 //录入系统时间
491 489 map.put("entering_time", null!=model.getCreated()?DateUtil.getyyyy_MM_dd_hms(model.getCreated()):DateUtil.getyyyy_MM_dd_hms(new Date()));
492 490 //所属机构编码
493   - String organ_id="/";
494   - if(StringUtils.isNotEmpty(model.getHospitalId())){
495   - organ_id =organizationService.getPlatHosNewCode(model.getHospitalId());
496   - }
497   - map.put("organ_id", organ_id);
  491 + String hospital_name = couponMapper.findHospitalNameById(model.getHospitalId());
  492 + String organ_id=organizationService.getPlatHosNewCode(hospital_name);
  493 + map.put("organ_id", StringUtils.isNotEmpty(organ_id)?organ_id:"/");
498 494 //现住址国家区划编码(取 县/区 级的编码) 分别两个地址获取,谁不是空用谁
499 495 String areaName="/";
500 496 if(StringUtils.isNotEmpty(model.getAreaId())){
... ... @@ -723,11 +719,9 @@
723 719 //建档日期
724 720 map.put("this_date",null!=patients.getBookbuildingDate()?DateUtil.getyyyy_MM_dd_hms(patients.getBookbuildingDate()):DateUtil.getyyyy_MM_dd_hms(new Date()));
725 721 //所属机构编码
726   - String organ_id="/";
727   - if(StringUtils.isNotEmpty(patients.getHospitalId())){
728   - organ_id =organizationService.getPlatHosNewCode(patients.getHospitalId());
729   - }
730   - map.put("organ_id", organ_id);
  722 + String hospital_name = couponMapper.findHospitalNameById(patients.getHospitalId());
  723 + String organ_id=organizationService.getPlatHosNewCode(hospital_name);
  724 + map.put("organ_id", StringUtils.isNotEmpty(organ_id)?organ_id:"/");
731 725 //关联妇女档id
732 726 String person_id="/";
733 727 if(StringUtils.isNotEmpty(patients.getCardNo())){
734 728  
... ... @@ -909,19 +903,14 @@
909 903 //开奶时间
910 904 map.put("milk_open_time", null);
911 905 //分娩机构(分娩医疗机构统一社会信用代码)
912   - String delivery_institution_id="/";
913   - if(StringUtils.isNotEmpty(model.getFmHospital())){
914   - delivery_institution_id =organizationService.getPlatHosNewCode(model.getFmHospital());
915   - }
916   - map.put("delivery_institution_id", delivery_institution_id);
  906 + String delivery_institution_id=organizationService.getPlatHosNewCode(birth_hospital_name);
  907 + map.put("delivery_institution_id", StringUtils.isNotEmpty(delivery_institution_id)?delivery_institution_id:"/");
917 908 //录入系统时间
918 909 map.put("entering_time", null!=model.getCreated()?DateUtil.getyyyy_MM_dd_hms(model.getCreated()):DateUtil.getyyyy_MM_dd_hms(new Date()));
919 910 //所属机构编码(所属医疗机构统一社会信用代码)
920   - String organ_id="/";
921   - if(StringUtils.isNotEmpty(model.getHospitalId())){
922   - organ_id =organizationService.getPlatHosNewCode(model.getHospitalId());
923   - }
924   - map.put("organ_id", organ_id);
  911 + String hospital_name = couponMapper.findHospitalNameById(model.getHospitalId());
  912 + String organ_id=organizationService.getPlatHosNewCode(hospital_name);
  913 + map.put("organ_id", StringUtils.isNotEmpty(organ_id)?organ_id:"/");
925 914 //关联妇女档id
926 915 String person_id="/";
927 916 if(StringUtils.isNotEmpty(model.getParentId())){
928 917  
... ... @@ -976,15 +965,122 @@
976 965 List<MaternalDeliverModel> fmList = mongoTemplate.find(query, MaternalDeliverModel.class);
977 966 List<Map> data = new ArrayList<>();
978 967 for (MaternalDeliverModel model : fmList) {
979   - try {
980   - Map map=new HashMap();
  968 + for (MaternalDeliverModel.Baby baby : model.getBaby()) {
  969 + try {
  970 + Map map=new HashMap();
  971 + //id
  972 + map.put("id", StringUtils.isNotEmpty(baby.getId())?baby.getId():"/");
  973 + //性别
  974 + String gender_code="0";
  975 + if(StringUtils.isNotEmpty(baby.getBabyGender())){
  976 + switch (baby.getBabyGender()){
  977 + case "1":
  978 + gender_code="1";
  979 + break;
  980 + case "0":
  981 + gender_code="2";
  982 + break;
  983 + }
  984 + }
  985 + map.put("gender_code", gender_code);
  986 + //出生孕周
  987 + Integer week_num=0;
  988 + if(StringUtils.isNotEmpty(model.getDueWeek())){
  989 + String[] week = model.getDueWeek().split("周");
  990 + if (NumberUtils.isNumber(week[0])) {
  991 + week_num=Integer.parseInt(week[0]);
  992 + }
  993 + }
  994 + map.put("week_num", week_num);
  995 + //出生孕天
  996 + Integer day_num=0;
  997 + if(StringUtils.isNotEmpty(model.getDueWeek())){
  998 + String[] week = model.getDueWeek().split("[+]");
  999 + if (week.length==2 && NumberUtils.isNumber(week[1].substring(0,week[1].length()-1))) {
  1000 + day_num=Integer.parseInt(week[1].substring(0,week[1].length()-1));
  1001 + }
  1002 + }
  1003 + map.put("day_num", day_num);
  1004 + //出生体重(g)
  1005 + Integer weight=200;
  1006 + if(StringUtils.isNotEmpty(baby.getBabyWeight()) && NumberUtils.isNumber(baby.getBabyWeight())){
  1007 + weight=Integer.parseInt(String.valueOf(Math.round(Double.parseDouble(baby.getBabyWeight()))));
  1008 + }
  1009 + map.put("weight", weight);
  1010 + //出生身长(cm)
  1011 + Integer height=20;
  1012 + if(StringUtils.isNotEmpty(baby.getBabyHeight()) && NumberUtils.isNumber(baby.getBabyHeight())){
  1013 + height=Integer.parseInt(String.valueOf(Math.round(Double.parseDouble(baby.getBabyHeight()))));
  1014 + }
  1015 + map.put("height", height);
  1016 + //接生人员姓名
  1017 + String mid_wife="/";
  1018 + if(StringUtils.isNotEmpty(model.getDeliverDoctor())) {
  1019 + Users user = usersService.getUsers(Integer.parseInt(model.getDeliverDoctor()));
  1020 + if (null!=user && StringUtils.isNotEmpty(user.getName())) {
  1021 + mid_wife=user.getName();
  1022 + }
  1023 + }
  1024 + map.put("mid_wife", mid_wife);
  1025 + //出生地点分类
  1026 + map.put("birth_place_code", "/");
  1027 + //
  1028 + map.put("", "/");
  1029 + //
  1030 + map.put("", "/");
  1031 + //
  1032 + map.put("", "/");
  1033 + //
  1034 + map.put("", "/");
  1035 + //
  1036 + map.put("", "/");
  1037 + //
  1038 + map.put("", "/");
  1039 + //
  1040 + map.put("", "/");
  1041 + //
  1042 + map.put("", "/");
  1043 + //
  1044 + map.put("", "/");
  1045 + //
  1046 + map.put("", "/");
  1047 + //
  1048 + map.put("", "/");
  1049 + //
  1050 + map.put("", "/");
  1051 + //
  1052 + map.put("", "/");
  1053 + //
  1054 + map.put("", "/");
  1055 + //
  1056 + map.put("", "/");
  1057 + //
  1058 + map.put("", "/");
  1059 + //
  1060 + map.put("", "/");
  1061 + //
  1062 + map.put("", "/");
  1063 + //
  1064 + map.put("", "/");
  1065 + //
  1066 + map.put("", "/");
  1067 + //
  1068 + map.put("", "/");
  1069 + //
  1070 + map.put("", "/");
  1071 + //
  1072 + map.put("", "/");
  1073 + //
  1074 + map.put("", "/");
  1075 + //
  1076 + map.put("", "/");
  1077 + //
  1078 + map.put("", "/");
981 1079  
982   -
983   -
984   -
985   - data.add(map);
986   - } catch (Exception e) {
987   - e.printStackTrace();
  1080 + data.add(map);
  1081 + } catch (Exception e) {
  1082 + e.printStackTrace();
  1083 + }
988 1084 }
989 1085 }
990 1086