lihong 2 年之前
父节点
当前提交
ba02d91c0b

+ 13 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzyReqrecController.java

@@ -21,6 +21,7 @@ import cn.hnthyy.thmz.service.thmz.WindowsService;
 import cn.hnthyy.thmz.vo.MzyReqrecVo;
 import cn.hnthyy.thmz.vo.PageViewVo;
 import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
+import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.json.JSONObject;
@@ -904,6 +905,18 @@ public class MzyReqrecController {
         }
     }
 
+    @UserLoginToken
+    @PostMapping("/validFurtherVisit")
+    public R validFurtherVisit(@RequestBody MzyReqrec reqrec, HttpServletRequest httpServletRequest){
+        if(StrUtil.isBlank(reqrec.getPatientId())){
+          return   R.error("门诊号不能为空");
+        }
+        if(StrUtil.isBlank(reqrec.getVisitDept())){
+            return  R.error("就诊科室不能为空");
+        }
+        return mzyReqrecService.validFurtherVisit(reqrec);
+    }
+
 
     /**
      * 修改收费方式

+ 2 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzfzPatientOrderMapper.java

@@ -187,7 +187,7 @@ public interface MzfzPatientOrderMapper {
      */
     @Select({"<script>",
             //"select * from mzfz_patient_order WITH(NOLOCK) where patient_id = #{patientId} and ((status_flag in (0,1,2,3,8) and (doctor_code=#{userIdCode} or req_type in('11', '16')  ",
-            "select * from mzfz_patient_order WITH(NOLOCK) where patient_id = #{patientId} and ((status_flag in (0,1,2,3,8) and (doctor_code=#{userIdCode} or req_type ='16' ",
+            "select * from mzfz_patient_order WITH(NOLOCK) where patient_id = #{patientId} and DateDiff(hh,visit_date,getDate()) &lt;=24  and ((status_flag in (0,1,2,3,8) and (doctor_code=#{userIdCode} or req_type ='16' ",
             " or (dept_code in ",
             "<foreach item='item' index='index' collection='deptNos' open='(' separator=',' close=')'>",
             "#{item}",
@@ -198,7 +198,7 @@ public interface MzfzPatientOrderMapper {
             "#{item}",
             "</foreach>",
             "</when>",
-            " ))) or (status_flag =9 and DateDiff(hh,visit_date,getDate()) &lt;=24 and dept_code in ",
+            " ))) or (status_flag =9  and dept_code in ",
             "<foreach item='item' index='index' collection='deptNos' open='(' separator=',' close=')'>",
             "#{item}",
             "</foreach>",

+ 18 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzyReqrecMapper.java

@@ -436,4 +436,22 @@ public interface MzyReqrecMapper {
      */
     @Select("select rtrim(patient_id) patientId,times,receiptNo=1,amount=(req_fee+clinic_fee+oth_fee+brochure_fee),type=1,chequeType=paymode from mzy_reqrec WITH(NOLOCK) where times >0 and patient_id=#{patientId,jdbcType=CHAR} and op_id='99999' and receipt_bill is null and (req_fee+clinic_fee+oth_fee+brochure_fee)>0 and paymode<>'Y' order by times desc")
     List<Map<String,Object>> selectUnPrintReceiptSerial(@Param("patientId") String patientId);
+    /**
+     * @description:查询最近的就诊时间
+     * @author: lihong
+     * @date: 2023/7/25 16:27
+     * @param: reqrec
+     * @return: java.util.Date
+     **/
+    @Select(" select max(visit_date)  from mzy_reqrec where patient_id=#{patientId} and visit_dept=#{visitDept} ")
+    Date selectMaxVisitDateByPatientIdAndVisitDept(MzyReqrec reqrec);
+    /**
+     * @description:查询最近出院时间
+     * @author: lihong
+     * @date: 2023/7/25 17:33
+     * @param: reqrec
+     * @return: java.util.Date
+     **/
+    @Select(" select max(dis_date) from zy_inactpatient a,a_patient_mi b where a.inpatient_no=b.inpatient_no and a.zk_ward=#{visitDept} and b.mz_no=#{patientId}")
+    Date selectMaxDisDateByZkWardAndMzNo(MzyReqrec reqrec);
 }

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/his/mz/MzyReqrecService.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.service.his.mz;
 
+import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
 import cn.hnthyy.thmz.entity.his.mz.MzyReqrec;
@@ -226,4 +227,12 @@ public interface MzyReqrecService {
      * @return
      */
     int getTimes(MzPatientMi mzPatientMi) throws MzException;
+    /**
+     * @description:复诊效验
+     * @author: lihong
+     * @date: 2023/7/25 15:40
+     * @param: reqrec
+     * @return: cn.hnthyy.thmz.Utils.R
+     **/
+    R validFurtherVisit(MzyReqrec reqrec);
 }

+ 17 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzyReqrecServiceImpl.java

@@ -2,6 +2,7 @@ package cn.hnthyy.thmz.service.impl.his.mz;
 
 import cn.hnthyy.thmz.Utils.CloneUtil;
 import cn.hnthyy.thmz.Utils.DateUtil;
+import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.ResponceType;
@@ -23,6 +24,7 @@ import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.service.thmz.*;
 import cn.hnthyy.thmz.vo.MzyReqrecVo;
 import cn.hnthyy.thmz.vo.ThmzmxsrParamsVo;
+import cn.hutool.core.date.DateUnit;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -1073,4 +1075,19 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
         times++;
         return times;
     }
+
+    @Override
+    public R validFurtherVisit(MzyReqrec reqrec) {
+        if(Constants.FZ_CODE.equals(reqrec.getChargeType())){
+            Date now = new Date();
+            Date visitDate = mzyReqrecMapper.selectMaxVisitDateByPatientIdAndVisitDept(reqrec);
+            Date disDate = mzyReqrecMapper.selectMaxDisDateByZkWardAndMzNo(reqrec);
+            if ((visitDate != null && cn.hutool.core.date.DateUtil.between(visitDate, now, DateUnit.DAY) <= 3) || (disDate != null && cn.hutool.core.date.DateUtil.between(disDate, now, DateUnit.DAY) <= 15)) {
+                return R.ok();
+            }else {
+                return R.error("不满足挂复诊条件, 初诊后3天之内或出院后15天之内才可以挂复诊");
+            }
+        }
+        return R.ok();
+    }
 }

+ 41 - 18
src/main/resources/static/js/mz/registration.js

@@ -853,24 +853,47 @@ function confirmFeeModal() {
     if (!validatorResult) {
         return;
     }
-    var payTypeList = $("#payType").children();
-    if (payTypeList.length == 1) {
-        $('#payType').selectpicker('val', 'Y');
-    } else {
-        $('#payType').selectpicker('val', 1);
-    }
-    //$('#payType').selectpicker('val', 1);
-    $('#payType').selectpicker('refresh');
-    var prevAll = $("#changeAmountParent").prevAll();
-    while (prevAll.length > 2) {
-        $("#changeAmountParent").prev().remove();
-        prevAll = $("#changeAmountParent").prevAll();
-    }
-    $("#realMoney").val($("#amountMoneyConfirm").text());
-    $("#cash").val($("#amountMoneyConfirm").text());
-    //$("#cash").val(null);
-    $("#confirmFeeModal").modal();
-    sendPriceMessage($("#amountMoneyConfirm").text(), 0.0, 0.0, $("#patientId").val());
+    $.ajax({
+        type: "POST",
+        url: '/thmz/validFurtherVisit',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        data: JSON.stringify({
+            "patientId": $("#patientId").val(),
+            "visitDept": $("#deptNo").val(),
+            "chargeType": $("#chargeType").val()
+        }),
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code != 0) {
+                errorMesage(res)
+            }else {
+                var payTypeList = $("#payType").children();
+                if (payTypeList.length == 1) {
+                    $('#payType').selectpicker('val', 'Y');
+                } else {
+                    $('#payType').selectpicker('val', 1);
+                }
+                //$('#payType').selectpicker('val', 1);
+                $('#payType').selectpicker('refresh');
+                var prevAll = $("#changeAmountParent").prevAll();
+                while (prevAll.length > 2) {
+                    $("#changeAmountParent").prev().remove();
+                    prevAll = $("#changeAmountParent").prevAll();
+                }
+                $("#realMoney").val($("#amountMoneyConfirm").text());
+                $("#cash").val($("#amountMoneyConfirm").text());
+                //$("#cash").val(null);
+                $("#confirmFeeModal").modal();
+                sendPriceMessage($("#amountMoneyConfirm").text(), 0.0, 0.0, $("#patientId").val());
+            }
+        }
+    });
+
 }
 
 /**