Ver código fonte

传染病,检验性别,年龄效验

lihong 1 ano atrás
pai
commit
ddaf70c5ca

+ 15 - 5
src/main/java/cn/hnthyy/thmz/controller/mz/CrbMainCardController.java

@@ -7,13 +7,18 @@ import cn.hnthyy.thmz.entity.his.mz.Employee;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.service.his.mz.CrbMainCardService;
 import cn.hnthyy.thmz.service.his.mz.EmployeeService;
+import cn.hnthyy.thmz.service.thmz.UserDeptRelationService;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Slf4j
@@ -23,7 +28,8 @@ public class CrbMainCardController {
     private CrbMainCardService crbMainCardService;
     @Autowired
     private EmployeeService employeeService;
-
+    @Resource
+    private UserDeptRelationService userDeptRelationService;
     /**
      * 根据患者id查询传染病列表
      *
@@ -166,10 +172,14 @@ public class CrbMainCardController {
                 resultMap.put("message", "诊断日期不能为空");
                 return resultMap;
             }
-            if (crbMainCard.getReportDept() == null) {
-                resultMap.put("code", -1);
-                resultMap.put("message", "上报科室不能为空");
-                return resultMap;
+            if (StrUtil.isBlank(crbMainCard.getReportDept())) {
+              List<String> depts =  userDeptRelationService.queryAllByUserIdCode(TokenUtil.getUser().getUserIdCode());
+              if(CollUtil.isEmpty(depts)){
+                  resultMap.put("code", -1);
+                  resultMap.put("message", "用户没有维护科室");
+                  return resultMap;
+              }
+                crbMainCard.setReportDept(depts.get(0));
             }
             if(crbMainCard.getCurrentStreet()!=null && crbMainCard.getCurrentStreet().length()>30){
                 resultMap.put("code", -1);

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

@@ -9,7 +9,9 @@ import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
 import cn.hnthyy.thmz.service.his.zd.JcJyItemChargeService;
 import cn.hnthyy.thmz.service.his.zd.MzZdYpYshService;
 import cn.hnthyy.thmz.service.his.zd.ZdChargeItemService;
+import cn.hutool.core.collection.CollUtil;
 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;
@@ -109,6 +111,25 @@ public class MzZdYpYshController {
             return resultMap;
         }
     }
+    /**
+     * @description: 检查检验年龄和性别限制条件
+     * @author: lihong
+     * @date: 2024/2/2 15:18
+     * @param: param
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    @PostMapping("/checkJyJcGenderAndAge")
+    @UserLoginToken
+    public R checkJyJcGenderAndAge(@RequestBody Map<String,Object> param){
+        Integer type = Convert.toInt(param.get("type"));
+        String code = Convert.toStr(param.get("code"));
+        String patientId = Convert.toStr(param.get("patientId"));
+        List<String> errMsg = jcJyItemChargeService.checkJyJcGenderAndAge(type, code,patientId);
+        if(CollUtil.isNotEmpty(errMsg)){
+            return R.error(R.ERR_CODE, CollUtil.join(errMsg, ";"));
+        }
+        return R.ok();
+    }
 
 
 

+ 6 - 0
src/main/java/cn/hnthyy/thmz/entity/his/zd/JyZdItem.java

@@ -60,4 +60,10 @@ public class JyZdItem extends PageBean implements Serializable {
     private String bwCode;
     //执行地址
     private String execAddress;
+    //性别限制 1男 2女
+    private Integer genderRestriction;
+    //最小年龄限制 包含等于
+    private Integer minAgeRestriction;
+    //最大年龄限制包含等于
+    private Integer maxAgeRestriction;
 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zd/JyZdItemMapper.java

@@ -239,4 +239,6 @@ public interface JyZdItemMapper {
             " where code = #{code} "
            )
     Map<String,Object> selectNoteByCode(@Param("code") String code, @Param("tableName")String tableName);
+    @Select(" select code,name, gender_restriction,min_age_restriction,max_age_restriction from ${tableName} where code = #{code}" )
+    JyZdItem selectJcJyItemByCode(@Param("tableName") String  tableName, @Param("code")String code);
 }

+ 17 - 0
src/main/java/cn/hnthyy/thmz/service/his/zd/JcJyItemChargeService.java

@@ -253,4 +253,21 @@ public interface JcJyItemChargeService {
     * @return: java.lang.String
     **/
     String queryJyJcNote(String code, Integer jcJyZltype);
+    /**
+     * @description:
+     * @author: lihong
+     * @date: 2024/2/2 15:23
+     * @param: type 1 检验  2.检查
+     * @param: code 编码
+     * @return: cn.hnthyy.thmz.entity.his.zd.JyZdItem
+     **/
+    JyZdItem queryJcJyItemByCode(Integer type, String code);
+    /**
+     * @description:
+     * @author: lihong
+     * @date: 2024/2/2 15:34
+     * @param: type  1 检验  2.检查
+     * @param: code
+     **/
+    List<String> checkJyJcGenderAndAge(Integer type, String code,String patientId);
 }

