浏览代码

正在施工检查模板

xiaochan 3 年之前
父节点
当前提交
4621f1d9c5

+ 25 - 0
src/main/java/thyyxxk/webserver/controller/zhuyuanyizheng/JianChaShenQingController.java

@@ -3,9 +3,11 @@ package thyyxxk.webserver.controller.zhuyuanyizheng;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.JcZdClass;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.YshYjReq;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.YshZdYjTemplate;
+import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.ZyTcYj;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.query.ChaXunJianCha;
 import thyyxxk.webserver.service.zhuyuanyisheng.JianChaShenQingServer;
 
@@ -60,6 +62,12 @@ public class JianChaShenQingController {
         return server.chaKanFenLeiXiangQing(code, bwCode);
     }
 
+    @GetMapping("/shanShuJianChaMuBan")
+    public ResultVo<String> shanShuJianChaMuBan(@RequestParam("code") String code,
+                                                @RequestParam("deptCode") String deptCode) {
+        return server.shanShuJianChaMuBan(code, deptCode);
+    }
+
     @GetMapping("/huoMuShuoMingMuBan")
     public ResultVo<IPage<YshZdYjTemplate>> huoMuShuoMingMuBan(@RequestParam("name") String name,
                                                                @RequestParam("fenLei") Integer fenLei,
@@ -73,4 +81,21 @@ public class JianChaShenQingController {
         return server.shouMingMuBanChaoZuo(param);
     }
 
+    @GetMapping("/huoQuLingChuangZhenDuan")
+    public ResultVo<List<GetDropdownBox>> huoQuLingChuangZhenDuan(@RequestParam("name") String name,
+                                                                  @RequestParam("laiYuan") Boolean laiYuan) {
+        return server.huoQuLinChuangZhenDuan(name, laiYuan);
+    }
+
+    @GetMapping("/jianChaMuBanMing")
+    public ResultVo<Boolean> jianChaMuBanMing(@RequestParam("name") String name,
+                                              @RequestParam("reqType") Integer reqType) {
+        return server.jianChaMuBanMing(name, reqType);
+    }
+
+    @PostMapping("/baoCunJianChaJianYanMuBan")
+    public ResultVo<String> baoCunJianChaJianYanMuBan(@RequestBody ZyTcYj param) {
+        return server.baoCunJianChaJianYanMuBan(param);
+    }
+
 }

+ 7 - 0
src/main/java/thyyxxk/webserver/dao/his/PublicDao.java

@@ -281,5 +281,12 @@ public interface PublicDao {
     @Select("select rtrim(code) code,rtrim(name) name from zd_anaesthesia")
     List<GetDropdownBox> maZuiFangShi();
 
+    @Update("update ysh_config set tc_no =tc_no")
+    void jianYanJianChaSuo();
 
+    @Select("select tc_no from ysh_config ")
+    Integer jianYanJianChaXuHao();
+
+    @Update("update ysh_config set tc_no = #{tcNo}")
+    void genXingJianYanJianChaXuHao(Integer tcNo);
 }

+ 37 - 0
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/JianChaShenQingDao.java

@@ -3,9 +3,11 @@ package thyyxxk.webserver.dao.his.zhuyuanyisheng;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.*;
+import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.JcZdClass;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.YshYjReq;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.YshZdYjTemplate;
+import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.ZyTcYj;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.PatientTemp;
 
 import java.util.List;
