Commit ee09297ffad0ff726b007853ce6392d747e88610

Authored by zhangchao
1 parent be9b626d85
Exists in dev

#fix:优化产检数据导入逻辑

Showing 2 changed files with 105 additions and 90 deletions

platform-common/src/main/java/com/lyms/platform/common/utils/ExcelUtil.java View file @ ee09297
... ... @@ -282,30 +282,28 @@
282 282 }else if (j==2){
283 283 params.put("birth",str);
284 284 }else if (j==3){
285   - params.put("phone",str);
286   - }else if (j==4){
287 285 params.put("age",str);
  286 + }else if (j==4){
  287 + params.put("phone",str);
288 288 }else if (j==5){
289   - params.put("xian",str);
  289 + params.put("bookbuildingDate",str);
290 290 }else if (j==6){
291   - params.put("xiang",str);
  291 + params.put("lastMenses",str);
292 292 }else if (j==7){
293   - params.put("cun",str);
  293 + params.put("dueDate",str);
294 294 }else if (j==8){
295   - params.put("checkDate",str);
  295 + params.put("riskFactorId",getRiskFactorId(str));
296 296 }else if (j==9){
297   - params.put("bookbuildingDate",str);
  297 + params.put("name",str);
298 298 }else if (j==10){
299 299 params.put("currentDueDate",str);
300 300 }else if (j==11){
301   - params.put("riskFactorId",getRiskFactorId(str));
  301 + params.put("checkDate",str);
302 302 }else if (j==12){
303   - params.put("name",str);
304   - }else if (j==13){
305 303 params.put("operator",str);
306   - }else if (j==14){
  304 + }else if(j==13){
307 305 params.put("nextCheckTime",str);
308   - }else if (j==15){
  306 + }else if (j==14){
309 307 params.put("num",str);
310 308 }
311 309 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ ee09297
... ... @@ -4922,7 +4922,11 @@
4922 4922 patient.setLastReportDoctorName(users.get(0).getName());
4923 4923 }
4924 4924 }
4925   - patient.setLastMenses(DateUtil.getCurrentDueDate(map.get("currentDueDate"), map.get("checkDate")));
  4925 + if (StringUtils.isEmpty(map.get("lastMenses"))){
  4926 + patient.setLastMenses(DateUtil.getCurrentDueDate(map.get("currentDueDate"), map.get("checkDate")));
  4927 + }else {
  4928 + patient.setLastMenses(DateUtil.parseYMD(map.get("lastMenses")));
  4929 + }
4926 4930 Integer type = 1; //1孕妇 2儿童 3产妇
4927 4931 //建档类型 0 未分娩建档 1儿童建档时建档 2 自动分娩类型 3 转诊自动建档
4928 4932 Integer buildType = 0;
4929 4933  
4930 4934  
4931 4935  
... ... @@ -4965,21 +4969,28 @@
4965 4969 patient.setUsername(map.get("username"));
4966 4970 patient.setCardNo(map.get("cardNo"));
4967 4971 patient.setHospitalId("2100001504");
4968   - patient.setBookbuildingDate(DateUtil.parseYMD(map.get("checkDate")));
  4972 + patient.setBookbuildingDate(DateUtil.parseYMD(map.get("bookbuildingDate")));
4969 4973 patient.setAge(Integer.valueOf(map.get("age")));
4970 4974 patient.setBirth(DateUtil.parseYMD(map.get("birth")));
4971 4975  
4972   - patient.setAddressRegister(map.get("xian") + map.get("xiang") + map.get("cun"));
  4976 + // patient.setAddressRegister(map.get("xian") + map.get("xiang") + map.get("cun"));
4973 4977 patient.setPhone(map.get("phone"));
4974 4978 patient.setFirstCheckId(String.valueOf(patient.getOperator()));
4975 4979 patient.setFirstCheckTime(patient.getBookbuildingDate());
4976 4980 if (patient.getLastMenses() != null) {
4977 4981 patient.setBuildDays(DateUtil.getDays(patient.getLastMenses(), new Date()));
4978   - patient.setDueDate(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(DateUtil.addDay(patient.getLastMenses(), 42 * 7))));
  4982 + String dueDate=null;
  4983 + if (StringUtils.isNotEmpty(map.get("dueDate"))){
  4984 + dueDate= map.get("dueDate");
  4985 + }else {
  4986 + dueDate=DateUtil.getyyyy_MM_dd(DateUtil.addDay(patient.getLastMenses(), 42 * 7));
  4987 + }
  4988 + patient.setDueDate(DateUtil.parseYMD(dueDate));
