浏览代码

退费修复

hurugang 6 年之前
父节点
当前提交
14d23c1c80

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

@@ -151,6 +151,10 @@ public class YpMzFytjController {
                 resultMap.put("code", -1);
                 resultMap.put("message", "药房编码不能为空");
             }
+            if(StringUtils.isBlank(chargeFeeParamsVo.getOrderNo())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "处方号不能为空");
+            }
             if(chargeFeeParamsVo.getChargeItemCodeAndDecAmounts()==null || chargeFeeParamsVo.getChargeItemCodeAndDecAmounts().size()==0){
                 resultMap.put("code", -1);
                 resultMap.put("message", "退药记录不能为空");

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

@@ -32,8 +32,8 @@ public interface YpMzFytjMapper {
             "quantity,unit_price,rtrim(pay_mark) pay_mark,rtrim(serial) serial,rtrim(charge_item_type) charge_item_type,rtrim(country_flag) country_flag,rtrim(drug_flag) drug_flag," +
             "serial_no,rtrim(name) name,charge_date,rtrim(group_no) group_no,confirm_time,rtrim(input_id) input_id,input_time,drugname,specification,confirm_name,confirm_id," +
             "rtrim(doctor_id) doctor_id,doctor_name,confirm_flag,cy_fy,rtrim(warn_dept) warn_dept,rtrim(windows_no) windows_no,rtrim(win_no) win_no,input_date," +
-            "rtrim(group_no_out) group_no_out,rtrim(response_type) response_type,rtrim(self_flag) self_flag,real_no from yp_mz_fytj where serial_no = #{serialNo} and group_no = #{groupNoOut} ")
-    List<YpMzFytj> selectConfirdYpMzFytjBySerialNoAndGroupNo(@Param("serialNo") String serialNo, @Param("groupNoOut") String groupNoOut);
+            "rtrim(group_no_out) group_no_out,rtrim(response_type) response_type,rtrim(self_flag) self_flag,real_no from yp_mz_fytj where serial_no = #{serialNo} and group_no = #{groupNoOut} and order_no = #{orderNo}")
+    List<YpMzFytj> selectConfirdYpMzFytjBySerialNoAndGroupNo(@Param("serialNo") String serialNo, @Param("groupNoOut") String groupNoOut,@Param("orderNo") String orderNo);
 
 
 

+ 7 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailServiceImpl.java

@@ -395,6 +395,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             Map<String, MzDrugWin> mzDrugWinMap = new HashMap<>();
             Map<String, Integer> yffyNoMap = new HashMap<>();
             Map<String, Integer> orderNoMap = new HashMap<>();
+            Map<String, Integer> itemNoMap = new HashMap<>();
             for (MzChargeDetail m : mzChargeDetailList) {
                 m.setSerialNo(serialNo);
                 m.setRealNo(serialNo);
@@ -406,6 +407,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 }
                 setChargeDetail(mzDrugWinMap, yffyNoMap, orderNoMap, m);
                 mzChargeDetailMapper.updateMzChargeDetail(m);
+                itemNoMap.put(m.getChargeItemCode().trim(),m.getItemNo());
             }
             //收费时药品库存操作
             if (refundTimes == null) {
@@ -422,7 +424,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             }
             //退费时药品库存操作
             if (refundTimes != null) {
-                //退费
+                //退费 此时药房还没有发药 直接修改发药队列数据
                 List<MzYpFydl> mzYpFydls = mzYpFydlMapper.selectMzYpFydl(patientId, refundTimes);
                 if (mzYpFydls != null && mzYpFydls.size() > 0) {
                     mzYpFydlMapper.deleteMzYpFydl(patientId, refundTimes);
@@ -454,6 +456,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         ypMzFytj.setReceiptNo(ypMzFytj.getReceiptNo() + 1);
                         ypMzFytj.setSerialNo(serialNo);
                         ypMzFytj.setRealNo(serialNo);
+                        ypMzFytj.setItemNo(itemNoMap.get(ypMzFytj.getChargeItemCode().trim()));
                         ypMzFytjMapper.insertYpMzFytj(ypMzFytj);
                     }
                 }
@@ -472,6 +475,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         ypMzFytj.setSerialNo(serialNo);
                         ypMzFytj.setConfirmFlag(ConfirmFlagEnum.CONFIRM.code);
                         ypMzFytj.setRealNo(serialNo);
+                        ypMzFytj.setItemNo(itemNoMap.get(ypMzFytj.getChargeItemCode().trim()));
                         ypMzFytjMapper.insertYpMzFytj(ypMzFytj);
                     }
                 }
