Browse Source

优化取消退药功能

hurugang 3 years ago
parent
commit
5c3d508483

+ 14 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/YpMzFytjController.java

@@ -2,10 +2,12 @@ package cn.hnthyy.thmz.controller.mz;
 
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
 import cn.hnthyy.thmz.entity.his.yp.YpMzFytj;
 import cn.hnthyy.thmz.entity.his.yp.YpZdGroupName;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.ConfirmFlagEnum;
+import cn.hnthyy.thmz.service.his.mz.MzPatientMiService;
 import cn.hnthyy.thmz.service.his.yp.YpMzFytjService;
 import cn.hnthyy.thmz.service.his.yp.YpZdGroupNameService;
 import cn.hnthyy.thmz.vo.*;
@@ -27,6 +29,8 @@ public class YpMzFytjController {
     private YpMzFytjService ypMzFytjService;
     @Autowired
     private YpZdGroupNameService ypZdGroupNameService;
+    @Autowired
+    private MzPatientMiService mzPatientMiService;
     /**
      * 门诊医生查询发药记录单
      *
@@ -54,6 +58,11 @@ public class YpMzFytjController {
             }
             if(StringUtils.isBlank(chargeFeeParamsVo.getPatientId())){
                 chargeFeeParamsVo.setPatientId(null);
+            }else {
+                MzPatientMi mzPatientMi= mzPatientMiService.queryByIcCardNo(chargeFeeParamsVo.getPatientId());
+                if(mzPatientMi!=null && StringUtils.isNotBlank(mzPatientMi.getPatientId())){
+                    chargeFeeParamsVo.setPatientId(mzPatientMi.getPatientId());
+                }
             }
             chargeFeeParamsVo.setConfirmFlag(ConfirmFlagEnum.CONFIRM.code);
             User tokenUser = TokenUtil.getUser(httpServletRequest);
@@ -263,6 +272,11 @@ public class YpMzFytjController {
             }
             if(StringUtils.isBlank(chargeFeeParamsVo.getPatientId())){
                 chargeFeeParamsVo.setPatientId(null);
+            }else {
+                MzPatientMi mzPatientMi= mzPatientMiService.queryByIcCardNo(chargeFeeParamsVo.getPatientId());
+                if(mzPatientMi!=null && StringUtils.isNotBlank(mzPatientMi.getPatientId())){
+                    chargeFeeParamsVo.setPatientId(mzPatientMi.getPatientId());
+                }
             }
             User tokenUser = TokenUtil.getUser(httpServletRequest);
             chargeFeeParamsVo.setOpId(tokenUser.getUserIdCode());

+ 2 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpMzFytjMapper.java

@@ -317,7 +317,7 @@ public interface YpMzFytjMapper {
      * @param ypMzFytj
      * @return
      */
-    @Delete("delete from yp_mz_fytj where patient_id =#{patientId} and  times = #{times} and receipt_no =#{receiptNo} and confirm_flag=2 ")
+    @Delete("delete from yp_mz_fytj where patient_id =#{patientId} and  times = #{times} and receipt_no =#{receiptNo} and order_no=#{orderNo} and confirm_flag=2 ")
     int deleteYpMzFytj(YpMzFytj ypMzFytj);
 
 
@@ -327,7 +327,7 @@ public interface YpMzFytjMapper {
      * @param ypMzFytj
      * @return
      */
-    @Update("update yp_mz_fytj set real_no=-real_no,serial_no=-serial_no where patient_id = #{patientId} and times = #{times}")
+    @Update("update yp_mz_fytj set real_no=-real_no,serial_no=-serial_no where patient_id = #{patientId} and times = #{times} and receipt_no =abs(#{receiptNo}) and order_no=#{orderNo}")
     int repealRefund(YpMzFytj ypMzFytj);
 
     /**

+ 30 - 30
src/main/resources/static/js/mz/refund_medicine.js

@@ -151,41 +151,41 @@ function queryParams(params) {
         beginDate: rePortRangeArr[0],
         endDate: rePortRangeArr[1],
         name: $("#name").val(),
-        patientId: $("#patientId").val(),
+        patientId: $("#patientId_or_cardNo").val(),
         serialNo: $("#serialNo").val()
     };
     return temp;
 };
 
-
-/**
- * 设置病人id
- */
-function setPatientId() {
-    var patientId_or_cardNo = $("#patientId_or_cardNo").val();
-    $.ajax({
-        type: "GET",
-        url: '/thmz/getByIcCardNo?icCardNo=' + patientId_or_cardNo,
-        contentType: "application/json;charset=UTF-8",
-        dataType: "json",
-        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) {
-                if (res.data != null) {
-                    $("#patientId").val(res.data.patientId);
-                } else {
-                    $("#patientId").val(patientId_or_cardNo);
-                }
-            }else {
-                $("#patientId").val(null);
-            }
-        }
-    });
-}
+//
+// /**
+//  * 设置病人id
+//  */
+// function setPatientId() {
+//     var patientId_or_cardNo = $("#patientId_or_cardNo").val();
+//     $.ajax({
+//         type: "GET",
+//         url: '/thmz/getByIcCardNo?icCardNo=' + patientId_or_cardNo,
+//         contentType: "application/json;charset=UTF-8",
+//         dataType: "json",
+//         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) {
+//                 if (res.data != null) {
+//                     $("#patientId").val(res.data.patientId);
+//                 } else {
+//                     $("#patientId").val(patientId_or_cardNo);
+//                 }
+//             }else {
+//                 $("#patientId").val(null);
+//             }
+//         }
+//     });
+// }
 
 
 /**

+ 34 - 33
src/main/resources/static/js/mz/repeal_refund_medicine.js

@@ -61,7 +61,7 @@ function initRepealRefundListByPatient() {
                 valign: 'middle',
                 // sortable: true,
                 formatter: function (value, row, index) {
-                    return '<button type="button" class="registration-no-color-foot-button" title="取消退药申请" onclick="repealRefund(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ',' + row.realNo + ')"><i class="fa fa-reply"></i></button>';
+                    return '<button type="button" class="registration-no-color-foot-button" title="取消退药申请" onclick="repealRefund(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ',' + row.realNo + ','+row.orderNo+')"><i class="fa fa-reply"></i></button>';
                 }
             }
             , {
@@ -146,7 +146,7 @@ function queryParams(params) {
         beginDate: rePortRangeArr[0],
         endDate: rePortRangeArr[1],
         name: $("#name").val(),
-        patientId: $("#patientId").val(),
+        patientId: $("#patientId_or_cardNo").val(),
         serialNo: $("#serialNo").val()
     };
     return temp;
@@ -159,14 +159,15 @@ function queryParams(params) {
  * @param times
  * @param receiptNo
  * @param realNo
+ * @param orderNo
  */
