Browse Source

修复出院病历

yeguodong 1 week ago
parent
commit
6b1842c60f

+ 37 - 7
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuLuRuDao.java

@@ -1012,13 +1012,14 @@ public interface YiZhuLuRuDao {
     default XinZhenYiZhu queryPatientInfo(String patNo,
                                           Integer times) {
         XinZhenYiZhu xinZhenYiZhu = this.sqlQueryPatientInfo(patNo, times);
-        if(xinZhenYiZhu != null) {
-            Date birthDate = xinZhenYiZhu.getBirthDate();
-            if (birthDate != null) {
-                try {
-                    xinZhenYiZhu.setAge(DateUtil.calculateAge(birthDate, xinZhenYiZhu.getAdmissDate()));
-                } catch (Exception ignore) {
-                }
+        if(xinZhenYiZhu == null) {
+            xinZhenYiZhu = this.sqlQueryOutPatientInfo(patNo, times);
+        }
+        Date birthDate = xinZhenYiZhu.getBirthDate();
+        if (birthDate != null) {
+            try {
+                xinZhenYiZhu.setAge(DateUtil.calculateAge(birthDate, xinZhenYiZhu.getAdmissDate()));
+            } catch (Exception ignore) {
             }
         }
         return xinZhenYiZhu;
@@ -1053,6 +1054,35 @@ public interface YiZhuLuRuDao {
     XinZhenYiZhu sqlQueryPatientInfo(@Param("patNo") String patNo,
                                      @Param("times") Integer times);
 
+    @Select("select          rtrim(a.inpatient_no)                as inpatient_no,\n" +
+            "                admiss_times,\n" +
+            "                rtrim(a.name)                        as name,\n" +
+            "                rtrim(dept)                          as dept_code,\n" +
+            "                a.sex,\n" +
+            "                birth_date,\n" +
+            "                rtrim(zk_ward)                       as ward_code,\n" +
+            "                refer_physician,\n" +
+            "                dept_director,\n" +
+            "                times_billed,\n" +
+            "                admiss_date,\n" +
+            "                admiss_diag,\n" +
+            "                small_dept,\n" +
+            "                bed_no,\n" +
+            "                zk_ward,\n" +
+            "    ledger_sn = (select max(ledger_sn)\n" +
+            "                 from zy_ledger_file with (NOLOCK)\n" +
+            "                 where a.inpatient_no = zy_ledger_file.inpatient_no\n" +
+            "                   and a.admiss_times = zy_ledger_file.admiss_times),\n" +
+            "                consult_physician,\n" +
+            "                zy_serial_no\n" +
+            "from zy_inactpatient a with (NOLOCK),\n" +
+            "     a_patient_mi b\n" +
+            "where a.inpatient_no = b.inpatient_no\n" +
+            "  and a.inpatient_no = #{patNo}\n" +
+            "  and admiss_times = #{times}")
+    XinZhenYiZhu sqlQueryOutPatientInfo(@Param("patNo") String patNo,
+                                     @Param("times") Integer times);
+
     @Select("<script>" +
             "select top 20 * from (" +
             "SELECT row_number() over (order by pattern_code ) row_number," +