Browse Source

Merge remote-tracking branch 'upstream/master'

hsh 3 years ago
parent
commit
946aa11825

+ 3 - 0
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/CaseFrontSheetDao.java

@@ -642,4 +642,7 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
 
     @Select("select * from t_case_frontsheet_surgery where bah=#{bah} and times=#{times} ")
     List<CaseFrontsheetSurgery> selectSignedSheetSurgeries(@Param("bah") String bah, @Param("times") Integer times);
+
+    @Update("update t_case_frontsheet_main set age_days=#{agedays} where bah=#{bah} and admiss_times=#{times}")
+    void updateNewBornAge(@Param("bah") String bah, @Param("times") Integer times, @Param("agedays") Integer agedays);
 }

+ 3 - 3
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiZyDao.java

@@ -40,7 +40,7 @@ public interface SiZyDao {
             "icd_text as diagName, " +
             "diagDept=(select rtrim(name) from zd_unit_code where code=( " +
             "select small_dept from zy_actpatient where zy_actpatient.inpatient_no=zy_in_diag_yb.inpatient_no)), " +
-            "oper_id as diseDorNo, " +
+            "diseDorNo=(select rtrim(isnull(yb_code,code)) from a_employee_mi where code=oper_id), " +
             "diseDorName=(select rtrim(name) from a_employee_mi where code=oper_id), " +
             "op_date as diagTime " +
             "from zy_in_diag_yb where inpatient_no=#{patNo} and admiss_times=#{times}")