4979 4989 }
4980 4990 patient.setDueStatus(0);
4981 4991 //1孕妇 3 产妇
4982 4992 patient.setType(type);
  4993 + patient.setNextCheckTime(DateUtil.parseYMD(map.get("nextCheckTime")));
4983 4994 if (type == 3) {
4984 4995 patient.setIsAutoFm(YnEnums.YES.getId());
4985 4996 }
4986 4997  
... ... @@ -5034,11 +5045,18 @@
5034 5045 }
5035 5046 }
5036 5047 } else {
5037   - patient.setFirstCheckTime(patient.getBookbuildingDate());
  5048 + //patient.setFirstCheckTime(patient.getBookbuildingDate());
5038 5049 patient.setNextCheckTime(DateUtil.parseYMD(map.get("nextCheckTime")));
5039 5050 if (patient.getDueDate() != null) {
5040 5051 } else {
5041   - patient.setDueDate(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(DateUtil.addDay(DateUtil.getCurrentDueDate(map.get("currentDueDate"), map.get("bookbuildingDate")), 42 * 7))));
  5052 + String dueDate=null;
  5053 + if (StringUtils.isNotEmpty(map.get("dueDate"))){
  5054 + dueDate= map.get("dueDate");
  5055 + }else {
  5056 + dueDate=DateUtil.getyyyy_MM_dd(DateUtil.addDay(patient.getLastMenses(), 42 * 7));
  5057 + }
  5058 + patient.setDueDate(DateUtil.parseYMD(dueDate));
  5059 +
5042 5060 }
5043 5061 OrganizationQuery organizationQuery = new OrganizationQuery();
5044 5062 organizationQuery.setYn(YnEnums.YES.getId());
5045 5063  
... ... @@ -5061,8 +5079,77 @@
5061 5079 Integer num = Integer.valueOf(map.get("num"));
5062 5080 AntExRecordModel antExRecordModel = new AntExRecordModel();
5063 5081 AntExChuModel antExChuModel = new AntExChuModel();
5064   - if (num > 0) {
  5082 + String riskFactor = map.get("name");
  5083 + List<String> riskFactorlist = new ArrayList<>();
  5084 + List<String> nameList = new ArrayList<>();
  5085 + List<String> riskFactorlists = new ArrayList<>();
  5086 + List<String> riskLevelId = new ArrayList<>();
  5087 + antExRecordModel.setHospitalId("2100001504");
  5088 + antExRecordModel.setLastMenses(patient.getLastMenses());
  5089 + antExRecordModel.setName(patient.getUsername());
  5090 + antExRecordModel.setNextCheckTime(DateUtil.parseYMD(map.get("nextCheckTime")));
  5091 + antExRecordModel.setBrith(DateUtil.parseYMD(map.get("birth")));
  5092 + antExRecordModel.setParentId(patient.getId());
  5093 + antExRecordModel.setPid(patient.getPid());
  5094 + antExRecordModel.setDueDate(patient.getDueDate());
  5095 + antExRecordModel.setCardNo(patient.getCardNo());
  5096 + antExRecordModel.setCheckDoctor(String.valueOf(patient.getOperator()));
  5097 + antExRecordModel.setType(1);
  5098 + antExRecordModel.setCheckTime(DateUtil.parseYMD(map.get("checkDate")));
  5099 + antExRecordModel.setBuildTime(DateUtil.parseYMD(map.get("checkDate")));
  5100 + if (antExRecordModel.getDueDate() != null) {
  5101 + antExRecordModel.setStatus(antExRecordModel.getDueDate().compareTo(new Date()) > 0 ? 2 : 1);
  5102 + antExRecordModel.setDueStatus(antExRecordModel.getStatus());
  5103 + }
5065 5104  
  5105 + if (StringUtils.isNotEmpty(riskFactor)) {
  5106 + String[] split = riskFactor.split(",");
  5107 + for (String s : split) {
  5108 + nameList.add(s);
  5109 + }
  5110 + }
  5111 + BasicConfigQuery basicConfigQuery = new BasicConfigQuery();
  5112 + basicConfigQuery.setEnable(1);
  5113 + basicConfigQuery.setNames(nameList);
  5114 + basicConfigQuery.setTypeId("fb43fd5a-b153-4cb9-9180-c46f5612ba43");
  5115 + //所有数据
  5116 + List<BasicConfig> listBasic = basicConfigService.queryBasicConfig(basicConfigQuery);
  5117 + if (CollectionUtils.isEmpty(listBasic)) {
  5118 + riskFactorlists.add(map.get("riskFactorId"));
  5119 + List<String> list1 = new ArrayList();
  5120 + list1.add("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
  5121 + antExRecordModel.sethRisk(list1);
  5122 + antExRecordModel.sethLevel(riskFactorlists);
  5123 + antExChuModel.setHighrisk(JsonUtil.array2JsonString(riskFactorlists));
  5124 + patient.setoRiskFactor(JsonUtil.array2JsonString(antExRecordModel.gethRisk()));
  5125 + patient.setRiskFactorId(antExRecordModel.gethRisk());
  5126 + patient.setRiskLevelId(JsonUtil.array2JsonString(antExRecordModel.gethLevel()));
  5127 + logger.info("riskFactorlists," + riskFactorlists.toString());
  5128 + } else {
  5129 + Integer score = 0;
  5130 + for (BasicConfig basicConfig : listBasic) {
  5131 + riskFactorlist.add(basicConfig.getId());
  5132 + riskLevelId.add(basicConfig.getParentId());
  5133 + score += Integer.valueOf(basicConfig.getCode() != null ? basicConfig.getCode() : "0");
  5134 + }
  5135 + if (CollectionUtils.isNotEmpty(riskFactorlist)) {
  5136 + antExChuModel.setHighrisk(JsonUtil.array2JsonString(riskFactorlist));
  5137 + patient.setRiskFactorId(riskFactorlist);
  5138 + antExChuModel.setHighriskSocre(String.valueOf(score));
  5139 + patient.setRiskScore(score);
  5140 + antExRecordModel.sethScore(score);
  5141 + antExRecordModel.sethRisk(riskFactorlist);
  5142 + patient.setoRiskFactor(JsonUtil.array2JsonString(antExRecordModel.gethRisk()));
  5143 +
  5144 + }
  5145 + if (CollectionUtils.isNotEmpty(riskLevelId)) {
  5146 + antExRecordModel.sethLevel(riskLevelId);
  5147 + patient.setRiskLevelId(JsonUtil.array2JsonString(riskLevelId));
  5148 + }
  5149 + }
  5150 + yunBookbuildingService.update(patient, patient.getId());
  5151 +
  5152 + if (num == 1) {
5066 5153 antExChuModel.setParentId(patient.getId());
5067 5154 antExChuModel.setName(patient.getUsername());
5068 5155 antExChuModel.setYn(YnEnums.YES.getId());
5069 5156  
5070 5157  
5071 5158  
... ... @@ -5073,84 +5160,15 @@
5073 5160 antExChuModel.setcDueWeek(com.lyms.platform.common.utils.StringUtils.dueWeek(DateUtil.daysBetween(patient.getLastMenses(), new Date())));
5074 5161 antExChuModel.setPid(patient.getPid());
5075 5162 antExChuModel.setProdDoctor(String.valueOf(patient.getOperator()));
5076   - String riskFactor = map.get("name");
5077   - List<String> riskFactorlist = new ArrayList<>();
5078   - List<String> riskLevelId = new ArrayList<>();
5079   - if (StringUtils.isNotEmpty(riskFactor)) {
5080   - String[] split = riskFactor.split(",");
5081   - for (String s : split) {
5082   - riskFactorlist.add(s);
5083   - }
5084   - BasicConfigQuery basicConfigQuery = new BasicConfigQuery();
5085   - basicConfigQuery.setEnable(1);
5086   - basicConfigQuery.setNames(riskFactorlist);
5087   - basicConfigQuery.setTypeId("fb43fd5a-b153-4cb9-9180-c46f5612ba43");
5088   - //所有数据
5089   - List<BasicConfig> listBasic = basicConfigService.queryBasicConfig(basicConfigQuery);
5090   - if (CollectionUtils.isEmpty(listBasic)) {
5091   - riskFactorlist.clear();
5092   - riskFactorlist.add(map.get("riskFactorId"));
5093   - List<String> list1 = new ArrayList();
5094   - list1.add("d42eec03-aa86-45b8-a4e0-78a0ff365fb6");
5095   - antExRecordModel.sethRisk(list1);
5096   - antExRecordModel.sethLevel(riskFactorlist);
5097   - antExChuModel.setHighrisk(JsonUtil.array2JsonString(riskFactorlist));
5098   - patient.setoRiskFactor(JsonUtil.array2JsonString(antExRecordModel.gethRisk()));
5099   - patient.setRiskFactorId(antExRecordModel.gethRisk());
5100   - patient.setRiskLevelId(JsonUtil.array2JsonString(antExRecordModel.gethLevel()));
5101 5163  
5102   - logger.info("riskFactorlist," + riskFactorlist.toString());
5103   - } else {
5104   - riskFactorlist.clear();
5105   - Integer score = 0;
5106   -
5107   - for (BasicConfig basicConfig : listBasic) {
5108   - riskFactorlist.add(basicConfig.getId());
5109   - riskLevelId.add(basicConfig.getParentId());
5110   - score += Integer.valueOf(basicConfig.getCode() != null ? basicConfig.getCode() : "0");
5111   - }
5112   - if (CollectionUtils.isNotEmpty(riskFactorlist)) {
5113   - antExChuModel.setHighrisk(JsonUtil.array2JsonString(riskFactorlist));
5114   - patient.setRiskFactorId(riskFactorlist);
5115   - antExChuModel.setHighriskSocre(String.valueOf(score));
5116   - patient.setRiskScore(score);
5117   - antExRecordModel.sethScore(score);
5118   - antExRecordModel.sethRisk(riskFactorlist);
5119   - patient.setoRiskFactor(JsonUtil.array2JsonString(antExRecordModel.gethRisk()));
5120   -
5121   - }
5122   - if (CollectionUtils.isNotEmpty(riskLevelId)) {
5123   - antExRecordModel.sethLevel(riskLevelId);
5124   - patient.setRiskLevelId(JsonUtil.array2JsonString(riskLevelId));
5125   - }
5126   - }
5127   - yunBookbuildingService.update(patient, patient.getId());
5128   - }
5129   - antExRecordModel.setHospitalId(antExChuModel.getHospitalId());
5130   - antExRecordModel.setLastMenses(antExChuModel.getLastMenses());
5131   - antExRecordModel.setName(antExChuModel.getName());
5132   - antExRecordModel.setNextCheckTime(antExChuModel.getNextCheckTime());
5133   - antExRecordModel.setBrith(DateUtil.parseYMD(map.get("birth")));
5134   - antExRecordModel.setParentId(patient.getId());
5135   - antExRecordModel.setPid(patient.getPid());
5136   - antExRecordModel.setDueDate(patient.getDueDate());
5137   - antExRecordModel.setCardNo(patient.getCardNo());
5138   - antExRecordModel.setCheckDoctor(String.valueOf(patient.getOperator()));
5139   - antExRecordModel.setType(1);
5140   - antExRecordModel.setCheckTime(antExChuModel.getCheckTime());
5141   - antExRecordModel.setBuildTime(DateUtil.parseYMD(map.get("checkDate")));
5142   - if (antExRecordModel.getDueDate() != null) {
5143   - antExRecordModel.setStatus(antExRecordModel.getDueDate().compareTo(new Date()) > 0 ? 2 : 1);
5144   - antExRecordModel.setDueStatus(antExRecordModel.getStatus());
5145   - }
5146 5164 antExRecordService.addOneRecord(antExRecordModel);
5147 5165 antenatalExaminationService.addOneAntEx(antExChuModel);
5148 5166 //初诊是添加追访记录
5149 5167 addTrackDownInfo(patient.getOperator(), patient);
5150 5168 }
5151 5169  
  5170 +
5152 5171 if (num > 1) {
5153   - for (int i = 0, j = num - 1; i < j; i++) {
5154 5172 antExRecordModel.setId(null);
5155 5173 antExRecordModel.setType(2);
5156 5174 AntenatalExaminationModel antenatalExaminationModel = new AntenatalExaminationModel();
... ... @@ -5168,7 +5186,6 @@
5168 5186 antenatalExaminationModel.setCheckDate(DateUtil.parseYMD(map.get("checkDate")));
5169 5187 antenatalExaminationService.addOneBabyAnt(antenatalExaminationModel);
5170 5188 antExRecordService.addOneRecord(antExRecordModel);
5171   - }
5172 5189 }
5173 5190 }
5174 5191 });