소스 검색

解决费用异常问题

hurugang 4 년 전
부모
커밋
c5c76aa1ca

+ 35 - 0
src/main/java/cn/hnthyy/thmz/controller/ChargeFeeVoController.java

@@ -50,6 +50,8 @@ public class ChargeFeeVoController {
     private MzPatientMiService mzPatientMiService;
     @Autowired
     private MzmxsrService mzmxsrService;
+    @Autowired
+    private MzReceiptSerialService mzReceiptSerialService;
     /**
      * 查询日结列表收费清单 未结账
      *
@@ -1175,4 +1177,37 @@ public class ChargeFeeVoController {
         ExcelUtil.exportExcelForThmzmxsrs(request, response, mzmxsrs);
         return null;
     }
+
+
+
+
+    /**
+     * 查询费用不一致接口
+     *
+     * @return
+     */
+    @RequestMapping(value = "/getDiff", method = {RequestMethod.GET})
+    public Map<String, Object> getDiff(@RequestParam("beginDate") String beginDate,@RequestParam("endDate") String endDate) {
+        List<String> mzPatientIds = mzmxsrService.queryAllPatientId(beginDate,endDate);
+        if (mzPatientIds != null && mzPatientIds.size() > 0) {
+            ThmzmxsrParamsVo thmzmxsrParamsVo = new ThmzmxsrParamsVo();
+            thmzmxsrParamsVo.setCaseType(YesNoEnum.NO.code.toString());
+            thmzmxsrParamsVo.setBeginDate(DateUtil.pase(beginDate, "yyyy-MM-dd HH:mm:ss"));
+            thmzmxsrParamsVo.setEndDate(DateUtil.pase(endDate, "yyyy-MM-dd HH:mm:ss"));
+            thmzmxsrParamsVo.setOffset(0);
+            for (String str :mzPatientIds){
+                thmzmxsrParamsVo.setPatientIds(Arrays.asList(str));
+                BigDecimal amount=mzmxsrService.querySumAmount(thmzmxsrParamsVo).setScale(1, BigDecimal.ROUND_HALF_UP);
+                BigDecimal fpAmount= mzReceiptSerialService.querySumByPatientId(beginDate,endDate,str).setScale(1, BigDecimal.ROUND_HALF_UP);
+                if(amount.compareTo(fpAmount)!=0){
+                    log.info("--------------费用明细统计金额 {},发票金额 {},病人id {}-----------------",amount,fpAmount,str);
+                }
+            }
+            System.out.println("计算结束");
+        }
+        return null;
+    }
+
+
+
 }

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/MzChargeDetailMapper.java

@@ -492,7 +492,7 @@ public interface MzChargeDetailMapper {
      */
     @Update({"<script>",
             "update mz_charge_detail ",
-            "<trim prefix='set' prefixOverrides=',' suffix=' where patient_id = #{patientId} and times=#{times} and charge_item_code=#{chargeItemCode,jdbcType=CHAR}' >",
+            "<trim prefix='set' prefixOverrides=',' suffix=' where patient_id = #{patientId} and times=#{times} and charge_item_code=#{chargeItemCode,jdbcType=CHAR} and order_no = #{orderNo} and  item_no=#{itemNo} ' >",
             "<when test='serialNo!=null'>",
             "serial_no =#{serialNo,jdbcType=INTEGER}",
             "</when>",

+ 10 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/MzReceiptSerialMapper.java

@@ -346,4 +346,14 @@ public interface MzReceiptSerialMapper {
                     "</script>"})
     List<Map<String, Object>> selectChargeListByPatient(@Param("patientIds") List<String> patientIds, @Param("serialNo") String serialNo, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate,@Param("tableName") String tableName);
 
+
+    /**
+     * 查询病人当天的费用
+     * @param beginDate
+     * @param endDate
+     * @param patientId
+     * @return
+     */
+    @Select("select  sum(total_charge) from  mz_receipt_serial where charge_dcount_date >=#{beginDate}  and charge_dcount_date<=#{endDate} and patient_id=#{patientId}")
+    BigDecimal selectSumByPatientId(@Param("beginDate") String beginDate, @Param("endDate") String endDate,@Param("patientId") String patientId);
 }

+ 10 - 0
src/main/java/cn/hnthyy/thmz/mapper/thmz/MzmxsrMapper.java

@@ -174,4 +174,14 @@ public interface MzmxsrMapper {
             + "</script>"})
     BigDecimal selectSumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo);
 
+
+    /**
+     * 按天查询不所有的收费病人id
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @Select("select patient_id from t_mzmxsr where dcount_date>=#{beginDate}  and dcount_date<=#{endDate} GROUP BY patient_id")
+    List<String> selectAllPatientId(@Param(value = "beginDate") String beginDate,@Param(value = "endDate") String endDate);
+
 }

+ 10 - 0
src/main/java/cn/hnthyy/thmz/service/his/MzReceiptSerialService.java

@@ -116,4 +116,14 @@ public interface MzReceiptSerialService {
      */
     List<Map<String, Object>> queryChargeListByPatient(List<String> patientIds, String serialNo, Date beginDate, Date endDate, String tableName);
 
+
+    /**
+     * 查询病人当天的费用
+     * @param beginDate
+     * @param endDate
+     * @param patientId
+     * @return
+     */
+    BigDecimal querySumByPatientId(String beginDate, String endDate,String patientId);
+
 }

+ 5 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/MzReceiptSerialServiceImpl.java

@@ -269,4 +269,9 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
         return list;
     }
 
+    @Override
+    public BigDecimal querySumByPatientId(String beginDate, String endDate, String patientId) {
+        return mzReceiptSerialMapper.selectSumByPatientId(beginDate,endDate,patientId);
+    }
+
 }

+ 5 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/MzmxsrServiceImpl.java

@@ -38,4 +38,9 @@ public class MzmxsrServiceImpl implements MzmxsrService {
     public BigDecimal querySumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo) {
         return mzmxsrMapper.selectSumAmount(thmzmxsrParamsVo);
     }
+
+    @Override
+    public List<String> queryAllPatientId(String beginDate, String endDate) {
+        return mzmxsrMapper.selectAllPatientId(beginDate,endDate);
+    }
 }

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/MzmxsrService.java

@@ -52,4 +52,13 @@ public interface MzmxsrService {
      */
     BigDecimal querySumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo);
 
+
+    /**
+     * 按天查询不所有的收费病人id
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    List<String> queryAllPatientId(String beginDate,String endDate);
+
 }

+ 1 - 0
src/main/resources/static/js/actpatient.js

@@ -458,6 +458,7 @@ function execute() {
                 successMesage(res);
                 $("#settlementModal").modal("hide");
                 clearMode();
+                $('#tb_table').bootstrapTable("refresh");
                 return;
             }
             if (res.code == -1) {