Browse Source

全排斥医嘱确认优化

xiaochan 2 years ago
parent
commit
52a5ddb83d

+ 2 - 1
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/JianYanJianChaDao.java

@@ -45,7 +45,8 @@ public interface JianYanJianChaDao {
     List<YshYjReq> huoQuJianChaShenQingV2(@Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
 
 
-    @Select("select *, " +
+    @Select("select *," +
+            "  inspect_stuff_name = (select rtrim(name) from jy_zd_sample with (NOLOCK) where code = inspect_stuff), " +
             "       req_dept_name   = (select rtrim(name) from zd_unit_code where code = req_dept), " +
             "       req_doctor_name = (select rtrim(name) from a_employee_mi where code = req_doctor)," +
             "       case  when req_type = '2' then (select rtrim(class) from jy_zd_item c where c.zy_order_code = order_code) " +

+ 0 - 1
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/ShouShuShenQingDao.java

@@ -137,7 +137,6 @@ public interface ShouShuShenQingDao extends BaseMapper<OpRecord> {
     Integer shouShuShenQingCiShu(@Param("patNo") String patNo,
                                  @Param("times") Integer times);
 
-
     @Insert("<script>" +
             "Insert Into op_record_join (record_id, zy_serial_no, op_times, doctor_zd, doctor_wp, doctor_1, doctor_2, doctor_3,nurse_qx, nurse_xh,doctor_mz_ys) " +
             "Values " +

+ 40 - 25
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuLuRuDao.java

@@ -495,14 +495,29 @@ public interface YiZhuLuRuDao {
                             @Param("userCode") String userCode);
 
     @Update("update yz_act_order " +
-            "set modifier = #{userCode}, " +
-            "    end_time = #{date}," +
+            "set modifier           = #{userCode}, " +
+            "    end_time           = #{date}, " +
+            "    exclu_act_order_no = #{orderNo}, " +
+            "    status_flag        = '5' " +
+            "where inpatient_no = #{patNo} " +
+            "  and admiss_times = #{times} " +
+            "  and status_flag in ('1', '2') " +
+            "  and act_order_no <> #{orderNo} " +
+            "  and act_order_no < #{orderNo}" +
+            "  AND (end_time IS NULL ) ")
+    void stopNotConfirmedOrder(String patNo, Integer times, Date date, String userCode, BigDecimal orderNo);
+
+    @Update("update yz_act_order " +
+            "set modifier           = #{userCode}, " +
+            "    end_time           = #{date}, " +
             "    exclu_act_order_no = #{orderNo} " +
             "where inpatient_no = #{patNo} " +
-            "  and admiss_times = #{times}" +
+            "  and admiss_times = #{times} " +
+            "  and status_flag in ('3', '4') " +
             "  and frequ_code != 'ONCE' " +
-            "  AND status_flag IN (3, 4, 5) " +
-            "  and isnull(end_time, dateadd(day, 1, #{date})) >= #{date} ")
+            "  and act_order_no <> #{orderNo} " +
+            "  and act_order_no < #{orderNo} " +
+            "  AND (end_time IS NULL or end_time < #{date}) ")
     void stopOrder(String patNo, Integer times, Date date, String userCode, BigDecimal orderNo);
 
     @Update("update yz_act_order " +
@@ -1380,26 +1395,26 @@ public interface YiZhuLuRuDao {
     void associateOrders(BigDecimal children, XinZhenYzActOrder order);
 
 
-    @Select("SELECT                 a.gen_time,\n" +
-            "                       inpatient_no,\n" +
-            "                       admiss_times,\n" +
-            "                       ledger_sn,\n" +
-            "                       a.detail_sn,\n" +
-            "                       a.charge_date,\n" +
-            "                       a.charge_code_mx,\n" +
-            "    charge_code_name = (case\n" +
-            "                            when serial = '99' or serial = '01'\n" +
-            "                                then (select top 1 rtrim(name)\n" +
-            "                                      from yp_zd_dict\n" +
-            "                                      where code = charge_code_mx\n" +
-            "                                        and yp_zd_dict.serial = a.serial)\n" +
-            "                            else (select rtrim(name) from zd_charge_item where code = charge_code_mx) end),\n" +
-            "                       a.charge_fee,\n" +
-            "                       a.charge_status,\n" +
-            "                       a.serial,\n" +
-            "    charge_amount=a.charge_amount,\n" +
-            "    exec_dept=(select name from zd_unit_code where code = a.exec_unit),\n" +
-            "    dept_code        = (select name from zd_unit_code where code = a.ward_code),\n" +
+    @Select("SELECT                 a.gen_time, " +
+            "                       inpatient_no, " +
+            "                       admiss_times, " +
+            "                       ledger_sn, " +
+            "                       a.detail_sn, " +
+            "                       a.charge_date, " +
+            "                       a.charge_code_mx, " +
+            "    charge_code_name = (case " +
+            "                            when serial = '99' or serial = '01' " +
+            "                                then (select top 1 rtrim(name) " +
+            "                                      from yp_zd_dict " +
+            "                                      where code = charge_code_mx " +
+            "                                        and yp_zd_dict.serial = a.serial) " +
+            "                            else (select rtrim(name) from zd_charge_item where code = charge_code_mx) end), " +
+            "                       a.charge_fee, " +
+            "                       a.charge_status, " +
+            "                       a.serial, " +
+            "    charge_amount=a.charge_amount, " +
+            "    exec_dept=(select name from zd_unit_code where code = a.exec_unit), " +
+            "    dept_code        = (select name from zd_unit_code where code = a.ward_code), " +
             "                       isnull(a.ori_detail_sn, 0) as ori_detail_sn " +
             "FROM zy_detail_charge a " +
             "where order_no = #{yz.actOrderNo} " +

+ 3 - 5
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuLuRuServer.java

@@ -284,14 +284,12 @@ public class YiZhuLuRuServer {
         Repel repel = checkData.getRepel();
 
         if (repel != null && repel.getCount() > 0) {
-            int count = dao.thereAreUnexecutedOrders(param.getInpatientNo(), param.getAdmissTimes(), repel.getOrderNo());
-            if (count > 0) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "有未确认和未执行的长期医嘱,无法确认全排斥医嘱,请先确认其他医嘱。");
-            }
             dao.stopOrder(param.getInpatientNo(), param.getAdmissTimes(), repel.getDate(), userCode, repel.getOrderNo());
+            dao.stopNotConfirmedOrder(param.getInpatientNo(), param.getAdmissTimes(), repel.getDate(), userCode, repel.getOrderNo());
+            dao.confirmOrders(repel.getOrderNo(), userCode, new Date());
+            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "全排斥医嘱确认成功,之前医嘱已被停止。");
         }
 
-
         for (BigDecimal decimal : confirmOrderInformation) {
             dao.confirmOrders(decimal, userCode, new Date());
         }