Переглянути джерело

全方面兼容年龄模版处理

chengyao 4 роки тому
батько
коміт
e5d5c66ddd

+ 35 - 0
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -38,6 +38,7 @@ import com.diagbot.vo.TaskVO;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -562,6 +563,40 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         List<HomeDiagnoseInfo> homePageList = new ArrayList<>();
         List<HomeOperationInfo> homeOperationInfoList = new ArrayList<>();
         if (homePage != null) {
+            if(StringUtils.isNotEmpty(homePage.getAge())){
+                //兼容数据库出现 .03岁异常数据
+                if(homePage.getAge().contains(".")){
+                    String ageString = homePage.getAge().split("\\.")[0];
+                    homePage.setAge(StringUtils.isEmpty(ageString)==true? "0"+homePage.getAge():homePage.getAge());
+                }
+                //根据时间单位对模版年龄进行区分
+                String ageUnitString = homePage.getAgeUnit() == null ? "" : homePage.getAgeUnit();
+                if(Double.parseDouble(homePage.getAge())<=1&& "岁".equals(ageUnitString)){
+                    homePage.setNewbornMonth(StringUtils.isEmpty(homePage.getNewbornMonth())==true ? "0":homePage.getNewbornMonth());
+                    homePage.setNewbornDay(StringUtils.isEmpty(homePage.getNewbornDay())==true ? "0":homePage.getNewbornDay());
+                }else if("月".equals(ageUnitString)){
+                    if(StringUtils.isEmpty(homePage.getNewbornDay())==true){
+                        homePage.setNewbornMonth(StringUtils.isEmpty(homePage.getNewbornMonth())==true ? homePage.getAge() : homePage.getNewbornMonth());
+                    }else if(StringUtils.isEmpty(homePage.getNewbornMonth())==true&&StringUtils.isEmpty(homePage.getNewbornDay())==false){
+                        homePage.setNewbornMonth("0");
+                    }
+                    homePage.setNewbornDay(StringUtils.isEmpty(homePage.getNewbornDay())==true ? "0":homePage.getNewbornDay());
+                }else if("天".equals(ageUnitString)||"日".equals(ageUnitString)){
+                    homePage.setNewbornMonth(StringUtils.isEmpty(homePage.getNewbornMonth())==true ? "0":homePage.getNewbornMonth());
+                    homePage.setNewbornDay(StringUtils.isEmpty(homePage.getNewbornDay())==true ? homePage.getAge() : homePage.getNewbornDay());
+                }
+                else if("时".equals(ageUnitString)){
+                    homePage.setNewbornMonth(StringUtils.isEmpty(homePage.getNewbornMonth())==true ? "0":homePage.getNewbornMonth());
+                    homePage.setNewbornDay(StringUtils.isEmpty(homePage.getNewbornDay())==true ? "0":homePage.getNewbornDay());
+                }else if(Double.parseDouble(homePage.getAge())>1&& "岁".equals(ageUnitString)){
+                    homePage.setNewbornMonth("-");
+                    homePage.setNewbornDay("-");
+                }
+                homePage.setAge(homePage.getAge()+(StringUtils.isEmpty(homePage.getAgeUnit())==true ? "":homePage.getAgeUnit()));
+
+            }
+            //去掉年龄单位
+            homePage.setAgeUnit("");
             // 获取首页出院诊断、病理诊断
             homePageList = homeDiagnoseInfoFacade.list(new QueryWrapper<HomeDiagnoseInfo>()
                     .eq("is_deleted", IsDeleteEnum.N.getKey())