|
|
@@ -0,0 +1,65 @@
|
|
|
+package thyyxxk.webserver.dao.his.zhuyuanyiji;
|
|
|
+
|
|
|
+import org.apache.ibatis.annotations.*;
|
|
|
+import thyyxxk.webserver.entity.medicaltechnology.FetchMedicines;
|
|
|
+import thyyxxk.webserver.entity.medicaltechnology.MedicinePage;
|
|
|
+import thyyxxk.webserver.entity.medicaltechnology.PoisonousAnesthetics;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Mapper
|
|
|
+public interface MedicineManagementDao {
|
|
|
+ @Select("select b.code as chargeCode,sum(a.amount) as amount,sum(a.charge_fee) as chargeFee, " +
|
|
|
+ "max(b.pack_retprice) as price,max(a.exec_unit) as execUnit,b.serial as serialNo, " +
|
|
|
+ "max(a.group_no) as groupNo,max(a.page_no) as pageNo,max(b.name) as drugName, " +
|
|
|
+ "max(b.specification) as spec,max(a.confirm_flag) as confirmFlag,max(b.drug_flag) as drugFlag " +
|
|
|
+ "from zy_drug a with(nolock),yp_zd_dict b with(nolock) " +
|
|
|
+ "where isnull(a.page_no,0)=0 and charge_date>=#{start} and charge_date<=#{end} " +
|
|
|
+ "and isnull(confirm_flag,'0')='0' and a.group_no='73' and a.exec_unit=#{dept} and a.charge_code=b.code " +
|
|
|
+ "and isnull(a.serial,'01')=b.serial group by b.code,b.serial having sum(a.amount)!=0")
|
|
|
+ List<MedicinePage> selectMedicinePages(FetchMedicines params);
|
|
|
+
|
|
|
+ @Select("select b.code as chargeCode,rtrim(c.name) as patName,rtrim(c.inpatient_no) as patNo,sum(a.amount) as amount, " +
|
|
|
+ "sum(a.charge_fee) as chargeFee,max(b.pack_retprice) as price,max(a.exec_unit) as execUnit,a.charge_date, " +
|
|
|
+ "b.serial as serialNo,max(a.group_no) as groupNo,max(a.page_no) as pageNo,max(b.name) as drugName, " +
|
|
|
+ "max(b.specification) as spec,max(a.confirm_flag) as confirmFlag,max(b.drug_flag) as drugFlag " +
|
|
|
+ "from zy_drug a with(nolock),yp_zd_dict b with(nolock),zy_actpatient c with(nolock) " +
|
|
|
+ "where charge_date>=#{start} and charge_date<=#{end} and a.group_no='73' and a.exec_unit=#{dept} " +
|
|
|
+ "and a.charge_code=b.code and a.inpatient_no=c.inpatient_no and isnull(a.serial,'01')=b.serial " +
|
|
|
+ "group by b.code,b.serial,c.inpatient_no,c.name,a.charge_date having sum(a.amount)!=0")
|
|
|
+ List<MedicinePage> selectUsedMedicines(FetchMedicines params);
|
|
|
+
|
|
|
+ @Delete("delete yz_yp_page_no where page_no=#{pageNo}")
|
|
|
+ void deleteExistTargetPageNo(int pageNo);
|
|
|
+
|
|
|
+ @Insert("insert into yz_yp_page_no (page_no,dept_code,ward_code,submit_time,submit_name,page_class,page_name," +
|
|
|
+ "start_date,end_date,group_no,submit_flag) values (#{pageNo},#{dept},#{dept},getdate(),'00000','A'," +
|
|
|
+ "'医技科室药品单',#{start},#{end},'73','1' )")
|
|
|
+ void insertNewPageNo(FetchMedicines params);
|
|
|
+
|
|
|
+ @Update("update zy_drug set page_no=#{pageNo},sub_date=getdate() where charge_date>=#{start} " +
|
|
|
+ "and charge_date<=#{end} and isnull(page_no,0)=0 and exec_unit=#{dept} " +
|
|
|
+ "and zy_drug.charge_code in (${chargeCodes}) and isnull(zy_drug.serial,'01')='01'")
|
|
|
+ void submitMedicinePages(FetchMedicines params);
|
|
|
+
|
|
|
+ @Select("select convert(varchar(5),a.charge_date,10) as chargeDate,b.name as chargeName,c.name as deptName,rtrim(d.name) as patName, " +
|
|
|
+ "patGender=case when isnull(d.sex,'')='' then '' when d.sex='1'then '男'else '女'end, " +
|
|
|
+ "d.social_no,rtrim(a.inpatient_no) as patNo,rtrim(e.admiss_diag_str) as admdiag, " +
|
|
|
+ "b.specification2 as spec,a.charge_amount as chargeAmount,a.charge_fee as chargeFee,rtrim(a.charge_code_mx) as chargeCode " +
|
|
|
+ "from zy_detail_charge a left join a_patient_mi d on a.inpatient_no=d.inpatient_no " +
|
|
|
+ "left join zy_actpatient e on a.inpatient_no=e.inpatient_no,zd_unit_code c, " +
|
|
|
+ "(select name,specification2,code,drug_flag from yp_zd_dict where drug_flag>0 group by code,name,specification2,drug_flag) b " +
|
|
|
+ "where a.charge_date>=#{start} and a.charge_date<=#{end} and a.exec_unit=#{dept} and " +
|
|
|
+ "a.charge_code_mx=b.code and a.exec_unit=c.code " +
|
|
|
+ "union all " +
|
|
|
+ "select convert(varchar(5),a.charge_date,10) as chargeDate,b.name as chargeName,'麻醉科' as deptName,rtrim(d.name) as patName, " +
|
|
|
+ "patGender=case when isnull(d.sex,'')='' then '' when d.sex='1'then '男'else '女'end, " +
|
|
|
+ "d.social_no,rtrim(a.patient_id) as patNo,admdiag='', " +
|
|
|
+ "b.specification2 as spec,a.quantity as chargeAmount,a.unit_price*quantity as chargeFee, " +
|
|
|
+ "rtrim(a.charge_item_code) as chargeCode " +
|
|
|
+ "from mz_charge_detail_b a left join mz_patient_mi d on a.patient_id=d.patient_id, " +
|
|
|
+ "(select name,specification2,code,drug_flag from yp_zd_dict where drug_flag>0 group by code,name,specification2,drug_flag) b " +
|
|
|
+ "where a.charge_date>=#{start} and a.charge_date<=#{end} and a.warn_dept!='1070000' and a.charge_item_code=b.code")
|
|
|
+ List<PoisonousAnesthetics> selectPoisonousAnesthetics(FetchMedicines params);
|
|
|
+}
|
|
|
+
|