Browse Source

Merge branch 'dev-1.1.4' into 'dev-1.1.4'

接诊人次统计修改

See merge request hurugang/thmz_system!26
huangshuhua 2 years ago
parent
commit
ab9f0097c4

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

@@ -18,6 +18,7 @@ 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.ClinicService;
 import cn.hnthyy.thmz.service.thmz.FileUploadService;
 import cn.hnthyy.thmz.service.thmz.MzmxsrService;
 import cn.hnthyy.thmz.service.thmz.UserService;
@@ -31,6 +32,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.ParseException;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -68,6 +70,8 @@ public class ChargeFeeVoController {
     private ZyZdAuditItemService zyZdAuditItemService;
     @Autowired
     private RegionService regionService;
+    @Autowired
+    private ClinicService clinicService;
     /**
      * 查询日结列表收费清单 未结账
      *
@@ -1369,6 +1373,11 @@ public class ChargeFeeVoController {
                 for (Map<String, Object> map : mzList) {
                     tempMap.put(map.get("doctor_code") + "_" + map.get("charge_date"), map);
                     Employee employee=employeeService.queryByUserCode((String) map.get("doctor_code"));
+                    // 门诊就诊人数
+                    Map<String, Object> rsMap = clinicService.queryMzVisitRs(beginDate, endDate, (String) map.get("doctor_code"), (String) map.get("charge_date"));
+                    map.put("patient_num", rsMap.get("patient_num"));
+                    map.put("avg_fee", (String.valueOf(rsMap.get("patient_num")).equals("0")) ? "" :
+                            BigDecimal.valueOf((Double) map.get("je")).divide(new BigDecimal((Long) rsMap.get("patient_num")), RoundingMode.CEILING));
                     if(employee!=null){
                         map.put("doctor_name",employee.getEmployeeName());
                         map.put("codeRs",employee.getCodeRs());
@@ -1396,6 +1405,11 @@ public class ChargeFeeVoController {
                 }
                 for (Map<String, Object> map : mzList) {
                     Employee employee=employeeService.queryByUserCode((String) map.get("doctor_code"));
+                    // 门诊就诊人数
+                    Map<String, Object> rsMap = clinicService.queryMzVisitRs(beginDate, endDate, (String) map.get("doctor_code"), (String) map.get("charge_date"));
+                    map.put("patient_num", rsMap.get("patient_num"));
+                    map.put("avg_fee", (String.valueOf(rsMap.get("patient_num")).equals("0")) ? "" :
+                            BigDecimal.valueOf((Double) map.get("je")).divide(new BigDecimal((Long) rsMap.get("patient_num")), RoundingMode.CEILING));
                     if(employee!=null){
                         map.put("doctor_name",employee.getEmployeeName());
                         map.put("codeRs",employee.getCodeRs());
@@ -1463,6 +1477,11 @@ public class ChargeFeeVoController {
                 for (Map<String, Object> map : mzList) {
                     tempMap.put((String) map.get("doctor_code"), map);
                     Employee employee=employeeService.queryByUserCode((String) map.get("doctor_code"));
+                    // 门诊就诊人数
+                    Map<String, Object> rsMap = clinicService.queryMzVisitRs(beginDate, endDate, (String) map.get("doctor_code"), null);
+                    map.put("patient_num", rsMap.get("patient_num"));
+                    map.put("avg_fee", (String.valueOf(rsMap.get("patient_num")).equals("0")) ? "" :
+                            BigDecimal.valueOf((Double) map.get("je")).divide(new BigDecimal((Long) rsMap.get("patient_num")), RoundingMode.CEILING));
                     if(employee!=null){
                         map.put("doctor_name",employee.getEmployeeName());
                         map.put("codeRs",employee.getCodeRs());
@@ -1490,6 +1509,11 @@ public class ChargeFeeVoController {
                 }
                 for (Map<String, Object> map : mzList) {
                     Employee employee=employeeService.queryByUserCode((String) map.get("doctor_code"));
+                    // 门诊就诊人数
+                    Map<String, Object> rsMap = clinicService.queryMzVisitRs(beginDate, endDate, (String) map.get("doctor_code"), null);
+                    map.put("patient_num", rsMap.get("patient_num"));
+                    map.put("avg_fee", (String.valueOf(rsMap.get("patient_num")).equals("0")) ? "" :
+                            BigDecimal.valueOf((Double) map.get("je")).divide(new BigDecimal((Long) rsMap.get("patient_num")), RoundingMode.CEILING));
                     if(employee!=null){
                         map.put("doctor_name",employee.getEmployeeName());
                         map.put("codeRs",employee.getCodeRs());

+ 25 - 0
src/main/java/cn/hnthyy/thmz/mapper/thmz/ClinicMapper.java

@@ -292,4 +292,29 @@ public interface ClinicMapper {
      */
     @Select("select dept_code from t_clinic  where patient_id = #{patientId} and doctor_code=#{doctorCode} order by op_day desc limit 1")
     String selectLastByPatientIdAndDoctor(@Param("patientId") String patientId, @Param("doctorCode") String doctorCode);
+
+    /**
+     * @description: 根据医生以及接诊时间查询接诊人次
+     * @author: hsh
+     * @date: 2023/4/24 17:00
+     * @param: [beginDate, endDate, doctorCode, visitDate]
+     * @return: Map<String,Object>
+     **/
+    @Select({"<script>" +
+            " select count(1) as patient_num from t_clinic " +
+            " where clinic_status in (5,6) " +
+            "<when test='beginDate != null'>",
+            " and op_day &gt;= #{beginDate} ",
+            "</when>",
+            "<when test='endDate != null'>",
+            " and op_day &lt;= #{endDate} ",
+            "</when>",
+            "<when test='doctorCode != null'> ",
+            " and doctor_code = #{doctorCode} ",
+            "</when>",
+            "<when test='visitDate != null'> ",
+            " and date_format(op_day,'%Y/%m/%d') = #{visitDate} ",
+            "</when>",
+            "</script>"})
+    Map<String,Object> queryMzVisitRs(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("doctorCode") String doctorCode, @Param("visitDate") String visitDate);
 }

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

@@ -210,4 +210,9 @@ public class ClinicServiceImpl implements ClinicService {
     public String queryLastByPatientIdAndDoctor(String patientId, String doctorCode) {
         return clinicMapper.selectLastByPatientIdAndDoctor(patientId,doctorCode);
     }
+
+    @Override
+    public Map<String, Object> queryMzVisitRs(String beginDate, String endDate, String doctorCode, String visitDate) {
+        return clinicMapper.queryMzVisitRs(beginDate, endDate, doctorCode, visitDate);
+    }
 }

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

@@ -119,4 +119,13 @@ public interface ClinicService {
      * @return
      */
     String queryLastByPatientIdAndDoctor(String patientId, String doctorCode);
+
+    /**
+     * @description: 根据医生以及接诊时间查询接诊人次
+     * @author: hsh
+     * @date: 2023/4/24 17:02
+     * @param: [beginDate, endDate, doctorCode, visitDate]
+     * @return: Map<String,Object>
+     **/
+    Map<String, Object> queryMzVisitRs(String beginDate,String endDate, String doctorCode, String visitDate);
 }