Browse Source

修改费用列表

hurugang 5 years ago
parent
commit
04835e0985

+ 17 - 12
src/main/java/cn/hnthyy/thmz/controller/MzChargeDetailController.java

@@ -750,23 +750,28 @@ public class MzChargeDetailController {
                 resultMap.put("message", "检索结束时间不能为空");
                 return resultMap;
             }
-            if (StringUtils.isBlank(chargeFeeParamsVo.getPatientId())) {
-                chargeFeeParamsVo.setPatientId(null);
+            if (StringUtils.isBlank(chargeFeeParamsVo.getSerialNo())) {
+                chargeFeeParamsVo.setSerialNo(null);
             } else {
-                chargeFeeParamsVo.setPatientId("%" + chargeFeeParamsVo.getPatientId() + "%");
+                chargeFeeParamsVo.setSerialNo("%" + chargeFeeParamsVo.getSerialNo() + "%");
             }
+            List<String> patientIds=null;
             if (StringUtils.isBlank(chargeFeeParamsVo.getName())) {
                 chargeFeeParamsVo.setName(null);
             } else {
-                chargeFeeParamsVo.setName("%" + chargeFeeParamsVo.getName() + "%");
+                List<MzPatientMi> mzPatientMis=mzPatientMiService.queryByName(chargeFeeParamsVo.getName());
+                if(mzPatientMis!=null){
+                    patientIds=  mzPatientMis.stream().map(m-> m.getPatientId()).collect(Collectors.toList());
+                }
             }
-            if (StringUtils.isBlank(chargeFeeParamsVo.getSerialNo())) {
-                chargeFeeParamsVo.setSerialNo(null);
-            } else {
-                chargeFeeParamsVo.setSerialNo("%" + chargeFeeParamsVo.getSerialNo() + "%");
+            if (StringUtils.isNotBlank(chargeFeeParamsVo.getPatientId())) {
+                if(patientIds==null){
+                    patientIds = new ArrayList<>();
+                }
+                patientIds.add(chargeFeeParamsVo.getPatientId());
             }
             resultMap.put("code", 0);
-            resultMap.put("mzChargeDetailList", mzChargeDetailService.queryChargeListByPatient(chargeFeeParamsVo.getHisData(), chargeFeeParamsVo.getPatientId(), chargeFeeParamsVo.getName(), chargeFeeParamsVo.getSerialNo(), chargeFeeParamsVo.getBeginDate(), chargeFeeParamsVo.getEndDate()));
+            resultMap.put("mzChargeDetailList", mzReceiptSerialService.queryChargeListByPatient(patientIds,chargeFeeParamsVo.getSerialNo(),chargeFeeParamsVo.getBeginDate(), chargeFeeParamsVo.getEndDate(),YesNoEnum.YES.equals(chargeFeeParamsVo.getHisData())?"mz_receipt_serial_b":"mz_receipt_serial" ));
             resultMap.put("message", "查询病人缴费记录成功");
             return resultMap;
         } catch (Exception e) {
@@ -861,13 +866,13 @@ public class MzChargeDetailController {
                 resultMap.put("message", "病人id不能为空");
                 return resultMap;
             }
-            List<Map<String, Object>> mzChargeDetailList = mzChargeDetailService.queryChargeListByPatient(chargeFeeParamsVo.getHisData(), "%" + chargeFeeParamsVo.getPatientId() + "%", null, null, chargeFeeParamsVo.getBeginDate(), chargeFeeParamsVo.getEndDate());
+            List<Map<String, Object>> mzChargeDetailList = mzReceiptSerialService.queryChargeListByPatient(Arrays.asList(chargeFeeParamsVo.getPatientId()),null,chargeFeeParamsVo.getBeginDate(), chargeFeeParamsVo.getEndDate(),YesNoEnum.YES.equals(chargeFeeParamsVo.getHisData())?"mz_receipt_serial_b":"mz_receipt_serial" );
             List<Map<String, Object>> data = new ArrayList<>();
             if (mzChargeDetailList != null) {
                 for (Map<String, Object> map : mzChargeDetailList) {
                     if (map != null) {
-                        Integer realNo = (Integer) map.get("real_no");
-                        data.addAll(mzChargeDetailService.queryChargeDetailByPatient(chargeFeeParamsVo.getHisData(), chargeFeeParamsVo.getPatientId(), realNo.toString()));
+                        Integer serialNo = (Integer) map.get("serial_no");
+                        data.addAll(mzChargeDetailService.queryChargeDetailByPatient(chargeFeeParamsVo.getHisData(), chargeFeeParamsVo.getPatientId(), serialNo.toString()));
                     }
                 }
             }

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

@@ -7,7 +7,9 @@ import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 public interface MzReceiptSerialMapper {
     /**
@@ -310,4 +312,37 @@ public interface MzReceiptSerialMapper {
             "</script>"})
     List<MzReceiptSerial> selectSerialForJzTfThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times);
 
+
+
+
+
+
+    /**
+     * 查询病人缴费记录
+     *
+     * @param patientIds
+     * @param serialNo
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    @Select({"<script>",
+            "SELECT rtrim(patient_id) patient_id,times,receipt_no,serial_no,charge_date=convert(char(10),charge_date,111) ,serial_no," +
+                    " cheque_type=case when cheque_type='Y' " +
+                    " and (len(ltrim(rtrim(receipt_bill))) >= 10 or len(ltrim(rtrim(receipt_bill)))=0) then '本院记账' else '自费' end " +
+                    "  ,serial_no_order=ABS(serial_no)  FROM ${tableName} " +
+                    "  WHERE charge_date <![CDATA[>=]]> #{beginDate,jdbcType=TIMESTAMP} and charge_date <![CDATA[<=]]> #{endDate,jdbcType=TIMESTAMP}  " +
+                    "<when test='patientIds!=null'>",
+            " and patient_id in ",
+            "<foreach item='item' index='index' collection='patientIds' open='(' separator=',' close=')'>",
+            "#{item}",
+            "</foreach>",
+            "</when>",
+            "<when test='serialNo!=null'>",
+            " and serial_no like #{serialNo}",
+            "</when>",
+            " order by serial_no_order desc" +
+                    "</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);
+
 }

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

@@ -6,7 +6,9 @@ import cn.hnthyy.thmz.entity.his.MzReceiptSerial;
 import cn.hnthyy.thmz.entity.thmz.User;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 public interface MzReceiptSerialService {
     /**
@@ -102,4 +104,16 @@ public interface MzReceiptSerialService {
      */
     String obsoleteAndRepPrint(MzReceiptSerial mzReceiptSerial, User user) throws MzException;
 
+
+    /**
+     * 查询病人缴费记录
+     *
+     * @param patientIds
+     * @param serialNo
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    List<Map<String, Object>> queryChargeListByPatient(List<String> patientIds, String serialNo, Date beginDate, Date endDate, String tableName);
+
 }

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

@@ -3,6 +3,7 @@ package cn.hnthyy.thmz.service.impl.his;
 import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.MzDepositFile;
+import cn.hnthyy.thmz.entity.his.MzPatientMi;
 import cn.hnthyy.thmz.entity.his.MzReceiptSerial;
 import cn.hnthyy.thmz.entity.his.MzVisitTable;
 import cn.hnthyy.thmz.entity.thmz.Receipt;
@@ -14,6 +15,7 @@ import cn.hnthyy.thmz.mapper.his.MzDepositFileMapper;
 import cn.hnthyy.thmz.mapper.his.MzReceiptSerialMapper;
 import cn.hnthyy.thmz.mapper.his.MzVisitTableMapper;
 import cn.hnthyy.thmz.mapper.thmz.ReceiptMapper;
+import cn.hnthyy.thmz.service.his.MzPatientMiService;
 import cn.hnthyy.thmz.service.his.MzReceiptSerialService;
 import cn.hnthyy.thmz.service.his.MzSerialNoService;
 import org.apache.commons.lang3.StringUtils;
@@ -23,9 +25,9 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.awt.*;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
+import java.util.*;
 import java.util.List;
 
 @Service
@@ -47,6 +49,8 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
     private MzVisitTableMapper mzVisitTableMapper;
     @Autowired
     private MzSerialNoService mzSerialNoService;
+    @Autowired
+    private MzPatientMiService mzPatientMiService;
 
     @Override
     public List<MzReceiptSerial> queryTallyReceiptSerial(String patientId) {
@@ -232,4 +236,21 @@ public class MzReceiptSerialServiceImpl implements MzReceiptSerialService {
         return mzReceiptSerial.getReceiptBill();
     }
 
+    @Override
+    public List<Map<String, Object>> queryChargeListByPatient(List<String> patientIds, String serialNo, Date beginDate, Date endDate, String tableName) {
+        List<Map<String, Object>> list=  mzReceiptSerialMapper.selectChargeListByPatient(patientIds,serialNo,beginDate,endDate,tableName);
+        Map<String,String> patientIdMap = new HashMap<>();
+        for (Map<String, Object> map : list) {
+            String patientIdTemp = (String) map.get("patient_id");
+            String name =patientIdMap.get(patientIdTemp);
+            if(StringUtils.isBlank(name)){
+                MzPatientMi mzPatientMi= mzPatientMiService.queryByPatientId(patientIdTemp);
+                name=mzPatientMi.getName();
+                patientIdMap.put(patientIdTemp,name);
+            }
+            map.put("name",name);
+        }
+        return list;
+    }
+
 }

+ 1 - 1
src/main/resources/static/js/charge_list.js

@@ -145,7 +145,7 @@ function initChargeListByPatient() {
             }
         ],
         onClickRow: function (row) {
-            fitfymx(row.patient_id, row.real_no);
+            fitfymx(row.patient_id, row.serial_no);
         },
         responseHandler: function (res) {
             if (res == '401' || res == 401) {