Browse Source

院内统计中添加查看详情

xiaochan 4 years ago
parent
commit
7be235554a

+ 42 - 10
src/main/java/thyyxxk/webserver/dao/his/querydata/QueryDrugsAndProjectsDao.java

@@ -84,17 +84,42 @@ public interface QueryDrugsAndProjectsDao {
 
 
     @Select("select * from (" +
-            "select a.inpatient_no code,a.admiss_times times,rtrim(b.name) name,source='住院',rtrim(c.name) xm_name,charge_date charge_date,a.charge_amount number," +
-            "a.charge_fee amount_of_money,charge_code_mx charge_code " +
-            "from zy_detail_charge a,a_patient_mi b,zd_charge_item c " +
-            "where a.inpatient_no = b.inpatient_no and a.charge_code_mx = c.code and  charge_code_mx = #{chargeCode} and charge_date >= #{startTime} and charge_date  <= #{endTime} " +
+            "SELECT " +
+            "    a.inpatient_no patient,a.admiss_times times,rtrim(b.name) name,b.social_no social_no,b.employer_tel phone,c.admiss_date,c.dis_date,a.charge_date charge_date, " +
+            "    (select name from zd_unit_code where code=c.small_dept) dept, " +
+            "    (select name from zy_zd_responce_type where code=c.responce_type) yb_type, " +
+            "    sum(a.charge_amount) number,sum(a.charge_fee) amount_of_money,charge_code_mx charge_code,source='住院' " +
+            "FROM zy_detail_charge a,a_patient_mi b,zy_inactpatient c " +
+            "where charge_code_mx = #{chargeCode} " +
+            "  and a.inpatient_no=b.inpatient_no " +
+            "  and a.inpatient_no=c.inpatient_no " +
+            "  and a.admiss_times=c.admiss_times " +
+            "  and charge_date >= #{startTime} and charge_date <= #{endTime} " +
+            "group by charge_code_mx,a.inpatient_no,a.admiss_times,b.name,b.social_no,b.employer_tel,c.admiss_date,c.dis_date,c.small_dept,c.responce_type,a.charge_date " +
+            "union all " +
+            "SELECT " +
+            "    a.inpatient_no patient,a.admiss_times times,rtrim(b.name) name ,b.social_no social_no,b.employer_tel phone,c.admiss_date,c.dis_date,a.charge_date, " +
+            "    (select name from zd_unit_code where code=c.small_dept) dept, " +
+            "    (select name from zy_zd_responce_type where code=c.responce_type) yb_type, " +
+            "    sum(a.charge_amount) number,sum(a.charge_fee) amount_of_money,charge_code_mx charge_code,source = '住院' " +
+            "FROM zy_detail_charge a,a_patient_mi b,zy_actpatient c " +
+            "where charge_code_mx = #{chargeCode} " +
+            "  and a.inpatient_no=b.inpatient_no " +
+            "  and a.inpatient_no=c.inpatient_no " +
+            "  and a.admiss_times=c.admiss_times " +
+            "  and charge_date >= #{startTime} and charge_date <= #{endTime} " +
+            "group by charge_code_mx,a.inpatient_no,a.admiss_times,b.name,b.social_no,b.employer_tel,c.admiss_date,c.dis_date,c.small_dept,c.responce_type,a.charge_date " +
             "union all " +
-            "select a.patient_id code,a.times times,rtrim(b.name) name,source='门诊',rtrim(c.name) xm_name,a.charge_date charge_date,a.quantity * a.drug_win number," +
-            "a.quantity*drug_win*unit_price amount_of_money,charge_item_code charge_code " +
-            "from mz_charge_detail a,mz_patient_mi b,zd_charge_item c " +
-            "where a.patient_id = b.patient_id and  a.charge_item_code = c.code and  charge_item_code = #{chargeCode} and  charge_date >= #{startTime}  and charge_date  <= #{endTime}) temp")
-    List<QueryDrugsAndProjects> queryXiangMuShiYongHuanZhe(IPage<QueryDrugsAndProjects> page,
-                                                           @Param("startTime") String startTime,
+            "    select a.patient_id patient,a.times times,rtrim(b.name) name ,b.social_no social_no,b.phone_no phone,a.charge_date admiss_date,dis_date = null,a.charge_date charge_date, " +
+            "    (select name from zd_unit_code where code = a.exec_dept) dept, " +
+            "           yb_type = '自费',sum(a.quantity*a.drug_win) number,sum(a.quantity*drug_win*unit_price) amount_of_money,a.charge_item_code,source = '门诊' " +
+            "           from mz_charge_detail_b a,mz_patient_mi b " +
+            "where a.patient_id = b.patient_id " +
+            "and a.times = b.times " +
+            "and charge_item_code = #{chargeCode} " +
+            "and charge_date >= #{startTime} and charge_date <= #{endTime} " +
+            "group by  charge_item_code,a.patient_id,a.times,b.name,social_no,phone_no,charge_date,exec_dept) temp")
+    List<QueryDrugsAndProjects> queryXiangMuShiYongHuanZhe(@Param("startTime") String startTime,
                                                            @Param("endTime") String endTime,
                                                            @Param("chargeCode") String chargeCode);
 
@@ -171,6 +196,13 @@ public interface QueryDrugsAndProjectsDao {
                                                      @Param("endTime") String endTime,
                                                      @Param("chargeCode") String chargeCode);
 
+    /**
+     * 查询药品或者项目名称
+     *
+     * @param tableName 表名
+     * @param pyCode    拼音码
+     * @return 首字母
+     */
     @Select("select rtrim(code) code,rtrim(name) name from ${tableName} where py_code like #{pyCode}")
     List<GetDropdownBox> chaXunXiangMuhuoYaoPinCode(@Param("tableName") String tableName,
                                                     @Param("pyCode") String pyCode);

+ 35 - 0
src/main/java/thyyxxk/webserver/entity/querydata/QueryDrugsAndProjects.java

@@ -99,4 +99,39 @@ public class QueryDrugsAndProjects {
      */
     private Integer excelFlag;
 
+
+    /**
+     * 身份证号码
+     */
+    private String socialNo;
+
+    /**
+     * 手机号码
+     */
+    private String phone;
+
+    /**
+     * 出院日期
+     */
+    private Date disDate;
+
+    /**
+     * 科室
+     */
+    private String dept;
+
+
+    private String ybType;
+
+    /**
+     * 住院号或者门诊号
+     */
+    private String patient;
+
+    /**
+     * 入院日期
+     */
+    private Date admissDate;
+
+
 }

+ 2 - 3
src/main/java/thyyxxk/webserver/service/querydata/QueryDrugsAndProjectsService.java

@@ -73,9 +73,8 @@ public class QueryDrugsAndProjectsService {
      * @return 返回分页 对象
      */
     public ResultVo<List<QueryDrugsAndProjects>> chaKanXiangQing(QueryDrugsAndProjects param) {
-        IPage<QueryDrugsAndProjects> page = new Page<>(1, 50);
         log.info("查看项目详情:{}", JSON.toJSONStringWithDateFormat(param, GetDateFormat.DATE_TIME));
-        return ResultVoUtil.successTable(dao.queryXiangMuShiYongHuanZhe(page, param.getStartTime(), param.getEndTime(), param.getChargeCode()), page.getTotal());
+        return ResultVoUtil.success(dao.queryXiangMuShiYongHuanZhe(param.getStartTime(), param.getEndTime(), param.getChargeCode()));
     }
 
     /**
@@ -88,7 +87,7 @@ public class QueryDrugsAndProjectsService {
         IPage<QueryDrugsAndProjects> page = new Page<>(1, -1);
         List<QueryDrugsAndProjects> list;
         if (param.getExcelFlag() == 1) {
-            list = dao.queryXiangMuShiYongHuanZhe(page, param.getStartTime(), param.getEndTime(), param.getChargeCode());
+            list = dao.queryXiangMuShiYongHuanZhe(param.getStartTime(), param.getEndTime(), param.getChargeCode());
         } else {
             list = dao.chaKanYaoPinShiYong(page, param.getStartTime(), param.getEndTime(), param.getChargeCode()).getRecords();
         }