فهرست منبع

抗生素限制

lihong 1 سال پیش
والد
کامیت
ad3a36c8d1

+ 18 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzZdYpYshController.java

@@ -2,6 +2,7 @@ package cn.hnthyy.thmz.controller.mz;
 
 import cn.hnthyy.thmz.Utils.AssertUtil;
 import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.his.zd.JyZdItem;
 import cn.hnthyy.thmz.entity.his.zd.MzZdYpYsh;
@@ -79,6 +80,23 @@ public class MzZdYpYshController {
             return resultMap;
         }
     }
+    /**
+     * @description:检查开抗生素权限
+     * @author: lihong
+     * @date: 2024/2/28 16:34
+     * @param: param
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @UserLoginToken
+    @PostMapping("/checkKssByUserCode")
+    public R checkKssByUserCode(@RequestBody Map<String, Object> param) {
+        String code = Convert.toStr(param.get("code"));
+        String serial = Convert.toStr(param.get("serial"));
+        if (!mzZdYpYshService.checkKssByUserCode(TokenUtil.getUser().getUserIdCode(), code,serial)) {
+           return R.error(-2,"检查抗生素错误消息");
+        }
+        return R.ok();
+    }
 
 
     /**

+ 4 - 3
src/main/java/cn/hnthyy/thmz/mapper/his/zd/MzZdYpYshMapper.java

@@ -104,7 +104,8 @@ public interface MzZdYpYshMapper {
             "</script>"})
     List<MzZdYpYsh> selectJeByCommonParams(@Param("commonParams") String commonParams,@Param("pageSize") Integer pageSize);
 
-
-
-
+    @Select(" select top 1 doctor_xz_yp from a_employee_mi where code =#{userCode}")
+    String selectDoctorXzYp(String userCode);
+    @Select(" select yp_level from yp_zd_dict where  code =#{code} and serial =#{serial} and  kss_flag='1' and yp_level >= '2' ")
+    String selectYpLevel(@Param("code") String code,@Param("serial") String serial);
 }

+ 10 - 0
src/main/java/cn/hnthyy/thmz/service/his/zd/MzZdYpYshService.java

@@ -37,5 +37,15 @@ public interface MzZdYpYshService {
      * @return
      */
     List<MzZdYpYsh> queryAllJeList();
+    /**
+     * @description: 检查改用户是否有开抗生素权限
+     * @author: lihong
+     * @date: 2024/2/28 16:03
+     * @param: userCode 用户编码
+     * @param: code 药品编码
+     * @return: java.lang.String
+     **/
+    boolean checkKssByUserCode(String userCode,String code,String serial);
+
 
 }

+ 28 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/zd/MzZdYpYshServiceImpl.java

@@ -7,6 +7,8 @@ import cn.hnthyy.thmz.enums.UnitTypeEnum;
 import cn.hnthyy.thmz.mapper.his.yp.YpZdDictMapper;
 import cn.hnthyy.thmz.mapper.his.zd.MzZdYpYshMapper;
 import cn.hnthyy.thmz.service.his.zd.MzZdYpYshService;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -86,4 +88,30 @@ public class MzZdYpYshServiceImpl implements MzZdYpYshService {
     public List<MzZdYpYsh> queryAllJeList() {
         return mzZdYpYshMapper.selectJeByCommonParams( null,null);
     }
+
+    /**
+     * @param userCode
+     * @param code
+     * @description: 检查改用户是否有开抗生素权限
+     * @author: lihong
+     * @date: 2024/2/28 16:03
+     * @param: userCode
+     * @param: code
+     * @return: java.lang.String
+     */
+    @Override
+    public boolean checkKssByUserCode(String userCode, String code,String serial) {
+      String doctorXzYp =  mzZdYpYshMapper.selectDoctorXzYp(userCode);
+      String ypLevel =   mzZdYpYshMapper.selectYpLevel(code,serial);
+      Integer xzYp = Convert.toInt(doctorXzYp, 0);
+      if(StrUtil.isNotBlank(ypLevel)){
+         if(Convert.toInt(ypLevel) >= 2 && xzYp == 0){
+             return false;
+         }
+         if(xzYp == 1 && Convert.toInt(ypLevel) >=3){
+             return false;
+         }
+      }
+        return true;
+    }
 }

+ 18 - 8
src/main/resources/static/js/mz/clinic.js

@@ -7267,14 +7267,24 @@ function loadYpList(index, event) {
             };
         },
         onClickRow: function (row, $element) {
-            $('#' + MedicineName).webuiPopover('hide');
-            if (index == 0) {
-                clearWesternMedicine(false);
-                checkYpInfo(row.code, row.serial, row.ypType, true, null, 3);
-            }
-            if (index == 1) {
-                checkZyInfo(row.code, row.serial, $("#zyClassType").val(), true);
-            }
+            postAjaxJsonHttpRequst("/thmz/checkKssByUserCode",{code:row.code,serial:row.serial},true,function (cres) {
+                if(cres.code == 0){
+                    $('#' + MedicineName).webuiPopover('hide');
+                    if (index == 0) {
+                        clearWesternMedicine(false);
+                        checkYpInfo(row.code, row.serial, row.ypType, true, null, 3);
+                    }
+                    if (index == 1) {
+                        checkZyInfo(row.code, row.serial, $("#zyClassType").val(), true);
+                    }
+                }else if(cres.code == -2) {
+                    errorMesageSimaple(`没有${row.code}/${row.name}的抗生素使用级别权限,不能开具此药品`)
+                }else {
+                    errorMesage(cres)
+                }
+            })
+
+
         }
     });
 }