@@ -162,6 +164,17 @@ public interface JianChaShenQingDao {
     List<Map<String, String>> chaKanFenLeiXiangQing(@Param("orderType") String orderType,
                                                     @Param("bwCode") String bwCode);
 
+    @Select("select op_id,tc_exec " +
+            "from zy_tc_yj " +
+            "where tc_no = #{code}")
+    ZyTcYj jianChaLuRuRen(String code);
+
+    @Delete("delete zy_tc_yj " +
+            "where tc_no = #{code}; " +
+            "delete zy_tc_detail_yj " +
+            "where tc_no = #{code};")
+    void shanChuJianChaMuBan(String code);
+
 
     @Select("SELECT rtrim(a.order_code) as                                          orderCode, " +
             "       rtrim(a.order_name) as                                          orderName, " +
@@ -225,4 +238,28 @@ public interface JianChaShenQingDao {
             "(select rtrim(a_employee_mi.dept_code) from a_employee_mi where a_employee_mi.code = #{opId}), #{opId}, getdate(), #{whFlag})")
     void xinZengShouMingMuBan(YshZdYjTemplate param);
 
+
+    @Select("select diagnosis_code as code, diagnosis_name as name " +
+            "from t_si_dl_dss_dns " +
+            "where (diagnosis_code like #{name} or diagnosis_name like #{name} or py_code like #{name})")
+    List<GetDropdownBox> yiBaoZhenDuan(String name);
+
+    @Select("SELECT rtrim(a.code) as code, " +
+            "       rtrim(a.name) as name " +
+            "FROM zd_icd_code a " +
+            "where (a.py_code like #{name} " +
+            "    or a.code like #{name} " +
+            "    or a.name like #{name}) " +
+            "  and isnull(a.del_flag, '') <> '1'")
+    List<GetDropdownBox> benYuanLinChuangZhenDuan(String name);
+
+    @Select("select count(*) " +
+            "from zy_tc_yj " +
+            "where op_id = #{code} " +
+            "  and req_type = #{reqType} " +
+            "  and tc_name = #{name} ")
+    Integer huoQuJianChaJianYanChongFuMuBanMing(@Param("name") String name,
+                                                @Param("reqType") Integer reqType,
+                                                @Param("code") String code);
+
 }

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/jianyanjiancha/YshZdYjTemplate.java

@@ -65,4 +65,6 @@ public class YshZdYjTemplate implements Serializable {
      */
     private String leiXing;
 
+    private String userDeptCode;
+
 }

+ 12 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/jianyanjiancha/ZyTcYj.java

@@ -1,9 +1,11 @@
 package thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha;
 
 import lombok.Data;
+import thyyxxk.webserver.entity.casefrontsheet.YshHzRecord;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 @Data
 public class ZyTcYj implements Serializable {
@@ -75,4 +77,14 @@ public class ZyTcYj implements Serializable {
      */
     private Integer sortNo;
 
+    /**
+     * 是否覆盖原数据
+     */
+    private Boolean fuGaiYuanShuJu = false;
+
+    /**
+     * 保存模板的数据
+     */
+    private List<YshHzRecord> list;
+
 }

+ 17 - 9
src/main/java/thyyxxk/webserver/service/PublicServer.java

@@ -55,10 +55,18 @@ public class PublicServer {
      * @param jueSeBianMa 不需要限制的角色id
      * @return Boolean
      */
-    public Boolean needRule(int[] jueSeBianMa) {
+    public Boolean noNeedRule(int[] jueSeBianMa) {
         return getaBoolean(jueSeBianMa, getRoleCode().getData());
     }
 
+    /**
+     * @param jueSeBianMa 不需要限制的角色id
+     * @return Boolean
+     */
+    public Boolean noNeedRule(List<Integer> role, int[] jueSeBianMa) {
+        return getaBoolean(jueSeBianMa, role);
+    }
+
     public Boolean getaBoolean(int[] jueSeBianMa, List<Integer> roleCode) {
         if (ListUtil.isBlank(roleCode)) {
             return true;
@@ -74,14 +82,6 @@ public class PublicServer {
         return true;
     }
 
-    /**
-     * @param jueSeBianMa 不需要限制的角色id
-     * @return Boolean
-     */
-    public Boolean needRule(List<Integer> role, int[] jueSeBianMa) {
-        return getaBoolean(jueSeBianMa, role);
-    }
-
 
     /**
      * 获取新的医嘱号
@@ -387,5 +387,13 @@ public class PublicServer {
         return ResultVoUtil.success(dao.maZuiFangShi());
     }
 
+
+    public Integer huoQuJianYanJianChaXuHao() {
+        dao.jianYanJianChaSuo();
+        Integer xuHao = dao.jianYanJianChaXuHao() + 1;
+        dao.genXingJianYanJianChaXuHao(xuHao);
+        return xuHao;
+    }
+
 }
 

+ 88 - 24
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/JianChaShenQingServer.java

@@ -1,5 +1,6 @@
 package thyyxxk.webserver.service.zhuyuanyisheng;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
@@ -8,9 +9,11 @@ import org.springframework.transaction.annotation.Transactional;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.zhuyuanyisheng.JianChaShenQingDao;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.JcZdClass;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.YshYjReq;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.YshZdYjTemplate;
+import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.ZyTcYj;
 import thyyxxk.webserver.entity.zhuyuanyisheng.jianyanjiancha.query.ChaXunJianCha;
 import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.PatientTemp;
 import thyyxxk.webserver.service.PublicServer;
@@ -112,6 +115,33 @@ public class JianChaShenQingServer {
         return ResultVoUtil.success(dao.chaKanFenLeiXiangQing(code, bwCode));
     }
 
+    public ResultVo<String> shanShuJianChaMuBan(String code, String deptCode) {
+        ZyTcYj yj = dao.jianChaLuRuRen(code);
+        if (yj == null) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找对应的记录可能已经被删除了。");
+        }
+        if (jianChaMuBanPanDuan(yj.getOpId(), yj.getTcExec(), deptCode)) {
+            dao.shanChuJianChaMuBan(code);
+            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
+        }
+        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限修改。");
+    }
+
+    public boolean jianChaMuBanPanDuan(String opId, String tcExec, String deptCode) {
+        List<Integer> userRole = publicServer.getRoleCode().getData();
+        // 医务部
+        if (userRole.contains(38)) {
+            return true;
+        }
+        // 科主任 可以删除自己科室任意模板
+        if (userRole.contains(11) && tcExec.trim().equals(deptCode)) {
+            return true;
+        }
+        // 普通的只能删除自己的
+        return opId.trim().equals(TokenUtil.getTokenUserId());
+    }
+
+
     public ResultVo<IPage<YshZdYjTemplate>> huoMuShuoMingMuBan(String name, Integer fenLei, long total, long currentPage) {
         Page<YshZdYjTemplate> page = new Page<>(currentPage, 20, total == 0);
         page = dao.huoQuShuoMingMuBan(page, StringUtil.isContainChinese(name), fenLei, TokenUtil.getTokenUserId());
@@ -131,10 +161,37 @@ public class JianChaShenQingServer {
         return ResultVoUtil.success();
     }
 
+    private ResultVo<String> xiuGaiMuBan(YshZdYjTemplate param, YshZdYjTemplate mb) {
+        if (publicServer.noNeedRule(new int[]{38})) {
+            if (!TokenUtil.getTokenUserId().equals(mb.getOpId().trim())) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该模板创建人不是你,无法操作。");
+            }
+        }
+        dao.genXingShouMingMuBan(param.getJcText(), param.getName(),
+                PingYinUtils.pyShouZiMuDaXie(param.getName()),
+                PingYinUtils.getWBCode(param.getName()), param.getCode());
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
+    }
+
+    private ResultVo<String> shanChuMuBan(YshZdYjTemplate mb) {
+        List<Integer> userRole = publicServer.getRoleCode().getData();
+        if (publicServer.noNeedRule(userRole, new int[]{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);
+            } else {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限修改。");
+            }
+        }
+        dao.shanChuShouMingMuBan(mb.getCode());
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
+
+    }
+
     private ResultVo<String> xinZengShouMingMuBan(YshZdYjTemplate param) {
-        if (param.getWhFlag().trim().equals("3") && publicServer.needRule(new int[]{38})) {
+        if (param.getWhFlag().trim().equals("3") && publicServer.noNeedRule(new int[]{38})) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限创建全院模板。");
-        } else if (param.getWhFlag().trim().equals("2") && publicServer.needRule(new int[]{11})) {
+        } else if (param.getWhFlag().trim().equals("2") && publicServer.noNeedRule(new int[]{11})) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科主任才可以创建科室模板。");
         }
         param.setCode(publicServer.getYjTemplateNo().toString());
@@ -145,36 +202,43 @@ public class JianChaShenQingServer {
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
     }
 
-    public ResultVo<String> xiuGaiMuBan(YshZdYjTemplate param, YshZdYjTemplate mb) {
-        ResultVo<String> jiaoYan = muBanJiaoYan(mb.getOpId());
-        if (jiaoYan != null) return jiaoYan;
-        dao.genXingShouMingMuBan(param.getJcText(), param.getName(),
-                PingYinUtils.pyShouZiMuDaXie(param.getName()),
-                PingYinUtils.getWBCode(param.getName()), param.getCode());
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
-    }
 
-    public ResultVo<String> shanChuMuBan(YshZdYjTemplate mb) {
-        ResultVo<String> jiaoYan = muBanJiaoYan(mb.getOpId());
-        if (jiaoYan != null) return jiaoYan;
-        dao.shanChuShouMingMuBan(mb.getCode());
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
+    /**
+     * 搜索临床诊断
+     *
+     * @param name    搜索的名字
+     * @param laiYuan true 医保 false 本院
+     * @return 返回搜索的数据
+     */
+    public ResultVo<List<GetDropdownBox>> huoQuLinChuangZhenDuan(String name, Boolean laiYuan) {
+        return laiYuan ? ResultVoUtil.success(dao.yiBaoZhenDuan(StringUtil.isContainChinese(name))) :
+                ResultVoUtil.success(dao.benYuanLinChuangZhenDuan(StringUtil.isContainChinese(name)));
     }
 
+    /**
+     * 判断检查模板是否有重复的
+     *
+     * @param name    名称
+     * @param reqType 2-检验 3-检查
+     * @return 返回有没有
+     */
+    public ResultVo<Boolean> jianChaMuBanMing(String name, Integer reqType) {
+        return ResultVoUtil.success(dao.huoQuJianChaJianYanChongFuMuBanMing(name, reqType, TokenUtil.getTokenUserId()) > 0);
+    }
 
     /**
-     * 模板的校验
+     * 保存检查或检验模板
      *
-     * @param opID 录入人
-     * @return 提示信息
+     * @param param 数据
+     * @return 返回提示
      */
-    public ResultVo<String> muBanJiaoYan(String opID) {
-        if (publicServer.needRule(new int[]{38})) {
-            if (!TokenUtil.getTokenUserId().equals(opID)) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该模板创建人不是你,无法操作。");
-            }
+    public ResultVo<String> baoCunJianChaJianYanMuBan(ZyTcYj param) {
+        log.info("数据:{}", JSON.toJSONString(param));
+        // TODO 新增模板的时候要先删除
+        if (param.getFuGaiYuanShuJu()) {
+
         }
-        return null;
+        return ResultVoUtil.success();
     }
 }
 

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

@@ -301,7 +301,7 @@ public class YiZhuLuRuServer {
         Set<String> xiangMuCode = new HashSet<>();
         StringBuilder cuoWuXinXi = new StringBuilder();
 
-        Boolean needRule = publicServer.needRule(new int[]{38});
+        Boolean needRule = publicServer.noNeedRule(new int[]{38});
         // 这个是用来做父子组件的 map
         Map<BigDecimal, XinZhenYzActOrder> fuYiZhuId = new HashMap<>();
         for (XinZhenYzActOrder item : param.getList()) {
@@ -601,9 +601,9 @@ public class YiZhuLuRuServer {
             yzOrderPattern = dao.gongGongMuBan(param.getPatternName());
         }
         List<Integer> role = publicServer.getRoleCode().getData();
-        if (param.getInputType().equals("1") && publicServer.needRule(role, new int[]{38})) {
+        if (param.getInputType().equals("1") && publicServer.noNeedRule(role, new int[]{38})) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限修改和删除全院模板。");
-        } else if (param.getInputType().equals("2") && publicServer.needRule(role, new int[]{38, 11})) {
+        } else if (param.getInputType().equals("2") && publicServer.noNeedRule(role, new int[]{38, 11})) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限修改和删除科室模板。");
         }
         String patternCode = yzOrderPattern.getPatternCode();
@@ -735,7 +735,7 @@ public class YiZhuLuRuServer {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请填写撤销原因。");
         }
         String userCode = TokenUtil.getTokenUserId();
-        if (publicServer.needRule(new int[]{38})) {
+        if (publicServer.noNeedRule(new int[]{38})) {
             if (!yz.getPhysician().trim().equals(userCode)) {
                 return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "不是本人开的医嘱无权撤销。");
             }