瀏覽代碼

修复退费的缺陷

hurugang 5 年之前
父節點
當前提交
f963d5ae40

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

@@ -160,6 +160,7 @@ public interface MzReceiptSerialMapper {
      *
      * @param patientId
      * @param times
+     * @param receiptNo
      * @return
      */
     @Select({"<script>",
@@ -167,9 +168,9 @@ public interface MzReceiptSerialMapper {
             "charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,rtrim(pay_mark) pay_mark,total_charge,charge_date,rtrim(receipt_bill) receipt_bill,",
             "receipt_sn,dcount_date,rtrim(windows_no) windows_no,dcount_no,serial_yb,rtrim(fp_flag) fp_flag,rtrim(responce_type) responce_type,rtrim(cheque_type) cheque_type,cheque_no," +
                     "rtrim(tf_flag) tf_flag,dept_no,rtrim(pay_id) pay_id,charge_dcount_date,charge_dcount_no",
-            "from mz_receipt_serial where  patient_id=#{patientId,jdbcType=CHAR} and times = #{times,jdbcType=INTEGER}",
+            "from mz_receipt_serial where  patient_id=#{patientId,jdbcType=CHAR} and times = #{times,jdbcType=INTEGER} and receipt_no = #{receiptNo,jdbcType=INTEGER}",
             "</script>"})
-    List<MzReceiptSerial> selectSerialForThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times);
+    List<MzReceiptSerial> selectSerialForThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("receiptNo") Integer receiptNo);
 
 
     /**

+ 3 - 3
src/main/java/cn/hnthyy/thmz/mapper/his/MzyRequestMapper.java

@@ -213,7 +213,7 @@ public interface MzyRequestMapper {
      * @param unitCode
      * @return
      */
-    @Select("select CONVERT (varchar (100), request_day, 23) scheduleDate,sum(left_num) leftNum,sum(total_num) totalNum from mzy_request_new where unit_code =#{unitCode} and request_day >=#{beginDate,jdbcType=TIMESTAMP} and request_day <=#{endDate,jdbcType=TIMESTAMP} and isnull(doctor_code,'')<>''  group by request_day")
+    @Select("select CONVERT (varchar (100), request_day, 23) scheduleDate,sum(left_num) leftNum,sum(total_num) totalNum from mzy_request_new where unit_code =#{unitCode} and request_day >=#{beginDate,jdbcType=TIMESTAMP} and request_day <=#{endDate,jdbcType=TIMESTAMP} and isnull(doctor_code,'')<>''  and charge_type not in (16,24) group by request_day")
     List<Map<String,Object>> selectNumByDateAndDept(@Param("beginDate") Date beginDate, @Param("endDate") Date endDate, @Param("unitCode") String unitCode);
 
 
@@ -226,7 +226,7 @@ public interface MzyRequestMapper {
      * @return
      */
     @Select({"<script>",
-            "select doctor_code doctorCode,charge_type chargeType,check_fee checkFee,sum(left_num) leftNum from mzy_request_new where unit_code=#{unitCode} and request_day=#{requestDay,jdbcType=TIMESTAMP}  and del_flag=0 " ,
+            "select doctor_code doctorCode,charge_type chargeType,check_fee checkFee,sum(left_num) leftNum from mzy_request_new where unit_code=#{unitCode} and request_day=#{requestDay,jdbcType=TIMESTAMP}  and del_flag=0  and charge_type not in (16,24)" ,
             "<when test='ampms!=null'>",
             " and ampm  not in " ,
             "<foreach item='item' index='index' collection='ampms' open='(' separator=',' close=')'>",
@@ -249,7 +249,7 @@ public interface MzyRequestMapper {
      * @return
      */
     @Select({"<script>",
-            "select id mzyRequestId,ampm,doctor_code doctorCode,charge_type chargeType,check_fee checkFee,left_num leftNum from mzy_request_new where unit_code=#{unitCode} and request_day=#{requestDay,jdbcType=TIMESTAMP} and doctor_code  =#{doctorCode} and del_flag=0 " ,
+            "select id mzyRequestId,ampm,doctor_code doctorCode,charge_type chargeType,check_fee checkFee,left_num leftNum from mzy_request_new where unit_code=#{unitCode} and request_day=#{requestDay,jdbcType=TIMESTAMP} and doctor_code  =#{doctorCode} and del_flag=0  and charge_type not in (16,24)" ,
             "<when test='ampms!=null'>",
             " and ampm  not in " ,
             "<foreach item='item' index='index' collection='ampms' open='(' separator=',' close=')'>",

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

@@ -994,7 +994,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //是否全退
         boolean allRefund = mzChargeDetails == null || mzChargeDetails.size() == 0;
         List<String> chargeItemCodeList = mzChargeDetails.stream().filter(u -> StringUtils.isNotBlank(u.getChargeItemCode())).map(u -> u.getChargeItemCode()).collect(Collectors.toList());
-        List<MzChargeDetail> oriMzChargeDetails = mzChargeDetailMapper.selectMzChargeDetailByPatientId(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(),null, PayMarkEnum.CHARGED.code);
+        List<MzChargeDetail> oriMzChargeDetails = mzChargeDetailMapper.selectMzChargeDetailByPatientId(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(),mzDepositFileVo.getReceiptNo(), PayMarkEnum.CHARGED.code);
         Date now = new Date();
         List<MzChargeDetail> tcMzChargeDetails = new ArrayList<>();
         List<MzChargeDetail> removeMzChargeDetails = new ArrayList<>();
@@ -1007,7 +1007,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         updateMzChargeDetail.setReceiptNo(mzDepositFileVo.getReceiptNo());
         updateMzChargeDetail.setConfirmFlag(ConfirmFlagEnum.CANCEL.code);
         mzChargeDetailMapper.updatePayMakAndPrintFlag(updateMzChargeDetail);
-        List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectSerialForThisTime(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
+        List<MzReceiptSerial> mzReceiptSerials = mzReceiptSerialMapper.selectSerialForThisTime(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(),mzDepositFileVo.getReceiptNo());
         if (mzReceiptSerials != null && mzReceiptSerials.size() > 0) {
             List<MzReceiptSerial> newReceiptSerials = formatRefundReceiptSerial(mzReceiptSerials, opId);
             mzReceiptSerialMapper.batchInsertMzReceiptSerial(newReceiptSerials);