@@ -810,7 +814,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         for (MzChargeDetail md : newMzChargeDetailList) {
             if (supplyList.contains(md.getChargeItemCode())) {
                 removeList.add(md);
+                continue;
             }
+            md.setConfirmFlag(ConfirmFlagEnum.NOT_CONFIRM.code);
         }
         newMzChargeDetailList.removeAll(removeList);
         newMzChargeDetailList.addAll(supplyFeeMzChargeDetails);

+ 12 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/YpMzFytjServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.service.impl.his;
 
 import cn.hnthyy.thmz.Utils.CloneUtil;
+import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.his.YpMzFytj;
 import cn.hnthyy.thmz.enums.ConfirmFlagEnum;
 import cn.hnthyy.thmz.mapper.his.YpMzFytjMapper;
@@ -13,6 +14,7 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -44,7 +46,7 @@ public class YpMzFytjServiceImpl implements YpMzFytjService {
             String [] arr=str.split(",");
             chargeItemCodeAndDecAmountMap.put(arr[0].trim(),arr[1].trim());
         }
-        List<YpMzFytj> ypMzFytjList=ypMzFytjMapper.selectConfirdYpMzFytjBySerialNoAndGroupNo(chargeFeeParamsVo.getSerialNo(),chargeFeeParamsVo.getGroupNoOut());
+        List<YpMzFytj> ypMzFytjList=ypMzFytjMapper.selectConfirdYpMzFytjBySerialNoAndGroupNo(chargeFeeParamsVo.getSerialNo(),chargeFeeParamsVo.getGroupNoOut(),chargeFeeParamsVo.getOrderNo());
         if(ypMzFytjList==null || ypMzFytjList.size()==0){
             return 0;
         }
@@ -55,10 +57,18 @@ public class YpMzFytjServiceImpl implements YpMzFytjService {
                 ypMzFytj.setRealNo(-ypMzFytj.getRealNo());
                 ypMzFytjMapper.updateYpMzFytj(ypMzFytj);
                 String decAmount=chargeItemCodeAndDecAmountMap.get(ypMzFytj.getChargeItemCode().trim());
+                if(StringUtils.isNotBlank(decAmount)){
+                    decAmount=decAmount.replace("<br>","");
+                }
                 if(StringUtils.isBlank(decAmount)){
                     newYpMzFytj.setQuantity(0D);
                 }else {
-                    newYpMzFytj.setQuantity(Double.valueOf(decAmount));
+                    if(Constants.CYF.equals(newYpMzFytj.getBillItemCode().trim())){
+                        newYpMzFytj.setQuantity(BigDecimal.valueOf(Double.valueOf(decAmount)).divide(BigDecimal.valueOf(newYpMzFytj.getCyFy())).doubleValue());
+                    }else {
+                        newYpMzFytj.setQuantity(Double.valueOf(decAmount));
+                    }
+
                 }
                 newYpMzFytj.setReceiptNo(-newYpMzFytj.getReceiptNo());
                 newYpMzFytj.setSerialNo(-newYpMzFytj.getSerialNo());

+ 4 - 1
src/main/resources/static/js/refund_medicine.js

@@ -308,6 +308,8 @@ function fitfymx(patientId,times,receiptNo,orderNo,groupNoOut) {
             var bill_item_code=row.bill_item_code.trim();
             if(field == 'dec_amount' && (bill_item_code =='010' || bill_item_code =='011')){
                 $element.attr('contenteditable', true);
+                $element.html(null);
+                $element.focus();
                 $element.blur(function() {
                     var index = $element.parent().data('index');
                     var tdValue = $element.html();
@@ -359,10 +361,11 @@ function fitfymx(patientId,times,receiptNo,orderNo,groupNoOut) {
  */
 function saveRefundMedicine() {
     var data= $table.bootstrapTable('getData');
-    var jsonData = JSON.parse('{"serialNo":"","groupNoOut":"","chargeItemCodeAndDecAmounts":[]}');
+    var jsonData = JSON.parse('{"serialNo":"","groupNoOut":"","orderNo":"","chargeItemCodeAndDecAmounts":[]}');
     if(data!=null){
         jsonData.serialNo = data[0].serial_no;
         jsonData.groupNoOut = data[0].group_no;
+        jsonData.orderNo = data[0].order_no;
         for (var i=0;i<data.length;i++){
             var dec_amount=data[i].dec_amount;
             if(dec_amount==null || dec_amount==""){