+ 44 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/zd/JcJyItemChargeServiceImpl.java

@@ -12,6 +12,7 @@ import cn.hnthyy.thmz.entity.his.zd.JcZdItem;
 import cn.hnthyy.thmz.entity.his.zd.JyZdItem;
 import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
 import cn.hnthyy.thmz.entity.jy.InspectionsIndex;
+import cn.hnthyy.thmz.enums.GenderEnum;
 import cn.hnthyy.thmz.enums.ReqTypeEnum;
 import cn.hnthyy.thmz.mapper.his.YjJcPatientMapper;
 import cn.hnthyy.thmz.mapper.his.YjJcRecordMapper;
@@ -492,4 +493,47 @@ public class JcJyItemChargeServiceImpl implements JcJyItemChargeService {
         collectionInfo = StrUtil.isBlank(collectionInfo) ? "" : "\n" + collectionInfo;
         return note + collectionInfo;
     }
+
+    /**
+     * @description:
+     * @author: lihong
+     * @date: 2024/2/2 15:23
+     * @param: type 1 检验  2.检查
+     * @param: code 编码
+     * @return: cn.hnthyy.thmz.entity.his.zd.JyZdItem
+     */
+    @Override
+    public JyZdItem queryJcJyItemByCode(Integer type, String code) {
+        return jyZdItemMapper.selectJcJyItemByCode(type==1?"jy_zd_item":"jc_zd_item",code);
+    }
+
+    /**
+     * @description:
+     * @author: lihong
+     * @date: 2024/2/2 15:34
+     * @param: type
+     * @param: code
+     */
+    @Override
+    public List<String> checkJyJcGenderAndAge(Integer type, String code,String patientId) {
+        List<String> errMsg = new ArrayList<>();
+        if(StrUtil.isNotBlank(patientId)){
+            JyZdItem zdItem = queryJcJyItemByCode(type, code);
+            if(zdItem == null) return errMsg;
+            MzPatientMi mzPatientMi = mzPatientMiMapper.selectByPatientId(patientId);
+            if(zdItem.getGenderRestriction() != null && !zdItem.getGenderRestriction().equals(mzPatientMi.getSex())){
+                errMsg.add(StrUtil.format("此项目编码{}({})只能{}开具", zdItem.getCode(),zdItem.getName(), GenderEnum.getGenderByCode(zdItem.getGenderRestriction()).name+"性"));
+            }
+            Integer age = mzPatientMi.getAgeForYear();
+            if(age != null){
+                if(zdItem.getMinAgeRestriction() != null && age < zdItem.getMinAgeRestriction() ){
+                    errMsg.add(StrUtil.format("此项目编码{}({})开具的最小年龄为{}岁",zdItem.getCode(),zdItem.getName(),zdItem.getMinAgeRestriction()));
+                }
+                if(zdItem.getMaxAgeRestriction() != null && age > zdItem.getMaxAgeRestriction() ){
+                    errMsg.add(StrUtil.format("此项目编码{}({})开具的最大年龄为{}岁",zdItem.getCode(),zdItem.getName(),zdItem.getMaxAgeRestriction()));
+                }
+            }
+        }
+        return errMsg;
+    }
 }

