Browse Source

临时优化报表方案

hurugang 5 years ago
parent
commit
8b35d84220

+ 2 - 0
src/main/java/cn/hnthyy/thmz/Utils/DateUtil.java

@@ -89,6 +89,7 @@ public class DateUtil {
         calendar.set(Calendar.MINUTE, 0);
         calendar.set(Calendar.SECOND, 0);
         calendar.add(Calendar.DAY_OF_YEAR, -1);
+        calendar.set(Calendar.MILLISECOND, 0);
         return calendar.getTime();
     }
 
@@ -102,6 +103,7 @@ public class DateUtil {
         calendar.set(Calendar.HOUR_OF_DAY, 0);
         calendar.set(Calendar.MINUTE, 0);
         calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
         return calendar.getTime();
     }
 

+ 1 - 0
src/main/java/cn/hnthyy/thmz/controller/api/MedicalViewApiController.java

@@ -1644,6 +1644,7 @@ public class MedicalViewApiController {
                 results.put("resultMessage", "未查询到待缴费明细记录");
                 return results;
             }
+            mzChargeDetailService.getMzChargeDetails(mzChargeDetailList);
             results.put("resultCode", 0);
             results.put("resultMessage", "待缴费记录明细查询成功");
             results.put("data", mzChargeDetailList);

+ 14 - 4
src/main/java/cn/hnthyy/thmz/mapper/his/ChargeFeeVoMapper.java

@@ -1004,16 +1004,17 @@ public interface ChargeFeeVoMapper {
             " (select dd.name from yp_zd_dict cc, yp_zd_drug_kind dd where cc.drug_kind = dd.code and cc.code = a.charge_item_code and cc.serial = a.serial)),  " +
             " je=round(a.quantity * a.unit_price * isnull(a.drug_win,1),2),  " +
             " c.charge_date,  " +
-            " c.dcount_date,   " +
+            " dcount_date=c.charge_dcount_date,   " +
             "      quty = a.quantity, " +
             "      price = a.unit_price, " +
             " e.parent_code " +
             "  from   ${firstTableName} a ," +
-            "  (select distinct patient_id,times,receipt_no, serial_no,receipt_sn,charge_date,dcount_date from ${secondTableName}) c," +
+            "  (select distinct patient_id,times,receipt_no, serial_no,receipt_sn,charge_date,charge_dcount_date from ${secondTableName}) c," +
             "  zd_charge_item d," +
             "  zy_zd_audit_item  e " +
             "   where " +
-            "    a.patient_id = c.patient_id " +
+            " a.pay_mark <![CDATA[<>]]> 9  " +
+            "   and a.patient_id = c.patient_id " +
             " and  a.times = c.times " +
             "   and a.receipt_no = c.receipt_no " +
             "  and  a.serial_no = c.serial_no  " +
@@ -1022,7 +1023,7 @@ public interface ChargeFeeVoMapper {
             "  when 'BILL10' then 'BILL01' when 'BILL11' then 'BILL28' when 'BILL12' then 'BILL02' else a.charge_bill_code end *=d.code " +
             "  and         isnull(d.audit_code,e.code)=e.code) mzsr  where mzsr.je <![CDATA[<>]]> 0 " +
             "  and  case '1' when #{caseType} then mzsr.charge_date else  mzsr.dcount_date end <![CDATA[>=]]>#{beginDate,jdbcType=TIMESTAMP} " +
-            "  and  case '1' when #{caseType} then mzsr.charge_date else  mzsr.dcount_date end <![CDATA[<=]]>#{endDate,jdbcType=TIMESTAMP} " +
+            "  and  case '1' when #{caseType} then mzsr.charge_date else  mzsr.dcount_date end <![CDATA[<]]>#{endDate,jdbcType=TIMESTAMP} " +
             "<when test='patientIds!=null'>" +
             " and mzsr.patient_id in" +
             "<foreach item='item' index='index' collection='patientIds' open='(' separator=',' close=')'>" +
@@ -1050,4 +1051,13 @@ public interface ChargeFeeVoMapper {
             + "</script>"})
     List<Mzmxsr> selectThmzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo);
 
+
+    /**
+     * 统计选定日期内费用总额 用于判断是否需要插入收费明细
+     * @param thmzmxsrParamsVo
+     * @return
+     */
+    @Select("select patient_id,SUM(total_charge)  from mz_receipt_serial where charge_dcount_date >=#{beginDate,jdbcType=TIMESTAMP} and  charge_dcount_date <#{endDate,jdbcType=TIMESTAMP}  GROUP BY patient_id order by patient_id desc ")
+    List<Map<String,Object>> selectSumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo);
+
 }

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

@@ -305,4 +305,13 @@ public interface ChargeFeeVoService {
      * @return
      */
     int modifyMzService();
+
+
+
+    /**
+     * 统计选定日期内费用总额 用于判断是否需要插入收费明细
+     * @param thmzmxsrParamsVo
+     * @return
+     */
+    List<Map<String,Object>> querySumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo);
 }

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

@@ -245,4 +245,9 @@ public class ChargeFeeVoServiceImpl implements ChargeFeeVoService {
     public int modifyMzService() {
         return mzReceiptSerialMapper.updateMzService();
     }
+
+    @Override
+    public List<Map<String, Object>> querySumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo) {
+        return chargeFeeVoMapper.selectSumAmount(thmzmxsrParamsVo);
+    }
 }

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

@@ -1864,6 +1864,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         newMzReceiptSerial.setPayId(opId);
                         newMzReceiptSerial.setReceiptSn(serialNo);
                         newMzReceiptSerial.setReceiptBill("");
+                        //本院记账被实际收费后设置
                         newMzReceiptSerial.setFpFlag(Constants.BYJZ);
                         newMzReceiptSerial.setChequeType(mzDepositFileVo.getMzDepositFiles().get(0).getChequeType());
                         newList.add(newMzReceiptSerial);

+ 1 - 1
src/main/resources/otherSource/thyy_mz_system.sql

@@ -128,7 +128,7 @@ CREATE TABLE `t_mzmxsr`  (
   `exec_dept` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '执行科室',
   `xmm` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '项目名',
   `hsm` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '核算码',
-  `je` decimal(10, 2) DEFAULT NULL COMMENT '金额',
+  `je` decimal(10, 1) DEFAULT NULL COMMENT '金额',
   `charge_date` datetime(0) DEFAULT NULL COMMENT '缴费时间',
   `dcount_date` datetime(0) DEFAULT NULL COMMENT '日结时间',
   `quty` double(255, 0) DEFAULT NULL COMMENT '数量',