package thyyxxk.webserver.dao.his.medicalinsurance; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import thyyxxk.webserver.entity.dictionary.CodeName; import thyyxxk.webserver.entity.medicalinsurance.digitalreceipt.RxDiseInfo; import thyyxxk.webserver.entity.medicalinsurance.digitalreceipt.RxDrugDetail; import thyyxxk.webserver.entity.medicalinsurance.digitalreceipt.RxMdtrtInfo; import thyyxxk.webserver.entity.medicalinsurance.digitalreceipt.RxPreCheck; import java.util.List; @Mapper public interface DigitalReceiptDao { @Select("select visit_date as prscTime, " + "hospRxno=rtrim(patient_id)+'_'+cast(times as varchar)+'_1' " + "from mz_visit_table where patient_id=#{patientId} and times=#{times}") RxPreCheck selectRxPreCheck(String patientId, int times); @Select("select fixmedinsCode='H43010500370',fixmedinsName='长沙泰和医院', " + "mdtrt_id,med_type,iptOtpNo=pat_no,psn_no,psn_name,psn_cert_type, " + "certno,age as patnAge,gend,dise_code as diseCodg,dise_name, " + "spDiseFlag=case when med_type='14' then '1' else '0' end, " + "prscDeptName=(select d.name from zd_unit_code d where d.code=b.visit_dept_code), " + "prscDeptCode=rtrim(b.visit_dept_code), " + "drCode=(select d.yb_code from a_employee_mi d where d.code=b.doctor_code), " + "prscDrName=(select rtrim(d.name) from a_employee_mi d where d.code=b.doctor_code), " + "drProfttlCodg=(select rtrim(d.emp_tit_code) from a_employee_mi d where d.code=b.doctor_code), " + "drDeptCode=(select rtrim(d.dept_code) from a_employee_mi d where d.code=b.doctor_code), " + "caty=(select d.si_caty from zd_unit_code d where d.code=b.visit_dept_code), " + "mdtrtTime=b.visit_date,maindiagCode=b.icd_code_new,maindiagName=b.icd_text_new " + "from t_si_pat_info a,mz_visit_table b " + "where a.pat_no=#{patientId} and a.times=#{times} and a.ledger_sn=0 " + "and a.pat_no=b.patient_id and a.times=b.times") RxMdtrtInfo selectRxMdtrtInfo(String patientId, int times); @Select("select diag_code as code,diag_name as name from t_si_mz_diag " + "where pat_no=#{patientId} and times=#{times} and diag_srt_no=1") CodeName selectMaindiag(String patientId, int times); @Select("select " + "medListCodg=case when medi_item_type=0 then " + " (select d.national_code from zd_charge_item d where d.code=a.his_item_code) " + "else (select max(d.national_code) from yp_zd_dict d where d.code=a.his_item_code) end, " + "fixmedinsHilistId=a.his_item_code,rxItemTypeCode=med_chrgitm_type,drugGenname=a.his_item_name, " + "drugDosform=case when medi_item_type=0 then '' else " + "(select d.name from yp_zd_dosage d where d.code= " + "(select max(e.dosage) from yp_zd_dict e where e.code=a.his_item_code)) end, " + "drugSpec=case when medi_item_type=0 then '' else " + "(select max(d.specification) from yp_zd_dict d where d.code=a.his_item_code) end, " + "drugDosunt=case when medi_item_type=0 then '' else " + "(select d.name from yp_zd_unit d where d.code= " + "(select max(e.dosage_unit) from yp_zd_dict e where e.code=a.his_item_code)) end, " + "medcWayCodg=case when medi_item_type=0 then '' else 1 end, " + "medcWayDscr=case when medi_item_type=0 then '' else N'口服' end, " + "drugCnt=quantity,medcBegntime=a.fee_date,medcEndtime=a.fee_date+3,medcDays=3, " + "sinDoscnt=1,usedFrquCodg=12,usedFrquName='BID',hospApprFlag='1' " + "from t_mt_receipt a where a.patient_id=#{patientId} and a.times=#{times}") List selectRxDrugDetailList(String patientId, int times); @Select("select " + "diag_type,diag_srt_no,diag_code,diag_name,diag_dept, " + "maindiagFlag=case when diag_srt_no=1 then '1' else '0' end, " + "diagDrNo=(select d.yb_code from a_employee_mi d where d.code=a.dise_dor_no), " + "diagDrName=dise_dor_name,diag_time from t_si_mz_diag a " + "where pat_no=#{patientId} and a.times=#{times} order by diag_srt_no") List selectRxDiseInfo(String patientId, int times); }