浏览代码

医生绩效核算报表数据校验

hurugang 3 年之前
父节点
当前提交
594f0bfd98

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

@@ -6,6 +6,7 @@ import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.mz.*;
 import cn.hnthyy.thmz.entity.his.zd.ZdChequeType;
+import cn.hnthyy.thmz.entity.his.zy.ZyZdAuditItem;
 import cn.hnthyy.thmz.entity.thmz.FileUpload;
 import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
 import cn.hnthyy.thmz.entity.thmz.User;
@@ -15,6 +16,7 @@ import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.his.mz.*;
 import cn.hnthyy.thmz.service.his.zd.ZdChequeTypeService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
+import cn.hnthyy.thmz.service.his.zy.ZyZdAuditItemService;
 import cn.hnthyy.thmz.service.thmz.FileUploadService;
 import cn.hnthyy.thmz.service.thmz.MzmxsrService;
 import cn.hnthyy.thmz.service.thmz.UserService;
@@ -61,6 +63,8 @@ public class ChargeFeeVoController {
     private MzZyReqService mzZyReqService;
     @Autowired
     private MzZdCommonService mzZdCommonService;
+    @Autowired
+    private ZyZdAuditItemService zyZdAuditItemService;
 
     /**
      * 查询日结列表收费清单 未结账
@@ -1642,6 +1646,14 @@ public class ChargeFeeVoController {
                         tempAmount = BigDecimal.valueOf(sl);
                     }
                     String auditCode=(String) map.get("audit_code");
+                    ZyZdAuditItem zyZdAuditItem=zyZdAuditItemService.queryByCode(auditCode);
+                    if(zyZdAuditItem!=null){
+                        BillItem billItem= mzBillItemService.queryZyBillItemByCode(zyZdAuditItem.getParentCode());
+                        auditCode=billItem==null?"":billItem.getName();
+                    }else {
+                        BillItem billItem= mzBillItemService.queryMzBillItemByCode(auditCode);
+                        auditCode=billItem==null?"":billItem.getName();
+                    }
                     temp.put(auditCode,tempAmount);
                     BigDecimal totalAmount = (BigDecimal)temp.get("合计");
                     totalAmount=totalAmount.add(tempAmount==null?BigDecimal.ONE:tempAmount);

+ 9 - 18
src/main/java/cn/hnthyy/thmz/mapper/his/mz/ChargeFeeVoMapper.java

@@ -1106,36 +1106,27 @@ public interface ChargeFeeVoMapper {
     @Select({"<script>" +
             "select  xm=count(distinct a.patient_id)," +
             "  sl = sum(a.quantity * a.unit_price*isnull(a.drug_win,1)), " +
-            "        audit_code=d.name," +
+            "       audit_code = isnull(b.audit_code,a.charge_bill_code)," +
             "        warn_dept=e.name," +
             "        doctor_id=rtrim(a.doctor_code) " +
-            "   from mz_charge_detail a WITH(NOLOCK),zd_charge_item b WITH(NOLOCK),zy_zd_audit_item c WITH(NOLOCK),zy_zd_audit_report d WITH(NOLOCK),zd_unit_code e WITH(NOLOCK)," +
-            "        (select distinct patient_id,times,receipt_no, serial_no,receipt_sn from mz_receipt_serial WITH(NOLOCK) " +
-            "          where 1=1 " +
+            "   from mz_charge_detail a WITH(NOLOCK),zd_charge_item b WITH(NOLOCK),zd_unit_code e WITH(NOLOCK) " +
+                    "  where  " +
             "<when test='beginDate!=null'>",
-            " and charge_date &gt;=#{beginDate} ",
+            "  a.charge_date &gt;=#{beginDate} ",
             "</when>",
             "<when test='endDate!=null'>",
-            " and charge_date &lt;=#{endDate} ",
+            " and a.charge_date &lt;=#{endDate} ",
             "</when>",
-            "   ) as f " +
-                    "  where  a.unit_price <![CDATA[<>]]> 0 " +
+            " and a.unit_price <![CDATA[<>]]> 0 " +
                     "<when test='doctorCode!=null'>",
             " and a.doctor_code =#{doctorCode} ",
             "</when>",
             "<when test='warnDept!=null'>",
             " and a.warn_dept =#{warnDept} ",
             "</when>" +
-                    "    and case a.charge_bill_code when 'BILL10' then 'BILL01' when 'BILL11' then 'BILL28' when 'BILL12' then 'BILL02' else a.charge_bill_code end*=b.code  " +
-                    "    and isnull(b.audit_code,c.code)=c.code " +
-                    "    and c.parent_code=d.code " +
-                    "    and (case when isnull(a.warn_dept,'')='' then  a.exec_dept else a.warn_dept end)*=e.code and " +
-                    "        a.patient_id = f.patient_id     and   " +
-                    "        a.times=f.times and " +
-                    "        a.receipt_no=f.receipt_no and " +
-                    "        a.serial_no=f.serial_no and  " +
-                    "        a.real_no=f.receipt_sn    " +
-                    "group by a.doctor_code,d.name,e.name " +
+                    "    and a.charge_bill_code *=b.code  " +
+                    "    and (case when isnull(a.warn_dept,'')='' then  a.exec_dept else a.warn_dept end)*=e.code  " +
+                    "group by a.doctor_code,isnull(b.audit_code,a.charge_bill_code),e.name " +
                     "</script>"})
     List<Map<String, Object>> selectDoctorPerformanceStatistics(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("doctorCode") String doctorCode, @Param("warnDept") String warnDept);
 

+ 6 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzBillItemMapper.java

@@ -21,6 +21,12 @@ public interface MzBillItemMapper {
     @Select("SELECT code,name FROM zy_zd_audit_report WITH(NOLOCK) ")
     List<BillItem> selectZyBillItem();
 
+    /**
+     * 按照編碼住院收费父类码
+     * @return
+     */
+    @Select("SELECT code,name FROM zy_zd_audit_report WITH(NOLOCK) where code=#{code}")
+    BillItem selectZyBillItemByCode(@Param("code") String code);
 
     /**
      * 住院收费发票码 原本的

+ 8 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zy/ZyZdAuditItemMapper.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.mapper.his.zy;
 
 import cn.hnthyy.thmz.entity.his.zy.ZyZdAuditItem;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
@@ -10,4 +11,11 @@ public interface ZyZdAuditItemMapper {
     @Select("select rtrim(code) code,rtrim(name) name,rtrim(py_code) py_code,rtrim(d_code) wb_code,rtrim(parent_code) parent_code,rtrim(del_flag) del_flag from zy_zd_audit_item order by code ")
     List<ZyZdAuditItem> selectAll();
 
+    /**
+     * 按照编码查询住院核算码
+     * @param code
+     * @return
+     */
+    @Select("select rtrim(code) code,rtrim(name) name,rtrim(py_code) py_code,rtrim(d_code) wb_code,rtrim(parent_code) parent_code,rtrim(del_flag) del_flag from zy_zd_audit_item where code =#{code}")
+    ZyZdAuditItem selectByCode(@Param("code") String code);
 }

