Explorar o código

父子医嘱。

DESKTOP-0GD05B0\Administrator %!s(int64=2) %!d(string=hai) anos
pai
achega
0eacee8a09

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

@@ -240,11 +240,13 @@ public interface YiZhuLuRuDao {
     List<XinZhenYzActOrder> getOrdersToDelete(@Param(Constants.WRAPPER) Wrapper<?> wq);
 
     @Update("update yz_act_order " +
-            "set order_time  = #{order.orderTime,jdbcType=TIMESTAMP}, " +
+            "set " +
+            "    order_time  = #{order.orderTime,jdbcType=TIMESTAMP}, " +
             "    start_time  = #{order.startTime,jdbcType=TIMESTAMP}, " +
             "    end_time    = #{order.endTime,jdbcType=TIMESTAMP}, " +
             "    supply_code = #{order.supplyCode}, " +
-            "    frequ_code  = #{order.frequCode} " +
+            "    frequ_code  = #{order.frequCode}," +
+            "    group_no  = #{order.groupNo} " +
             "where act_order_no = ${orderNo} ")
     void updateSubOrderStatus(BigDecimal orderNo, XinZhenYzActOrder order);
 
@@ -332,13 +334,15 @@ public interface YiZhuLuRuDao {
     @Select("select act_order_no, " +
             "rtrim(status_flag) as status_flag," +
             "rtrim(frequ_code) as frequ_code," +
-            "enter_oper," +
+            "rtrim(supply_code) as supply_code, " +
             "inpatient_no," +
             "admiss_times," +
             "enter_oper," +
-            "order_time," +
             "rtrim(serial) as serial," +
+            "order_time," +
             "start_time," +
+            "end_time," +
+            "group_no," +
             "ward_code," +
             "parent_no " +
             "from yz_act_order with (NOLOCK) " +
@@ -624,7 +628,11 @@ public interface YiZhuLuRuDao {
             "                       rtrim(supply_code) supply_code, " +
             "    supply_code_name = (select rtrim(supply_name) " +
             "                        from yz_supply_type " +
-            "                        where yz_act_order.supply_code = yz_supply_type.supply_code)" +
+            "                        where yz_act_order.supply_code = yz_supply_type.supply_code)," +
+            "                       group_no, " +
+            "    group_no_name    = (select rtrim(group_name) " +
+            "                        from yp_zd_group_name " +
+            "                        where yp_zd_group_name.group_no = yz_act_order.group_no) " +
             "FROM yz_act_order with (NOLOCK) " +
             "WHERE inpatient_no = #{patNo} " +
             "  AND admiss_times = #{times} " +
@@ -1619,16 +1627,18 @@ public interface YiZhuLuRuDao {
     void insertDetailedMedicineList(Integer pageNo, XinZhenYiZhu patInfo, String userCode, String groupNo, List<XinZhenYzActOrder> list);
 
 
-    @Update("<script>" +
-            "update yz_act_order set parent_no = #{actOrderNo}," +
-            "       supply_code = '044' " +
-            "where act_order_no in " +
-            "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
-            "#{item}" +
-            "</foreach>" +
-            " and group_no &lt;&gt; '00' and status_flag = '1' " +
-            "</script>")
-    void associateOrders(List<BigDecimal> list, String actOrderNo);
+    @Update("update yz_act_order " +
+            "    set " +
+            "    parent_no =    ${order.actOrderNo}," +
+            "    order_time  = #{order.orderTime,jdbcType=TIMESTAMP}, " +
+            "    start_time  = #{order.startTime,jdbcType=TIMESTAMP}, " +
+            "    end_time    = #{order.endTime,jdbcType=TIMESTAMP}, " +
+            "    supply_code = #{order.supplyCode}, " +
+            "    frequ_code  = #{order.frequCode}," +
+            "    group_no  = #{order.groupNo} " +
+            "where act_order_no = ${children} " +
+            " and group_no <> '00' and status_flag = '1' ")
+    void associateOrders(BigDecimal children, XinZhenYzActOrder order);
 
 
 }

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

@@ -256,7 +256,7 @@ public class YiZhuLuRuServer {
         if (!parent.getFrequCode().equals(children.getFrequCode())) {
             return true;
         }
-        return false;
+        return !parent.getGroupNo().equals(children.getGroupNo());
     }
 
 
@@ -1440,7 +1440,9 @@ public class YiZhuLuRuServer {
         if (order.getParentNo() != null) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "操作失败,父医嘱不能为子医嘱。");
         }
-        dao.associateOrders(param.getAssociatedGroup(), param.getActOrderNo());
+        param.getAssociatedGroup().forEach(item -> {
+            dao.associateOrders(item, order);
+        });
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "关联成功。");
     }