chengyao 4 yıl önce
ebeveyn
işleme
965abb2de6

+ 13 - 6
src/main/java/com/diagbot/facade/BehospitalInfoFacade.java

@@ -564,13 +564,15 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
         List<HomeOperationInfo> homeOperationInfoList = new ArrayList<>();
         if (homePage != null) {
             if(StringUtils.isNotEmpty(homePage.getAge())){
-                //兼容数据库出现 .03岁异常数据
-                if(homePage.getAge().contains(".")){
+                //兼容数据库出现 .03岁数据 作后期判断处理
+                String ageData = homePage.getAge();
+                String ageUnitString = homePage.getAgeUnit() == null ? "" : homePage.getAgeUnit();
+                if(homePage.getAge().contains(".")&&"岁".equals(ageUnitString)){
                     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());
@@ -582,8 +584,13 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                     }
                     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());
+                    if(StringUtils.isEmpty(homePage.getNewbornMonth())&&StringUtils.isEmpty(homePage.getNewbornDay())){
+                        homePage.setNewbornDay(homePage.getAge());
+                        homePage.setNewbornMonth(StringUtils.isEmpty(homePage.getNewbornMonth())==true ? "0":homePage.getNewbornMonth());
+                    }else{
+                        homePage.setNewbornMonth(StringUtils.isEmpty(homePage.getNewbornMonth())==true ? "0":homePage.getNewbornMonth());
+                        homePage.setNewbornDay(StringUtils.isEmpty(homePage.getNewbornDay())==true ? "0" : homePage.getNewbornDay());
+                    }
                 }
                 else if("时".equals(ageUnitString)){
                     homePage.setNewbornMonth(StringUtils.isEmpty(homePage.getNewbornMonth())==true ? "0":homePage.getNewbornMonth());
@@ -592,7 +599,7 @@ public class BehospitalInfoFacade extends BehospitalInfoServiceImpl {
                     homePage.setNewbornMonth("-");
                     homePage.setNewbornDay("-");
                 }
-                homePage.setAge(homePage.getAge()+(StringUtils.isEmpty(homePage.getAgeUnit())==true ? "":homePage.getAgeUnit()));
+                homePage.setAge(ageData+(StringUtils.isEmpty(homePage.getAgeUnit())==true ? "":homePage.getAgeUnit()));
 
             }
             //去掉年龄单位

+ 12 - 12
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -41,7 +41,7 @@
 
     <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
         SELECT * FROM (
-        select t.*,
+        select   t.*,
         CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
         CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
         g.check_type AS ch_type,
@@ -52,7 +52,7 @@
         h.check_time AS mr_time
         from (
         select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
-        grade_time, c.age, e.score_res as score_bn from med_behospital_info a
+        grade_time,IF(c.age is null, null,CONCAT( c.age,IF(c.age_unit is null, "",c.age_unit)))as age,e.score_res as score_bn from med_behospital_info a
         LEFT JOIN med_qcresult_info b
         on a.behospital_code = b.behospital_code and b.is_deleted = 'N'
         left join med_home_page c
@@ -349,7 +349,7 @@
         b.score_res,
         e.score_res as score_bn,
         b.gmt_create AS grade_time,
-        c.age
+        IF(c.age is null, null,CONCAT( c.age,IF(c.age_unit is null, "",c.age_unit)))as age
         FROM
         med_behospital_info a
         JOIN sys_user_dept d
@@ -468,7 +468,7 @@
         b.score_res,
         e.score_res as score_bn,
         b.gmt_create AS grade_time,
-        c.age
+        IF(c.age is null, null,CONCAT( c.age,IF(c.age_unit is null, "",c.age_unit)))as age
         FROM
         med_behospital_info a
         JOIN
@@ -582,7 +582,7 @@
         h.check_time AS mr_time
         from (
         select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
-        grade_time, c.age, e.score_res as score_bn from med_behospital_info a
+        grade_time,IF(c.age is null, null,CONCAT( c.age,IF(c.age_unit is null, "",c.age_unit)))as age, e.score_res as score_bn from med_behospital_info a
         LEFT JOIN med_qcresult_info b
         on a.behospital_code = b.behospital_code and b.is_deleted = 'N'
         LEFT JOIN med_qcresult_cases e
@@ -3924,7 +3924,7 @@
         t1.gmt_create AS gradeTime,
         t1.diagnose,
         t1.ward_name AS wardName,
-        t2.age,
+        IF(t2.age is null, null,CONCAT( t2.age,IF(t2.age_unit is null, "",t2.age_unit)))as age,
         t1.file_code AS fileCode,
         t1.checkStatus,
         t1.mrStatus,
@@ -4287,7 +4287,7 @@
     </select>
 
     <update id="updateBatchByKey">
-        <foreach collection="list" item="item" separator=";">
+        <foreach collection="list" item="item"  separator=";">
             update med_behospital_info
             <set>
                 <if test="item.name != null">
@@ -5190,7 +5190,7 @@
     <select id="getAge" resultType="java.util.Map">
         SELECT
         a.behospital_code as behospitalCode,
-        a.age as age
+        IF(a.age is null, null,CONCAT( a.age,IF(a.age_unit is null, "",a.age_unit)))as age,
         FROM
         med_home_page a
         WHERE
@@ -6448,7 +6448,7 @@
         t1.gmt_create AS gradeTime,
         t1.diagnose AS diagnose,
         t1.ward_name AS wardName,
-        t2.age AS age,
+        IF(t2.age is null, null,CONCAT( t2.age,IF(t2.age_unit is null, "",t2.age_unit)))as age,
         t1.file_code AS fileCode,
         t1.checkStatus AS checkStatus,
         t1.mrStatus AS mrStatus,
@@ -7282,7 +7282,7 @@
         t1.gmt_create AS gradeTime,
         t1.diagnose,
         t1.ward_name AS wardName,
-        t2.age,
+        IF(t2.age is null, null,CONCAT( t2.age,IF(t2.age_unit is null, "",t2.age_unit)))as age,
         t1.file_code AS fileCode,
         t1.checkStatus,
         t1.mrStatus,
@@ -7550,7 +7550,7 @@
         t1.gmt_create AS gradeTime,
         t1.diagnose,
         t1.ward_name AS wardName,
-        t2.age,
+        IF(t2.age is null, null,CONCAT( t2.age,IF(t2.age_unit is null, "",t2.age_unit)))as age,
         t1.file_code AS fileCode,
         t1.checkStatus,
         t1.mrStatus,
@@ -9272,7 +9272,7 @@
         t1.gmt_create AS gradeTime,
         t1.diagnose,
         t1.ward_name AS wardName,
-        t2.age,
+        IF(t2.age is null, null,CONCAT( t2.age,IF(t2.age_unit is null, "",t2.age_unit)))as age,
         t1.file_code AS fileCode,
         t1.checkStatus,
         t1.mrStatus,