package thyyxxk.simzfeeoprnsystm.dao; import thyyxxk.simzfeeoprnsystm.pojo.*; import org.apache.ibatis.annotations.*; import java.util.Date; import java.util.List; @Mapper public interface SiMzDao { @Select("select zgmztczf from t_clinic where patient_id=#{patientId} and times=#{times} " + "and receipt_no=#{receiptNo} order by receipt_no limit 1;") Integer selectZgmztczf(MzVisit mzVisit); @Select("select count(1) from t_si_pat_info where pat_no=#{patNo} and times=#{times}") int selectExistCount(String patNo, int times); @Update("update t_si_pat_info set times=#{times} where pat_no=#{patNo} and times=-1") int updateMzTimes(String patNo, int times); @Delete("delete from t_si_pat_info where pat_no=#{patNo} and times=-1") void deleteTempPatinfo(String patNo, int times); @Select("select * from t_si_pat_info where pat_no=#{patNo} and times=#{times}") SiPatInfo selectSiPatInfoForMz(String patNo, int times); @Update("update t_si_pat_info set mdtrt_id=#{nullCtnt}, setl_id=#{nullCtnt} where pat_no=#{patientId} and times=#{times} ") void clearMdtrtIdForMz(String patientId, int times, String nullCtnt); @Select("select mdtrt_id from t_si_pat_info where pat_no=#{patNo} and times=#{times}") String getMdtrtId(String patNo, int times); @Select("select a.psn_no, mdtrtCertType='02',b.visit_date as begntime, " + "a.certno as mdtrtCertNo,a.psn_cert_type,a.certno,a.psn_name, " + "rtrim(b.visit_dept_code) as deptCode,a.mdtrt_id, " + "atddrNo=(select rtrim(yb_code) from a_employee_mi where code=b.doctor_code), " + "drName=(select rtrim(name) from a_employee_mi where code=b.doctor_code), " + "caty=(select si_caty from zd_unit_code where code=b.visit_dept_code), " + "deptName=(select z.name from t_yb_dept z where z.code=" + "(select t.si_caty from zd_unit_code t where t.code=b.visit_dept_code)) " + "from t_si_pat_info a, mz_visit_table b where a.pat_no=#{patNo} and a.times=#{times} " + "and a.pat_no=b.patient_id and a.times=b.times") Regstrtn selectRegstrtn(String patNo, int times); @Select("select yb_name as ybName from a_employee_mi where code=#{code}") String getYbName(String code); @Select("select psn_no, mdtrtCertType='02', " + "certno as mdtrtCertNo,psn_cert_type,certno,psn_name,mdtrt_id, " + "atddrNo=(select rtrim(yb_code) from a_employee_mi where code=#{doctorCode}), " + "drName=(select rtrim(name) from a_employee_mi where code=#{doctorCode}), " + "caty=(select si_caty from zd_unit_code where code=#{deptCode}), " + "deptName=(select z.name from t_yb_dept z where z.code= " + "(select t.si_caty from zd_unit_code t where t.code=#{deptCode})) " + "from t_si_pat_info where pat_no=#{patNo} and times=#{times}") Regstrtn selectRegstrtn2(MzPatientInfo params); @Select("select times from mz_patient_mi where patient_id=#{patientId} ") Integer selectMaxTimes(String patientId); @Select("select insuplc_admdvs from t_si_pat_info where " + "pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}") String selectAdmdvs(String patNo, int times, int ledgerSn); @Update("update t_si_pat_info set insuplc_admdvs=#{insuplcAdmdvs},med_type=#{medType},matn_type=#{matnType}," + "psn_type=#{psnType},emp_name=#{empName},insuplc_admdvs_name=#{insuplcAdmdvsName}," + "mdtrt_id=#{mdtrtId},insutype=#{insutype},visit_datetime=#{visitDate},balc=#{balc} " + "where pat_no=#{patNo} and times=#{times} ") void afterRegistrtn(MzPatientInfo p); @Select("select feedetlSn=(t.patient_id + '_' + cast(t.times as varchar) + '_' + cast(t.receipt_no as varchar) + '_' + " + "cast(t.order_no as varchar) + '_' + cast(t.item_no as varchar)), " + "t.receipt_no as rxno, t.input_date as feeOcurTime, " + "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=his_item_code), " + "(select max(national_code) from zd_charge_item where code=his_item_code)), " + "t.his_item_code as medinsListCodg, " + "t.charge_fee as detItemFeeSumamt, " + "t.quantity as cnt, price as pric, " + "hospApprFlag=isnull(t.hosp_appr_flag, 0), " + "bilgDrCodg=(select rtrim(yb_code) from a_employee_mi where code=input_staff), " + "ordersDrCode=(select rtrim(yb_code) from a_employee_mi where code=input_staff), " + "ybName=(select rtrim(yb_name) from a_employee_mi where code=input_staff), " + "t.input_man as bilgDrName, t.input_man as ordersDrName " + "from t_mt_receipt t " + "left join mz_charge_detail m on m.patient_id=t.patient_id and m.times=t.times and m.charge_item_code=t.his_item_code " + "where t.patient_id=#{patNo} and t.times=#{times} and t.yb_trans_flag=0 and m.serial != '01' ") List selectOutpatientFees(String patNo, int times); @Update("update t_mt_receipt set yb_trans_flag=1,chrgitm_lv=#{chrgLv},med_chrgitm_type=#{chrgType} where " + "patient_id=#{patNo} and times=#{times} and receipt_no=#{recNo} and order_no=#{odrNo} and item_no=#{itmNo}") void afterUploadFees(String patNo, int times, int recNo, int odrNo, int itmNo, String chrgLv, String chrgType); @Update("update t_mt_receipt set yb_trans_flag=0 where patient_id=#{patNo} and times=#{times}") void afterRevokeFees(String patNo, int times); @Select("select psn_no,insuplc_admdvs,mdtrtCertType='02',certno as mdtrtCertNo,certno, " + "psn_cert_type,psn_type,psn_name,med_type,mdtrt_id,insutype, " + "medfeeSumamt=(select sum(t.charge_fee) from t_mt_receipt t " + "left join mz_charge_detail m on m.patient_id=t.patient_id and m.times=t.times and m.charge_item_code=t.his_item_code " + "where t.patient_id=#{patNo} and t.times=#{times} and m.serial != '01') " + "from t_si_pat_info where pat_no=#{patNo} and times=#{times}") MzPreSetlmt selectPreSetlmt(String patNo, int times); @Select("select diagType='1', " + "diagSrtNo=1, " + "rtrim(icd_code) as diagCode, " + "rtrim(icd_text) as diagName, " + "rtrim(visit_dept_code) as diagDept, " + "diseDorNo=(select rtrim(yb_code) from a_employee_mi where code=doctor_code), " + "diseDorName=(select rtrim(name) from a_employee_mi where code=doctor_code), " + "ybName=(select rtrim(yb_name) from a_employee_mi where code=doctor_code), " + "visit_date as diagTime, " + "valiFlag='1' " + "from mz_visit_table where patient_id=#{patNo} and times=#{times}") Diagnoses selectDiseinfo(String patNo, int times); @Select("select rtrim(yb_code) as code, rtrim(name) as name " + "from a_employee_mi where code=#{code}") CodeName getDorCodeAndName(String code); @Update("update t_si_pat_info set dise_code=#{code},dise_name=#{name} where pat_no=#{patNo} and times=#{times}") void updatePatDiseinfo(String patNo, int times, String code, String name); @Update("update t_si_pat_info set fulamt_ownpay_amt=#{fulamtOwnpayAmt}, overlmt_amt=#{overlmtAmt}, " + "preselfpay_amt=#{preselfpayAmt}, inscp_scp_amt=#{inscpScpAmt} where pat_no=#{patNo} and times=#{times}") void updateSortOfAmt(SiPatInfo patInfo); @Select("select top 1 * from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=#{revoked} order by setl_time desc") SiSetlinfo selectSettledInfo(String patNo, int times, int revoked); @Select("select psn_no,certno as mdtrtCertNo,mdtrtCertType='02', " + "psn_cert_type,certno,med_type,insuplc_admdvs, " + "medfeeSumamt=(select sum(t.charge_fee) from t_mt_receipt t " + "left join mz_charge_detail m on m.patient_id=t.patient_id and m.times=t.times and m.charge_item_code=t.his_item_code " + "where t.patient_id=#{patNo} and t.times=#{times} and m.serial != '01') " + "mdtrt_id,insutype,fulamt_ownpay_amt,overlmt_amt as overlmtSelfpay, " + "preselfpay_amt,inscp_scp_amt " + "from t_si_pat_info where pat_no=#{patNo} and times=#{times}") Setlmt selectSetlmt(String patNo, int times); @Update("update t_si_setlinfo set revoked=1,mz_saved=0 where pat_no=#{patNo} and times=#{times}") void deleteSetlInfo(String patNo, int times); @Update("delete from t_si_setldetail where pat_no=#{patNo} and times=#{times}") void deleteSetlDetail(String patNo, int times); @Update("update t_si_pat_info set rvk_setl_msgid=#{rvkSetlMsgid} where pat_no=#{patNo} and times=#{times}") void updateRvkSetlMsgid(String patNo, int times, String rvkSetlMsgid); @Select("select a.diag_srt_no,a.diag_type,a.diag_code,a.diag_name,a.diag_dept, " + "a.dise_dor_name,a.diag_time,a.vali_flag,dise_dor_no=rtrim(b.yb_code) " + "from t_si_mz_diag a, a_employee_mi b where pat_no=#{patNo} and times=#{times} and a.dise_dor_no=b.code") List selectMzDiags(String patNo, int times); @Select("select icd_code_new from mz_visit_table where patient_id=#{patNo} and times=#{times}") String selectIcdCodeNew(String patNo, int times); @Select("select top 1 rtrim(yb_name) from zd_icd_code_new where yb_code=#{code}") String selectIcdTextNew(String code); @Select("select visit_date from mz_visit_table with(nolock) where patient_id=#{patNo} and times=#{times} ") Date selectBegntime(String patNo, int times); @Delete("delete from t_mt_receipt where patient_id=#{patNo} and times=#{times}") void deleteAllReceipts(String patNo, int times); @Select("select b.si_caty as visitDeptCode,rtrim(c.name) as visitDeptName " + "from mz_visit_table a, zd_unit_code b, t_yb_dept c where " + "a.patient_id=#{patNo} and a.times=#{times} and a.visit_dept_code=b.code " + "and b.si_caty=c.code") MzVisit selectMzVisitInfo(String patNo, int times); @Select("select his_item_code from t_mt_receipt where patient_id=#{patNo} and times=#{times}") List selectHisChargeCodes(String patNo, int times); @Select("select acct_pay from t_si_presetlinfo where mdtrt_id=#{mdtrtId}") Double selectAcctPayInPreSettle(String mdtrtId); @Select("select rtrim(social_no) from mz_patient_mi where patient_id=#{patNo}") String selectSocialNo(String patNo); @Select("select insuplc_admdvs_name from t_si_pat_info where mdtrt_id=#{mdtrtId}") String getInsuplcAdmdvsName(String mdtrtId); @Select("select count(1) from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=0") int getSetlCount(String patNo, int times); @Select("select count(1) from powersi_mip_setlinfo where " + "med_org_ord=#{id} and ord_state='SETTLED'") int getMipSettleCount(String id); @Select("select count(1) from mz_order_lock where his_order_num=#{id} and lock_flag=1 and ybzf=1") int getLockedCount(String id); @Select("select count(1) from t_mt_receipt where patient_id=#{patNo} and times=#{times}") int getUpldfCnt(String patNo, int times); }