+ 5 - 1
src/main/java/cn/hnthyy/thmz/service/his/mz/MzBillItemService.java

@@ -16,7 +16,11 @@ public interface MzBillItemService {
      * @return
      */
     List<BillItem> queryZyBillItem();
-
+    /**
+     * 按照編碼住院收费父类码
+     * @return
+     */
+    BillItem queryZyBillItemByCode(String code);
 
     /**
      * 住院收费发票码 原本的

+ 6 - 1
src/main/java/cn/hnthyy/thmz/service/his/zy/ZyZdAuditItemService.java

@@ -7,5 +7,10 @@ import java.util.List;
 public interface ZyZdAuditItemService {
 
     List<ZyZdAuditItem> querytAll();
-
+    /**
+     * 按照编码查询住院核算码
+     * @param code
+     * @return
+     */
+    ZyZdAuditItem queryByCode(String code);
 }

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzBillItemServiceImpl.java

@@ -3,6 +3,7 @@ package cn.hnthyy.thmz.service.impl.his.mz;
 import cn.hnthyy.thmz.entity.his.mz.BillItem;
 import cn.hnthyy.thmz.mapper.his.mz.MzBillItemMapper;
 import cn.hnthyy.thmz.service.his.mz.MzBillItemService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -22,6 +23,14 @@ public class MzBillItemServiceImpl implements MzBillItemService {
         return mzBillItemMapper.selectZyBillItem();
     }
 
+    @Override
+    public BillItem queryZyBillItemByCode(String code) {
+        if(StringUtils.isBlank(code)){
+            return null;
+        }
+        return mzBillItemMapper.selectZyBillItemByCode(code);
+    }
+
     @Override
     public List<BillItem> queryZyBillItemOri() {
         return mzBillItemMapper.selectZyBillItemOri();

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/zy/ZyZdAuditItemServiceImpl.java

@@ -3,6 +3,7 @@ package cn.hnthyy.thmz.service.impl.his.zy;
 import cn.hnthyy.thmz.entity.his.zy.ZyZdAuditItem;
 import cn.hnthyy.thmz.mapper.his.zy.ZyZdAuditItemMapper;
 import cn.hnthyy.thmz.service.his.zy.ZyZdAuditItemService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -16,4 +17,12 @@ public class ZyZdAuditItemServiceImpl implements ZyZdAuditItemService {
     public List<ZyZdAuditItem> querytAll() {
         return zyZdAuditItemMapper.selectAll();
     }
+
+    @Override
+    public ZyZdAuditItem queryByCode(String code) {
+        if(StringUtils.isBlank(code)){
+            return null;
+        }
+        return zyZdAuditItemMapper.selectByCode(code);
+    }
 }