|
@@ -90,9 +90,11 @@ public interface QueryDrugsAndProjectsDao {
|
|
|
* @return 返回查询的数据
|
|
|
*/
|
|
|
@Select("<script>" +
|
|
|
- "select * from (" +
|
|
|
+ "select patient, times, name, social_no, phone, admiss_date, dis_date,CONVERT(varchar(100), charge_date, 23) charge_date_string, dept,exec_unit,yb_type, " +
|
|
|
+ " SUM(amount_of_money) amount_of_money,SUM(number) number,charge_code, source from (" +
|
|
|
"SELECT " +
|
|
|
- " rtrim(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, " +
|
|
|
+ " rtrim(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," +
|
|
|
+ "CONVERT(varchar(100), a.charge_date, 23) charge_date, " +
|
|
|
" (select name from zd_unit_code where code=c.small_dept) dept, " +
|
|
|
"(select name from zd_unit_code where code= a.exec_unit) exec_unit, " +
|
|
|
" (select name from zy_zd_responce_type where code=c.responce_type) yb_type, " +
|
|
@@ -109,7 +111,8 @@ public interface QueryDrugsAndProjectsDao {
|
|
|
"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,a.exec_unit,c.responce_type,a.charge_date " +
|
|
|
"union all " +
|
|
|
"SELECT " +
|
|
|
- " rtrim(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, " +
|
|
|
+ " rtrim(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," +
|
|
|
+ "CONVERT(varchar(100), a.charge_date, 23) charge_date," +
|
|
|
" (select name from zd_unit_code where code=c.small_dept) dept, " +
|
|
|
"(select name from zd_unit_code where code= a.exec_unit) exec_unit, " +
|
|
|
" (select name from zy_zd_responce_type where code=c.responce_type) yb_type, " +
|
|
@@ -126,7 +129,7 @@ public interface QueryDrugsAndProjectsDao {
|
|
|
"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,a.exec_unit,c.responce_type,a.charge_date " +
|
|
|
"union all " +
|
|
|
" select rtrim(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, " +
|
|
|
+ "a.charge_date admiss_date,dis_date = null,CONVERT(varchar(100), a.charge_date, 23) charge_date, " +
|
|
|
" (select name from zd_unit_code where code = a.warn_dept) dept, " +
|
|
|
" (select name from zd_unit_code where code = a.exec_dept) exec_unit, " +
|
|
|
" yb_type = '自费',sum(a.quantity*a.drug_win) number,sum(a.quantity*drug_win*unit_price) amount_of_money,a.charge_item_code,source = '门诊' " +
|
|
@@ -138,8 +141,10 @@ public interface QueryDrugsAndProjectsDao {
|
|
|
"<if test=\"dept != '' and dept !=null \">" +
|
|
|
"and a.exec_dept = #{dept} " +
|
|
|
"</if>" +
|
|
|
- "group by charge_item_code,a.patient_id,a.times,b.name,social_no,phone_no,charge_date,exec_dept,a.warn_dept) temp" +
|
|
|
+ "group by charge_item_code,a.patient_id,a.times,b.name,social_no,phone_no,charge_date,exec_dept,a.warn_dept) temp GROUP BY " +
|
|
|
+ "patient,times,name,social_no,phone,admiss_date,dis_date,charge_date,dept,exec_unit,yb_type,amount_of_money,number,charge_code,source" +
|
|
|
"</script>")
|
|
|
+ // 如果不希望显示 0 的话 就去掉 amount_of_money 和 number
|
|
|
List<QueryDrugsAndProjects> chaXunXiangMuHuoYaoPinJuTiXinXi(@Param("startTime") String startTime,
|
|
|
@Param("endTime") String endTime,
|
|
|
@Param("chargeCode") String chargeCode,
|