+ 34 - 24
src/main/resources/static/js/mz/clinic.js

@@ -7571,31 +7571,41 @@ function loadjcJyItemList(event) {
             };
         },
         onClickRow: function (row, $element) {
-            $('#jcJyItem').webuiPopover('hide');
-            $("#jcJyZltype").val(row.type);
-            $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
-            $("#execUnit").selectpicker('refresh');
-            if (row.type == 1) {
-                //检验
-                $("#jyZdSampleDiv").removeClass("hide").addClass("in");
-                $("#jyQuantityDiv").removeClass("hide").addClass("in");
-                $("#yshPartDiv").removeClass("in").addClass("hide");
-                if (row.sampleCode != null && row.sampleCode != "") {
-                    $("#jyZdSample").selectpicker('val', row.sampleCode);
-                    $('#jyZdSample').selectpicker('refresh');
-                }
-            } else if (row.type == 2) {
-                //检查
-                $("#yshPartDiv").removeClass("hide").addClass("in");
-                $("#jyZdSampleDiv").removeClass("in").addClass("hide");
-                $("#jyQuantityDiv").removeClass("in").addClass("hide");
-                if (row.bwCode != null && row.bwCode != "") {
-                    $("#yshPart").selectpicker('val', row.bwCode);
-                    $('#yshPart').selectpicker('refresh');
+            postAjaxJsonHttpRequst("/thmz/checkJyJcGenderAndAge",{
+                patientId: $("#patientId").text(),
+                type:row.type,
+                code:row.code
+            },true,function (resJyJc) {
+                if(resJyJc.code == 0){
+                    $('#jcJyItem').webuiPopover('hide');
+                    $("#jcJyZltype").val(row.type);
+                    $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
+                    $("#execUnit").selectpicker('refresh');
+                    if (row.type == 1) {
+                        //检验
+                        $("#jyZdSampleDiv").removeClass("hide").addClass("in");
+                        $("#jyQuantityDiv").removeClass("hide").addClass("in");
+                        $("#yshPartDiv").removeClass("in").addClass("hide");
+                        if (row.sampleCode != null && row.sampleCode != "") {
+                            $("#jyZdSample").selectpicker('val', row.sampleCode);
+                            $('#jyZdSample').selectpicker('refresh');
+                        }
+                    } else if (row.type == 2) {
+                        //检查
+                        $("#yshPartDiv").removeClass("hide").addClass("in");
+                        $("#jyZdSampleDiv").removeClass("in").addClass("hide");
+                        $("#jyQuantityDiv").removeClass("in").addClass("hide");
+                        if (row.bwCode != null && row.bwCode != "") {
+                            $("#yshPart").selectpicker('val', row.bwCode);
+                            $('#yshPart').selectpicker('refresh');
+                        }
+                    }
+                    $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
+                    checkJcJyItemInfo(row.code, row.name, row.type, true);
+                }else {
+                    errorMesage(resJyJc)
                 }
-            }
-            $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
-            checkJcJyItemInfo(row.code, row.name, row.type, true);
+            })
         }
     });
 }

+ 2 - 2
src/main/resources/static/js/mz/crb_main_card.js

@@ -610,7 +610,7 @@ function fillCrbPatinet(patinet) {
 function saveCrbMainCard() {
     $("#saveCrbMainCard").attr("disabled", true);
     var userIdCode = localStorage.getItem("userIdCode");
-    var reportDept = localStorage.getItem(userIdCode);
+    // var reportDept = localStorage.getItem(userIdCode);
     $.ajax({
         type: "POST",
         url: '/thmz/saveCrbMainCard',
@@ -682,7 +682,7 @@ function saveCrbMainCard() {
             "vkhev": $("#vKHev").val(),
             "vhevrna": $("#vHevRna").val(),
             "gyDzbm": $("#gyDzbm").val(),
-            "reportDept": reportDept,
+            "reportDept": localStorage.getItem("currentDeptNo"),
             "times": $("#timesCrbMainCard").val()
         }),
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},