|
@@ -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);
|