Quellcode durchsuchen

全排斥医嘱和撤销医嘱

xiaochan vor 2 Jahren
Ursprung
Commit
c1d32ddbac

+ 11 - 5
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/OrderQuashDao.java

@@ -18,10 +18,12 @@ public interface OrderQuashDao extends BaseMapper<ReqOrderQuash> {
             "        where pat.inpatient_no = pat_no " +
             "          and pat.admiss_times = times) as name, " +
             "       times, " +
-            "       count(1)                         as count,state " +
-            "from req_order_quash " +
-            "  ${ew.customSqlSegment} " +
-            "group by pat_no, times,state")
+            "       count(1)                         as count,state," +
+            "       ward_name = (select rtrim(name) from zd_unit_code where ward = code)  " +
+            "from req_order_quash,zy_actpatient b " +
+            "  ${ew.customSqlSegment} and pat_no = inpatient_no " +
+            "  and times = admiss_times " +
+            "group by pat_no, times,state,ward ")
     List<ReturnReqOrderQuash> selectReqListGroupBy(@Param("ew") QueryWrapper<ReturnReqOrderQuash> queryWrapper);
 
     @Select("select a.act_order_no, " +
@@ -35,7 +37,11 @@ public interface OrderQuashDao extends BaseMapper<ReqOrderQuash> {
             "       pat_no, " +
             "       times, " +
             "       b.order_name, " +
-            "       b.frequ_code " +
+            "       b.frequ_code, " +
+            "       enter_oper_name = (select rtrim(name) from a_employee_mi where code = enter_oper)," +
+            "       order_time, " +
+            "       start_time, " +
+            "       end_time " +
             "from req_order_quash a " +
             "         left join view_xc_act_and_erase_order b on (a.act_order_no = b.act_order_no) " +
             "where pat_no = #{patNo} " +

+ 18 - 10
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuLuRuDao.java

@@ -471,15 +471,22 @@ public interface YiZhuLuRuDao {
      * @param orderNo 医嘱号
      * @return 数据
      */
-    @Select("select rtrim(status_flag) status_flag, order_name, act_order_no,frequ_code " +
+    @Select("select rtrim(status_flag) status_flag,order_name, act_order_no,frequ_code " +
             "from yz_act_order with (NOLOCK) " +
             "where inpatient_no = #{patNo} " +
             "  and admiss_times = #{times} " +
-            "  and status_flag in (1, 2)" +
-            "  and act_order_no <> #{orderNo}")
-    List<XinZhenYzActOrder> thereAreUnexecutedOrders(String patNo,
-                                                     Integer times,
-                                                     BigDecimal orderNo);
+            "  and status_flag in ('1', '2')" +
+            "  and act_order_no <> #{orderNo} " +
+            "  and frequ_code = N'ONCE'" +
+            " union all " +
+            "select rtrim(status_flag) status_flag,order_name, act_order_no,frequ_code " +
+            "from yz_act_order with (NOLOCK) " +
+            "where inpatient_no = #{patNo} " +
+            "  and admiss_times = #{times} " +
+            "  and status_flag in ('1') " +
+            "  and act_order_no <> #{orderNo} " +
+            "  and frequ_code <> N'ONCE' ")
+    List<XinZhenYzActOrder> thereAreUnexecutedOrders(String patNo, Integer times, BigDecimal orderNo);
 
     @Select("select count(1) " +
             "from yz_act_order " +
@@ -497,13 +504,14 @@ public interface YiZhuLuRuDao {
     @Update("update yz_act_order " +
             "set modifier           = #{userCode}, " +
             "    end_time           = #{date}, " +
-            "    exclu_act_order_no = #{orderNo} " +
+            "    exclu_act_order_no = #{orderNo}, " +
+            "    status_flag = '5' " +
             "where inpatient_no = #{patNo} " +
             "  and admiss_times = #{times} " +
-            "  and status_flag in ('3', '4') " +
+            "  and status_flag in ('2','3','4') " +
             "  and frequ_code != 'ONCE' " +
-            "  and act_order_no <> #{orderNo} " +
-            "  AND (end_time IS NULL or end_time < #{date}) ")
+            "  and act_order_no <> #{orderNo}" +
+            "  and (end_time >  #{date} or end_time is null )")
     void stopOrder(String patNo, Integer times, Date date, String userCode, BigDecimal orderNo);
 
     @Update("update yz_act_order " +

+ 14 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/orderquash/ReturnReqOrderQuash.java

@@ -3,6 +3,8 @@ package thyyxxk.webserver.entity.zhuyuanyisheng.orderquash;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.Date;
+
 @Data
 @EqualsAndHashCode(callSuper = true)
 public class ReturnReqOrderQuash extends ReqOrderQuash {
@@ -10,4 +12,16 @@ public class ReturnReqOrderQuash extends ReqOrderQuash {
     private String orderName;
     private int count;
     private String frequCode;
+    private String wardName;
+
+
+    /**
+     * 开医嘱的医生
+     */
+    private String enterOperName;
+
+    private Date orderTime;
+    private Date startTime;
+    private Date endTime;
+
 }

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

@@ -290,9 +290,10 @@ public class YiZhuLuRuServer {
                 list.forEach(item -> {
                     sb.append(StrUtil.format("医嘱名:【{}】,频次:【{}】,状态:【{}】,医嘱号:【{}】<br>", item.getOrderName(), item.getFrequCode(), item.getStatusFlagName(), item.getActOrderNo()));
                 });
-                sb.append("有未确认和未执行的医嘱,请护士先执行医嘱后开全排斥医嘱。");
+                sb.append("有未执行的临时医嘱,或者有未确认的长期医嘱。");
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_HTML_ERROR, sb.toString());
             }
+
             // 把全排斥医嘱变成临时防止给药方式错误
             dao.modifyTheFrequency(repel.getOrderNo());
             dao.stopOrder(param.getInpatientNo(), param.getAdmissTimes(), repel.getDate(), userCode, repel.getOrderNo());