Browse Source

优化代码

xiaochan 3 years ago
parent
commit
604914cf64

+ 4 - 1
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/HuiZhenShenQingDao.java

@@ -142,7 +142,10 @@ public interface HuiZhenShenQingDao {
     void shanChuYiZhu(@Param("actOrderNo") BigDecimal actOrderNo);
 
 
-    @Select("select code,name from a_employee_mi with(nolock) where dept_code = #{deptCode} and emp_tit_code = #{hzType} and isnull(del_flag,0)=0")
+    @Select("select code,name, " +
+            " dept_name = (select rtrim(name) from zd_unit_code where zd_unit_code.code = dept_code)," +
+            " emp_tit_name  = (select rtrim(name) from zd_emp_title where zd_emp_title.code = emp_tit_code) " +
+            " from a_employee_mi with(nolock) where dept_code = #{deptCode} and emp_tit_code = #{hzType} and isnull(del_flag,0)=0")
     List<GetDropdownBox> huiZhenYiSheng(@Param("deptCode") String deptCode,
                                         @Param("hzType") String hzType);
 

+ 16 - 1
src/main/java/thyyxxk/webserver/entity/casefrontsheet/YshHzRecord.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.entity.casefrontsheet;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 @Data
@@ -127,7 +128,7 @@ public class YshHzRecord implements Serializable {
     /**
      * 新开的医嘱号
      */
-    private Integer actOrderNo;
+    private BigDecimal actOrderNo;
 
     /**
      * 订单代码
@@ -157,4 +158,18 @@ public class YshHzRecord implements Serializable {
 
     private String inspectStuff;
 
+    public String getHzTypeName() {
+        if (hzType == null) return "";
+        switch (hzType) {
+            case "1":
+                return "主治医师";
+            case "2":
+                return "副主任医生";
+            case "3":
+                return "主任医生";
+            default:
+                return "";
+        }
+    }
+
 }

+ 11 - 9
src/main/java/thyyxxk/webserver/service/casefrontsheet/HuiZhenShenQingService.java

@@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.casefrontsheet.HuiZhenShenQingDao;
+import thyyxxk.webserver.dao.his.zhuyuanyisheng.YiZhuLuRuDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.casefrontsheet.YshHzRecord;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
@@ -15,6 +16,7 @@ import thyyxxk.webserver.utils.StringUtil;
 import thyyxxk.webserver.utils.TokenUtil;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -31,10 +33,12 @@ import java.util.List;
 public class HuiZhenShenQingService {
     private final HuiZhenShenQingDao dao;
     private final PublicServer publicServer;
+    private final YiZhuLuRuDao yiZhuLuRuDao;
 
-    public HuiZhenShenQingService(HuiZhenShenQingDao dao, PublicServer publicServer) {
+    public HuiZhenShenQingService(HuiZhenShenQingDao dao, PublicServer publicServer, YiZhuLuRuDao yiZhuLuRuDao) {
         this.dao = dao;
         this.publicServer = publicServer;
+        this.yiZhuLuRuDao = yiZhuLuRuDao;
     }
 
     /**
@@ -63,17 +67,10 @@ public class HuiZhenShenQingService {
     public ResultVo<String> submitHuiZhenShenQing(YshHzRecord param) {
         log.info("会诊申请====>申请人:{},数据:{}", TokenUtil.getTokenUserId(), JSON.toJSONString(param));
         publicServer.huanZheJieSuan(param.getInpatientNo(), param.getAdmissTimes());
-        /*
-         * 获取一个新的医嘱号
-         * 需要一套指令 先把表锁住 在查询出医嘱号 在加一更新加一就完事了
-         */
-        dao.lockTable();
-        float actOrderNo = dao.getActOrderNo() + 1;
-        dao.updateActOrderNo(actOrderNo);
         //下面是给申请次数 加一
         param.setReqTimes(dao.getMaxReqTimes(param.getInpatientNo(), param.getAdmissTimes()) + 1);
         param.setInputDate(new Date());
-        param.setActOrderNo((int) actOrderNo);
+        param.setActOrderNo(BigDecimal.valueOf(publicServer.getActOrderNo()));
         param.setInputId(TokenUtil.getTokenUserId());
         param.setReqDate(param.getInputDate());
         param.setOrderCode(getOrderCode("00" + param.getHzType()));
@@ -83,9 +80,14 @@ public class HuiZhenShenQingService {
         //申请成功了就还需要插入一条医嘱
         dao.chaRuYiZhu(param);
         log.info("插入数据:{}", JSON.toJSONString(param));
+        List<String> content = new ArrayList<>();
+        content.add(String.format("会诊名:【%s】<br>" +
+                "会诊级别:【%s】", param.getOrderName(), param.getHzTypeName()));
+        publicServer.faSongXiaoXi(yiZhuLuRuDao.huoQuHuanZheXinXi(param.getInpatientNo(), param.getAdmissTimes()), content, "新增会诊申请", TokenUtil.getTokenUserId());
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "会诊申请成功,正在通知会诊医生。 <p>(〜^㉨^)〜</p>");
     }
 
+
     /**
      * 查询会诊的信息
      *

+ 9 - 24
src/main/java/thyyxxk/webserver/service/medicalinsurance/SetlListUpldService.java

@@ -309,32 +309,17 @@ public class SetlListUpldService {
         String insutype = patInfo.getInsutype();
         String medType = patInfo.getMedType();
         // 参保地
-        List<String> chanBaoDi = new ArrayList<String>() {
-            private static final long serialVersionUID = 727538686490732828L;
-
-            {
-                add("430121");
-                add("430181");
-            }
-        };
+        List<String> chanBaoDi = new ArrayList<>();
+        chanBaoDi.add("430121");
+        chanBaoDi.add("430181");
         //  医疗保障类型
-        List<String> mdcsType = new ArrayList<String>() {
-            private static final long serialVersionUID = 1044705506584092285L;
-
-            {
-                add("340");
-                add("350");
-            }
-        };
+        List<String> mdcsType = new ArrayList<>();
+        mdcsType.add("340");
+        mdcsType.add("350");
         // 险种类型
-        List<String> insutypeList = new ArrayList<String>() {
-            private static final long serialVersionUID = -7311254120554569410L;
-
-            {
-                add("340");
-                add("350");
-            }
-        };
+        List<String> insutypeList = new ArrayList<>();
+        insutypeList.add("340");
+        insutypeList.add("350");
         if (medType.equals("2101") || medType.equals("22")) {
             if (!insuplcAdmdvs.startsWith("4301") || chanBaoDi.contains(insuplcAdmdvs) ||
                     mdcsType.contains(insuplcAdmdvs) || insutypeList.contains(insutype)) {

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

@@ -154,16 +154,11 @@ public class CaoYaoYiZhuServer {
         dao.chaRuCaoYaoYiZhu(param, huanZheXinXi.getDeptCode(), huanZheXinXi.getDeptCode(), huanZheXinXi.getSmallDept());
         dao.chaRuCaoYaoXiangQing(param.getList(), param.getOrderNo());
         dao.chaRuYiZhu(param, "草药医嘱:" + param.getOrderName() + param.getQuantity() + "剂", huanZheXinXi.getDeptCode(), huanZheXinXi.getDeptCode(), huanZheXinXi.getSmallDept(), publicServer.getInfantFlag(huanZheXinXi.getInpatientNo()));
-        List<String> content = new ArrayList<String>() {
-            private static final long serialVersionUID = -6513395725018337268L;
-
-            {
-                add(String.format("草药医嘱名:<span style='color:#409eff'>【%s】</span><br>" +
-                        "剂数:<span style='color:#409eff'>【%s】</span><br>" +
-                        "患者名:<span style='color:#409eff'>【%s】<br></span>" +
-                        "床位:<span style='color:#409eff'>【%s】</span>", param.getOrderName(), param.getQuantity().toString(), huanZheXinXi.getName(), huanZheXinXi.getBedNo()));
-            }
-        };
+        List<String> content = new ArrayList<>();
+        content.add(String.format("草药医嘱名:<span style='color:#409eff'>【%s】</span><br>" +
+                "剂数:<span style='color:#409eff'>【%s】</span><br>" +
+                "患者名:<span style='color:#409eff'>【%s】<br></span>" +
+                "床位:<span style='color:#409eff'>【%s】</span>", param.getOrderName(), param.getQuantity().toString(), huanZheXinXi.getName(), huanZheXinXi.getBedNo()));
         publicServer.faSongXiaoXi(huanZheXinXi, content, "新增草药医嘱", TokenUtil.getTokenUserId());
         return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
     }