-function repealRefund(patientId, times, receiptNo, realNo) {
+function repealRefund(patientId, times, receiptNo, realNo,orderNo) {
     $.ajax({
         type: "POST",
         url: '/thmz/repealRefund',
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
-        data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo, "realNo": realNo}),
+        data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo, "realNo": realNo,"orderNo":orderNo}),
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
         success: function (res) {
             if (res == '401' || res == 401) {
@@ -183,35 +184,35 @@ function repealRefund(patientId, times, receiptNo, realNo) {
     });
 }
 
-
-/**
- * 设置病人id
- */
-function setPatientId() {
-    var patientId_or_cardNo = $("#patientId_or_cardNo").val();
-    $.ajax({
-        type: "GET",
-        url: '/thmz/getByIcCardNo?icCardNo=' + patientId_or_cardNo,
-        contentType: "application/json;charset=UTF-8",
-        dataType: "json",
-        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) {
-                if (res.data != null) {
-                    $("#patientId").val(res.data.patientId);
-                } else {
-                    $("#patientId").val(patientId_or_cardNo);
-                }
-            } else {
-                $("#patientId").val(null);
-            }
-        }
-    });
-}
+//
+// /**
+//  * 设置病人id
+//  */
+// function setPatientId() {
+//     var patientId_or_cardNo = $("#patientId_or_cardNo").val();
+//     $.ajax({
+//         type: "GET",
+//         url: '/thmz/getByIcCardNo?icCardNo=' + patientId_or_cardNo,
+//         contentType: "application/json;charset=UTF-8",
+//         dataType: "json",
+//         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) {
+//                 if (res.data != null) {
+//                     $("#patientId").val(res.data.patientId);
+//                 } else {
+//                     $("#patientId").val(patientId_or_cardNo);
+//                 }
+//             } else {
+//                 $("#patientId").val(null);
+//             }
+//         }
+//     });
+// }
 
 
 /**

+ 1 - 2
src/main/resources/templates/mz/refund_medicine.html

@@ -22,9 +22,8 @@
                         </label>
                         <div class="col-md-2 col-sm-2 col-xs-12">
                             <input id="patientId_or_cardNo" class="form-control col-md-7 col-xs-12" type="text"
-                                   onchange="setPatientId()"
                                    placeholder="病人ID/就诊卡号">
-                            <input id="patientId" type="hidden">
+                            <!--<input id="patientId" type="hidden">-->
                         </div>
                         <div class="col-md-2 col-sm-2 col-xs-12"></div>
                     </div>

+ 0 - 2
src/main/resources/templates/mz/repeal_refund_medicine.html

@@ -22,9 +22,7 @@
                         </label>
                         <div class="col-md-2 col-sm-2 col-xs-12">
                             <input id="patientId_or_cardNo" class="form-control col-md-7 col-xs-12" type="text"
-                                   onchange="setPatientId()"
                                    placeholder="病人ID/就诊卡号">
-                            <input id="patientId" type="hidden">
                         </div>
                         <div class="col-md-2 col-sm-2 col-xs-12"></div>
                     </div>