@@ -61,7 +61,7 @@ public interface SiZyDao {
             "b.certno, " +
             "b.med_type, " +
             "rtrim(a.inpatient_no) as iptNo, " +
-            "rtrim(isnull(a.refer_physician,a.admiss_physician)) as atddrNo, " +
+            "atddrNo=(select rtrim(isnull(yb_code,code)) from a_employee_mi where code=isnull(a.refer_physician,a.admiss_physician)), " +
             "chfpdrName=(select rtrim(name) from a_employee_mi where code=isnull(a.refer_physician,a.admiss_physician)), " +
             "rtrim(a.small_dept) as admDeptCodg, " +
             "admDeptName=(select rtrim(name) from zd_unit_code where code=a.small_dept), " +
@@ -194,7 +194,7 @@ public interface SiZyDao {
             "rtrim(a.dis_diag) as diagCode, " +
             "rtrim(a.dis_diag_comment) as diagName, " +
             "diagDept=(select rtrim(dept_code) from a_employee_mi where code=a.op_id_code), " +
-            "a.op_id_code as diseDorNo, " +
+            "diseDorNo=(select rtrim(isnull(yb_code,code)) from a_employee_mi where code=oper_id), " +
             "diseDorName=(select rtrim(name) from a_employee_mi where code=a.op_id_code), " +
             "a.op_diag_date as diagTime " +
             "from zy_dis_diag_yb a, t_si_pat_info b " +

+ 3 - 3
src/main/java/thyyxxk/webserver/entity/casefrontsheet/CaseFrontsheetMain.java

@@ -103,17 +103,17 @@ public class CaseFrontsheetMain implements Serializable {
     /**
      * 出生天数
      */
-    private String ageDays;
+    private Integer ageDays;
 
     /**
      * 新生儿体重
      */
-    private String newBornWeight;
+    private Integer newBornWeight;
 
     /**
      * 新生儿入院体重
      */
-    private String newBornAdmissWeight;
+    private Integer newBornAdmissWeight;
 
     /**
      * 出生地编码

+ 9 - 5
src/main/java/thyyxxk/webserver/service/casefrontsheet/CaseFrontSheetMainService.java

@@ -201,6 +201,10 @@ public class CaseFrontSheetMainService {
             if (null != sheet) {
                 sheet.setDisdiagList(getSheetDisDiags(bah, times, fileStatus));
                 sheet.setSurgeryList(getSheetSurgeries(bah, times, fileStatus));
+                if (sheet.getAge() == 0 && null == sheet.getAgeDays()) {
+                    sheet.setAgeDays(DateUtil.calculateNewBornAge(sheet.getBirthDate(), sheet.getAdmissDate()));
+                    dao.updateNewBornAge(bah, times, sheet.getAgeDays());
+                }
                 return ResultVoUtil.success(sheet);
             }
         }
@@ -209,7 +213,6 @@ public class CaseFrontSheetMainService {
             flag = dao.selectActCount(bah, times) > 0 ? 1 : 2;
         }
         sheet = dao.getAPatientMi(bah);
-        sheet.setAge(DateUtil.calculateAge(sheet.getBirthDate()));
         CaseFrontsheetMain sheet1 = dao.getZyLedgerFile(bah, times);
         CaseFrontsheetMain sheet2 = flag == 1 ? dao.getZyActPatient("zy_actpatient", "yz_act_order", bah, times) :
                 dao.getZyActPatient("zy_inactpatient", "yz_inact_order", bah, times);
@@ -217,6 +220,10 @@ public class CaseFrontSheetMainService {
             sheet2 = flag == 1 ? dao.getZyActPatient("zy_inactpatient", "yz_inact_order", bah, times) :
                     dao.getZyActPatient("zy_actpatient", "yz_act_order", bah, times);
         }
+        sheet.setAge(DateUtil.calculateAge(sheet.getBirthDate(), sheet2.getAdmissDate()));
+        if (null != sheet.getAge() && sheet.getAge() == 0) {
+            sheet.setAgeDays(DateUtil.calculateNewBornAge(sheet.getBirthDate(), sheet2.getAdmissDate()));
+        }
         if (StringUtil.isBlank(sheet2.getMedType())) {
             String injurySerialNo = dao.selectInjurySerialNo(bah, times);
             if (StringUtil.notBlank(injurySerialNo)) {
@@ -456,10 +463,7 @@ public class CaseFrontSheetMainService {
         baseinfo.put("name", sheet.getName());
         baseinfo.put("age", sheet.getAge());
         baseinfo.put("sex_id", sheet.getSex());
-        String agedays = sheet.getAgeDays();
-        if (null != agedays && agedays.equals("-")) {
-            agedays = "";
-        }
+        Integer agedays = sheet.getAgeDays();
         baseinfo.put("nwb_age", agedays);
         baseinfo.put("out_hosp_id", FilterUtil.filterDismissWay(sheet.getZyDismissWay()));
         baseinfo.put("is_autopsy_id", sheet.getAutopsy());

+ 1 - 1
src/main/java/thyyxxk/webserver/service/casefrontsheet/JieShouHuiZhenService.java

@@ -74,7 +74,7 @@ public class JieShouHuiZhenService {
     public ResultVo<JieShouHuiZhenPojo> getHuanZheXinXi(Integer admissTimes, Integer reqTimes, String inpatientNo) {
         JieShouHuiZhenPojo pojo = dao.getHuanZheXinXi(admissTimes, reqTimes, inpatientNo);
         if (pojo.getBirthDate() != null) {
-            pojo.setAge(DateUtil.calculateAge(pojo.getBirthDate()));
+            pojo.setAge(DateUtil.calculateAge(pojo.getBirthDate(),null));
         }
         return ResultVoUtil.success(pojo);
     }

+ 5 - 11
src/main/java/thyyxxk/webserver/service/casefrontsheet/VerifyCaseFrontSheet.java

@@ -269,20 +269,18 @@ public class VerifyCaseFrontSheet {
         if (StringUtil.notBlank(info.getUnitPlace()) && info.getUnitPlace().length() > 16) {
             array.add(new PureCodeName("unitPlace", "患者单位地址不能超过16个汉字!"));
         }
-        if (StringUtil.notBlank(info.getAgeDays()) && !isPositiveDigital(info.getAgeDays())) {
+        if (null != info.getAgeDays() && !isPositiveDigital(String.valueOf(info.getAgeDays()))) {
             array.add(new PureCodeName("ageDays", "不足1周岁婴儿的年龄请填写正整数。"));
         }
-        if (isNewBorn(info.getHasInfant(), info.getBirthDate())) {
-            if (StringUtil.invalidValue(info.getNewBornWeight()) ||
-                    StringUtil.invalidValue(info.getNewBornAdmissWeight())) {
-                array.add(new PureCodeName("newBornWeight","请填写新生儿信息!"));
+        if (null != info.getAgeDays() && info.getAgeDays() <= 28) {
+            if (null == info.getNewBornWeight() || null == info.getNewBornAdmissWeight()) {
+                array.add(new PureCodeName("newBornWeight","请填写新生儿出生体重和入院体重!"));
             }
             if (StringUtil.invalidValue(info.getXxeApgar())) {
                 array.add(new PureCodeName("xxeApgar","新生儿Apgar评分不能为空!"));
             }
         } else {
-            if (StringUtil.validValue(info.getNewBornWeight()) ||
-                    StringUtil.validValue(info.getNewBornAdmissWeight())) {
+            if (null != info.getNewBornWeight() || null != info.getNewBornAdmissWeight()) {
                 array.add(new PureCodeName("newBornWeight","非新生儿请保持新生信息为空!"));
             }
         }
@@ -513,10 +511,6 @@ public class VerifyCaseFrontSheet {
         return phone.length() != 11 && phone.length() != 12 && phone.length() != 8;
     }
 
-    private boolean isNewBorn(String hasInfant, Date birthDate) {
-        return (StringUtil.validValue(hasInfant) && "1".equals(hasInfant)) || DateUtil.daysBetween(new Date(), birthDate) <= 28;
-    }
-
     private boolean isPositiveDigital(String string) {
         String regEx1 = "\\d+";
         Pattern p;

+ 1 - 1
src/main/java/thyyxxk/webserver/service/inpatient/PatientService.java

@@ -82,7 +82,7 @@ public class PatientService {
                 data.setTimesBilled(yiZhuLuRuDao.huoQuHuanZheXinXi(data.getInpatientNo(), data.getAdmissTimes()).getTimesBilled());
                 data.setBirthDate(getBirthdayFromSocialNo(data.getSocialNo()));
                 // 年龄
-                data.setAge(DateUtil.calculateAge(new SimpleDateFormat("yyyy-MM-dd").parse(data.getBirthDate())));
+                data.setAge(DateUtil.calculateAge(new SimpleDateFormat("yyyy-MM-dd").parse(data.getBirthDate()), data.getAdmissDate()));
             } catch (ParseException e) {
                 log.error("获取患者基本信息出错", e);
             }

+ 1 - 1
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/ShouShuShenQingServer.java

@@ -86,7 +86,7 @@ public class ShouShuShenQingServer {
         } catch (Exception e) {
             e.printStackTrace();
         }
-        op.setAge(DateUtil.calculateAge(DateUtil.parse(op.getBirthDate(), GetDateFormat.DATE)).toString());
+        op.setAge(DateUtil.calculateAge(DateUtil.parse(op.getBirthDate(), GetDateFormat.DATE), null).toString());
         return ResultVoUtil.success(op);
     }
 

+ 14 - 1
src/main/java/thyyxxk/webserver/utils/DateUtil.java

@@ -137,12 +137,15 @@ public class DateUtil {
         return df.format(yesterday);
     }
 
-    public static Integer calculateAge(Date birthDate) {
+    public static Integer calculateAge(Date birthDate, Date admdate) {
         if (null == birthDate) {
             return null;
         }
         int age;
         Calendar cal = Calendar.getInstance();
+        if (null != admdate) {
+            cal.setTime(admdate);
+        }
         if (cal.before(birthDate)) {
             throw new IllegalArgumentException("出生日期晚于当前时间,无法计算!");
         }
@@ -168,6 +171,16 @@ public class DateUtil {
         return age;
     }
 
+    public static Integer calculateNewBornAge(Date birthDate, Date admdate) {
+        if (null == birthDate || admdate == null) {
+            return null;
+        }
+        if (admdate.before(birthDate)) {
+            throw new IllegalArgumentException("出生日期晚于当前时间,无法计算!");
+        }
+        return (int) ((admdate.getTime() - birthDate.getTime()) / (1000L * 3600L * 24L));
+    }
+
     public static String now() {
         LocalDateTime time = LocalDateTime.now();
         return time.format(DateTimeFormatter.ofPattern(DEFAULT_PATTERN));