Ver Fonte

优化代码

xiaochan há 3 anos atrás
pai
commit
342a9ca4aa

+ 11 - 14
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/YiZhuLuRuDao.java

@@ -457,15 +457,17 @@ public interface YiZhuLuRuDao {
             "                          kf_flag /*饭前饭后*/,parent_no, refer_physician/*患者的管床医生*/, confirm_time/*确认时间*/, signer/*确认人*/,end_time,modifier) " +
             "VALUES " +
             "<foreach collection='list' item='item' separator=','>" +
-            "(#{item.orderCode}, #{item.orderName}, #{item.frequCode}, #{item.instruction}, #{item.discription}, #{infantFlag}, #{item.orderTime}, " +
-            "        #{inputCode}, #{item.startTime}, #{item.drugSpecification}, " +
-            "#{item.drugQuan}," +
+            "(#{item.orderCode,jdbcType=VARCHAR}, #{item.orderName,jdbcType=VARCHAR}, #{item.frequCode,jdbcType=VARCHAR}," +
+            " #{item.instruction,jdbcType=VARCHAR}, #{item.discription,jdbcType=VARCHAR}, #{infantFlag,jdbcType=VARCHAR}, " +
+            "#{item.orderTime,jdbcType=TIMESTAMP}, " +
+            "        #{inputCode}, #{item.startTime,jdbcType=TIMESTAMP}, #{item.drugSpecification}, " +
+            "#{item.drugQuan,jdbcType=DECIMAL}," +
             " #{item.supplyCode}," +
-            " #{item.actOrderNo}, #{patNo}, #{times}, " +
+            " #{item.actOrderNo,jdbcType=DECIMAL}, #{patNo}, #{times}, " +
             "#{item.drugFlag}," +
             " #{inputCode}, " +
             " getdate(), #{item.miniUnit}, " +
-            "#{item.drugWeight}, " +
+            "#{item.drugWeight,jdbcType=DECIMAL}, " +
             "#{item.drugWeightUnit}, '2', #{item.selfBuy}, " +
             "cast(#{item.dose,jdbcType=DECIMAL} as decimal(10,2))," +
             " #{item.doseUnit}, " +
@@ -475,13 +477,8 @@ public interface YiZhuLuRuDao {
             "#{item.groupNo}," +
             "'1', #{item.execUnit}, " +
             "        #{deptCode}, #{wardCode}, '0', #{item.ybSelfFlag},#{item.emergencyFlag}, #{item.kfFlag}," +
-            "<if test=\"item.parentNo != null \">" +
-            "#{item.parentNo}," +
-            "</if>" +
-            "<if test=\"item.parentNo == null \">" +
-            "null," +
-            "</if>" +
-            " #{referPhysician}, getdate(), #{inputCode},#{item.endTime},#{item.modifier})" +
+            "#{item.parentNo,jdbcType=DECIMAL}," +
+            " #{referPhysician}, getdate(), #{inputCode},#{item.endTime,jdbcType=TIMESTAMP},#{item.modifier})" +
             "</foreach>" +
             "</script>")
     void chaRuYiZhu(@Param("patNo") String patNo,
@@ -846,8 +843,8 @@ public interface YiZhuLuRuDao {
             "update op_record " +
             "set status ='d' " +
             "where act_order_no = #{actOrderNo};")
-    void genXingShanChuBiao(@Param("userCode") String userCode,
-                            @Param("actOrderNo") BigDecimal actOrderNo);
+    void genXingShanChuBiaoZhi(@Param("userCode") String userCode,
+                               @Param("actOrderNo") BigDecimal actOrderNo);
 
 
     @Update("update yz_act_order " +

+ 4 - 3
src/main/java/thyyxxk/webserver/service/PublicServer.java

@@ -56,6 +56,7 @@ public class PublicServer {
         this.transferInOfExpensesDao = transferInOfExpensesDao;
     }
 
+
     /**
      * 获取用户的角色信息
      *
@@ -69,7 +70,7 @@ public class PublicServer {
      * @param jueSeBianMa 不需要限制的角色id
      * @return Boolean
      */
-    public Boolean noNeedRule(int[] jueSeBianMa) {
+    public Boolean noNeedRule(int... jueSeBianMa) {
         return getaBoolean(jueSeBianMa, getRoleCode().getData());
     }
 
@@ -77,7 +78,7 @@ public class PublicServer {
      * @param jueSeBianMa 不需要限制的角色id
      * @return Boolean
      */
-    public Boolean noNeedRule(List<Integer> role, int[] jueSeBianMa) {
+    public Boolean noNeedRule(List<Integer> role, int... jueSeBianMa) {
         return getaBoolean(jueSeBianMa, role);
     }
 
@@ -203,7 +204,7 @@ public class PublicServer {
      * @return 返回科室
      */
     public List<String> getKeShiLieBiaoList(String deptCode) {
-        if (noNeedRule(new int[]{1})) {
+        if (noNeedRule(1)) {
             Map<String, GetDropdownBox> map = dao.getKeShiLieBiao(deptCode).stream().collect(
                     Collectors.toMap(GetDropdownBox::getCode, a -> a, (k1, k2) -> k1));
             if (StringUtil.isBlank(map.get(deptCode).getParentCode())) {

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

@@ -110,7 +110,7 @@ public class CaoYaoYiZhuServer {
                 .or()
                 .like("pattern_name", name)
         );
-        if (publicServer.noNeedRule(new int[]{1, 38})) {
+        if (publicServer.noNeedRule(1, 38)) {
             qw.eq("dept_code", deptCode);
         }
         qw.groupBy("pattern_name");
@@ -167,9 +167,9 @@ public class CaoYaoYiZhuServer {
         YzOrderPatternCy mb = dao.caoYaoMuBanXiangQing(name);
         List<Integer> rolse = publicServer.getRoleCode().getData();
         boolean flag;
-        if (publicServer.noNeedRule(rolse, new int[]{1, 38})) {
+        if (publicServer.noNeedRule(rolse, 1, 38)) {
             flag = mb.getCreateId().equals(TokenUtil.getTokenUserId());
-            if (!publicServer.noNeedRule(rolse, new int[]{11})) {
+            if (!publicServer.noNeedRule(rolse, 11)) {
                 flag = mb.getDeptCode().trim().equals(deptCode);
             }
         } else {

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

@@ -248,7 +248,7 @@ public class JianYanJianChaShenQingServer {
      * @return 返回提示
      */
     private ResultVo<String> xiuGaiMuBan(YshZdYjTemplate param, YshZdYjTemplate mb) {
-        if (publicServer.noNeedRule(new int[]{38})) {
+        if (publicServer.noNeedRule(38)) {
             if (!TokenUtil.getTokenUserId().equals(mb.getOpId().trim())) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该模板创建人不是你,无法操作。");
             }
@@ -267,7 +267,7 @@ public class JianYanJianChaShenQingServer {
      */
     private ResultVo<String> shanChuMuBan(YshZdYjTemplate mb) {
         List<Integer> userRole = publicServer.getRoleCode().getData();
-        if (publicServer.noNeedRule(userRole, new int[]{38})) {
+        if (publicServer.noNeedRule(userRole, 38)) {
             if (TokenUtil.getTokenUserId().equals(mb.getOpId().trim()) || (userRole.contains(11) && mb.getDeptCode().trim().equals(mb.getUserDeptCode().trim()))) {
                 dao.shanChuShouMingMuBan(mb.getCode());
                 return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
@@ -286,9 +286,9 @@ public class JianYanJianChaShenQingServer {
      * @return 返回提示
      */
     private ResultVo<String> xinZengShouMingMuBan(YshZdYjTemplate param) {
-        if (param.getWhFlag().trim().equals("3") && publicServer.noNeedRule(new int[]{38})) {
+        if (param.getWhFlag().trim().equals("3") && publicServer.noNeedRule(38)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限创建全院模板。");
-        } else if (param.getWhFlag().trim().equals("2") && publicServer.noNeedRule(new int[]{11})) {
+        } else if (param.getWhFlag().trim().equals("2") && publicServer.noNeedRule(11)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科主任才可以创建科室模板。");
         }
         param.setCode(publicServer.getYjTemplateNo().toString());
@@ -330,7 +330,7 @@ public class JianYanJianChaShenQingServer {
      */
     @Transactional(rollbackFor = Exception.class)
     public ResultVo<String> baoCunJianChaJianYanMuBan(ZyTcYj param) {
-        if (publicServer.noNeedRule(new int[]{11})) {
+        if (publicServer.noNeedRule(11)) {
             if (param.getOrderType().equals("2")) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限创建科室模板。");
             }

+ 7 - 15
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/YiZhuLuRuServer.java

@@ -344,7 +344,7 @@ public class YiZhuLuRuServer {
         Set<String> xiangMuCode = new HashSet<>();
         StringBuilder cuoWuXinXi = new StringBuilder();
 
-        Boolean needRule = publicServer.noNeedRule(new int[]{38});
+        Boolean needRule = publicServer.noNeedRule(38);
         // 这个是用来做父子组件的 map
         Map<BigDecimal, XinZhenYzActOrder> fuYiZhuId = new HashMap<>();
         for (XinZhenYzActOrder item : param.getList()) {
@@ -561,15 +561,6 @@ public class YiZhuLuRuServer {
             if (StringUtil.isBlank(item.getDrugFlag())) {
                 item.setDrugFlag("o");
             }
-            if (item.getDose() == null) {
-                item.setDose(BigDecimal.valueOf(0));
-            }
-            if (item.getDrugOcc() == null) {
-                item.setDrugOcc(BigDecimal.valueOf(0));
-            }
-            if (item.getDrugVolume() == null) {
-                item.setDrugVolume(BigDecimal.valueOf(0));
-            }
             if (item.getSerial().trim().equals("00")) {
                 item.setGroupNo("00");
             } else if (item.getSerial().trim().equals("01") || item.getSerial().trim().equals("99")) {
@@ -664,9 +655,9 @@ public class YiZhuLuRuServer {
             yzOrderPattern = dao.gongGongMuBan(param.getPatternName());
         }
         List<Integer> role = publicServer.getRoleCode().getData();
-        if (param.getInputType().equals("1") && publicServer.noNeedRule(role, new int[]{38})) {
+        if (param.getInputType().equals("1") && publicServer.noNeedRule(role, 38)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限修改和删除全院模板。");
-        } else if (param.getInputType().equals("2") && publicServer.noNeedRule(role, new int[]{38, 11})) {
+        } else if (param.getInputType().equals("2") && publicServer.noNeedRule(role, 38, 11)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限修改和删除科室模板。");
         }
         String patternCode = yzOrderPattern.getPatternCode();
@@ -797,7 +788,7 @@ public class YiZhuLuRuServer {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请填写撤销原因。");
         }
         String userCode = TokenUtil.getTokenUserId();
-        if (publicServer.noNeedRule(new int[]{38})) {
+        if (publicServer.noNeedRule(38)) {
             if (!yz.getPhysician().trim().equals(userCode)) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "不是本人开的医嘱无权撤销。");
             }
@@ -806,7 +797,7 @@ public class YiZhuLuRuServer {
             }
         }
         if (!yz.getStatusFlag().trim().equals("2")) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该医嘱已经无法被撤销。");
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该医嘱无法被撤销。");
         }
         // 获取该医嘱下面的项目有没有被执行了,如果被执行了的话就不能撤销了。
         publicServer.huoQuGaiYiZhuXiaXiangMu(yz.getActOrderNo());
@@ -817,8 +808,9 @@ public class YiZhuLuRuServer {
         // 把原来的医嘱插入到 yz_erase_order 这个表
         dao.chaRuShanChuBiao(yz.getActOrderNo());
         // 更新原来的状态
-        dao.genXingShanChuBiao(userCode, yz.getActOrderNo());
+        dao.genXingShanChuBiaoZhi(userCode, yz.getActOrderNo());
         log.info("删除医嘱==》数据:{},操作人:{}", JSON.toJSONString(yz), userCode);
+
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "医嘱撤销成功。");
     }