SiMzDao.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. package thyyxxk.simzfeeoprnsystm.dao;
  2. import thyyxxk.simzfeeoprnsystm.pojo.*;
  3. import org.apache.ibatis.annotations.*;
  4. import java.util.Date;
  5. import java.util.List;
  6. @Mapper
  7. public interface SiMzDao {
  8. @Select("select zgmztczf from t_clinic where patient_id=#{patientId} and times=#{times} " +
  9. "and receipt_no=#{receiptNo} order by receipt_no limit 1;")
  10. Integer selectZgmztczf(MzVisit mzVisit);
  11. @Select("select count(1) from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
  12. int selectExistCount(String patNo, int times);
  13. @Update("update t_si_pat_info set times=#{times} where pat_no=#{patNo} and times=-1")
  14. int updateMzTimes(String patNo, int times);
  15. @Delete("delete from t_si_pat_info where pat_no=#{patNo} and times=-1")
  16. void deleteTempPatinfo(String patNo, int times);
  17. @Select("select * from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
  18. SiPatInfo selectSiPatInfoForMz(String patNo, int times);
  19. @Update("update t_si_pat_info set mdtrt_id=#{nullCtnt}, setl_id=#{nullCtnt} where pat_no=#{patientId} and times=#{times} ")
  20. void clearMdtrtIdForMz(String patientId, int times, String nullCtnt);
  21. @Select("select mdtrt_id from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
  22. String getMdtrtId(String patNo, int times);
  23. @Select("select a.psn_no, mdtrtCertType='02',b.visit_date as begntime, " +
  24. "a.certno as mdtrtCertNo,a.psn_cert_type,a.certno,a.psn_name, " +
  25. "rtrim(b.visit_dept_code) as deptCode,a.mdtrt_id, " +
  26. "atddrNo=(select rtrim(yb_code) from a_employee_mi where code=b.doctor_code), " +
  27. "drName=(select rtrim(name) from a_employee_mi where code=b.doctor_code), " +
  28. "caty=(select si_caty from zd_unit_code where code=b.visit_dept_code), " +
  29. "deptName=(select z.name from t_yb_dept z where z.code=" +
  30. "(select t.si_caty from zd_unit_code t where t.code=b.visit_dept_code)) " +
  31. "from t_si_pat_info a, mz_visit_table b where a.pat_no=#{patNo} and a.times=#{times} " +
  32. "and a.pat_no=b.patient_id and a.times=b.times")
  33. Regstrtn selectRegstrtn(String patNo, int times);
  34. @Select("select yb_name as ybName from a_employee_mi where code=#{code}")
  35. String getYbName(String code);
  36. @Select("select psn_no, mdtrtCertType='02', " +
  37. "certno as mdtrtCertNo,psn_cert_type,certno,psn_name,mdtrt_id, " +
  38. "atddrNo=(select rtrim(yb_code) from a_employee_mi where code=#{doctorCode}), " +
  39. "drName=(select rtrim(name) from a_employee_mi where code=#{doctorCode}), " +
  40. "caty=(select si_caty from zd_unit_code where code=#{deptCode}), " +
  41. "deptName=(select z.name from t_yb_dept z where z.code= " +
  42. "(select t.si_caty from zd_unit_code t where t.code=#{deptCode})) " +
  43. "from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
  44. Regstrtn selectRegstrtn2(MzPatientInfo params);
  45. @Select("select times from mz_patient_mi where patient_id=#{patientId} ")
  46. Integer selectMaxTimes(String patientId);
  47. @Select("select insuplc_admdvs from t_si_pat_info where " +
  48. "pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
  49. String selectAdmdvs(String patNo, int times, int ledgerSn);
  50. @Update("update t_si_pat_info set insuplc_admdvs=#{insuplcAdmdvs},med_type=#{medType},matn_type=#{matnType}," +
  51. "psn_type=#{psnType},emp_name=#{empName},insuplc_admdvs_name=#{insuplcAdmdvsName}," +
  52. "mdtrt_id=#{mdtrtId},insutype=#{insutype},visit_datetime=#{visitDate},balc=#{balc} " +
  53. "where pat_no=#{patNo} and times=#{times} ")
  54. void afterRegistrtn(MzPatientInfo p);
  55. @Select("select feedetlSn=(t.patient_id + '_' + cast(t.times as varchar) + '_' + cast(t.receipt_no as varchar) + '_' + " +
  56. "cast(t.order_no as varchar) + '_' + cast(t.item_no as varchar)), " +
  57. "t.receipt_no as rxno, t.input_date as feeOcurTime, " +
  58. "medListCodg=isnull((select max(national_code) from yp_zd_dict where code=his_item_code), " +
  59. "(select max(national_code) from zd_charge_item where code=his_item_code)), " +
  60. "t.his_item_code as medinsListCodg, " +
  61. "t.charge_fee as detItemFeeSumamt, " +
  62. "t.quantity as cnt, price as pric, " +
  63. "hospApprFlag=isnull(t.hosp_appr_flag, 0), " +
  64. "bilgDrCodg=(select rtrim(yb_code) from a_employee_mi where code=input_staff), " +
  65. "ordersDrCode=(select rtrim(yb_code) from a_employee_mi where code=input_staff), " +
  66. "ybName=(select rtrim(yb_name) from a_employee_mi where code=input_staff), " +
  67. "t.input_man as bilgDrName, t.input_man as ordersDrName " +
  68. "from t_mt_receipt t " +
  69. "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 " +
  70. "where t.patient_id=#{patNo} and t.times=#{times} and t.yb_trans_flag=0 and m.serial != '01' ")
  71. List<FeeDetail> selectOutpatientFees(String patNo, int times);
  72. @Update("update t_mt_receipt set yb_trans_flag=1,chrgitm_lv=#{chrgLv},med_chrgitm_type=#{chrgType} where " +
  73. "patient_id=#{patNo} and times=#{times} and receipt_no=#{recNo} and order_no=#{odrNo} and item_no=#{itmNo}")
  74. void afterUploadFees(String patNo, int times, int recNo, int odrNo,
  75. int itmNo, String chrgLv, String chrgType);
  76. @Update("update t_mt_receipt set yb_trans_flag=0 where patient_id=#{patNo} and times=#{times}")
  77. void afterRevokeFees(String patNo, int times);
  78. @Select("select psn_no,insuplc_admdvs,mdtrtCertType='02',certno as mdtrtCertNo,certno, " +
  79. "psn_cert_type,psn_type,psn_name,med_type,mdtrt_id,insutype, " +
  80. "medfeeSumamt=(select sum(t.charge_fee) from t_mt_receipt t " +
  81. "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 " +
  82. "where t.patient_id=#{patNo} and t.times=#{times} and m.serial != '01') " +
  83. "from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
  84. MzPreSetlmt selectPreSetlmt(String patNo, int times);
  85. @Select("select diagType='1', " +
  86. "diagSrtNo=1, " +
  87. "rtrim(icd_code) as diagCode, " +
  88. "rtrim(icd_text) as diagName, " +
  89. "rtrim(visit_dept_code) as diagDept, " +
  90. "diseDorNo=(select rtrim(yb_code) from a_employee_mi where code=doctor_code), " +
  91. "diseDorName=(select rtrim(name) from a_employee_mi where code=doctor_code), " +
  92. "ybName=(select rtrim(yb_name) from a_employee_mi where code=doctor_code), " +
  93. "visit_date as diagTime, " +
  94. "valiFlag='1' " +
  95. "from mz_visit_table where patient_id=#{patNo} and times=#{times}")
  96. Diagnoses selectDiseinfo(String patNo, int times);
  97. @Select("select rtrim(yb_code) as code, rtrim(name) as name " +
  98. "from a_employee_mi where code=#{code}")
  99. CodeName getDorCodeAndName(String code);
  100. @Update("update t_si_pat_info set dise_code=#{code},dise_name=#{name} where pat_no=#{patNo} and times=#{times}")
  101. void updatePatDiseinfo(String patNo, int times, String code, String name);
  102. @Update("update t_si_pat_info set fulamt_ownpay_amt=#{fulamtOwnpayAmt}, overlmt_amt=#{overlmtAmt}, " +
  103. "preselfpay_amt=#{preselfpayAmt}, inscp_scp_amt=#{inscpScpAmt} where pat_no=#{patNo} and times=#{times}")
  104. void updateSortOfAmt(SiPatInfo patInfo);
  105. @Select("select top 1 * from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=#{revoked} order by setl_time desc")
  106. SiSetlinfo selectSettledInfo(String patNo, int times, int revoked);
  107. @Select("select psn_no,certno as mdtrtCertNo,mdtrtCertType='02', " +
  108. "psn_cert_type,certno,med_type,insuplc_admdvs, " +
  109. "medfeeSumamt=(select sum(t.charge_fee) from t_mt_receipt t " +
  110. "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 " +
  111. "where t.patient_id=#{patNo} and t.times=#{times} and m.serial != '01') " +
  112. "mdtrt_id,insutype,fulamt_ownpay_amt,overlmt_amt as overlmtSelfpay, " +
  113. "preselfpay_amt,inscp_scp_amt " +
  114. "from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
  115. Setlmt selectSetlmt(String patNo, int times);
  116. @Update("update t_si_setlinfo set revoked=1,mz_saved=0 where pat_no=#{patNo} and times=#{times}")
  117. void deleteSetlInfo(String patNo, int times);
  118. @Update("delete from t_si_setldetail where pat_no=#{patNo} and times=#{times}")
  119. void deleteSetlDetail(String patNo, int times);
  120. @Update("update t_si_pat_info set rvk_setl_msgid=#{rvkSetlMsgid} where pat_no=#{patNo} and times=#{times}")
  121. void updateRvkSetlMsgid(String patNo, int times, String rvkSetlMsgid);
  122. @Select("select a.diag_srt_no,a.diag_type,a.diag_code,a.diag_name,a.diag_dept, " +
  123. "a.dise_dor_name,a.diag_time,a.vali_flag,dise_dor_no=rtrim(b.yb_code) " +
  124. "from t_si_mz_diag a, a_employee_mi b where pat_no=#{patNo} and times=#{times} and a.dise_dor_no=b.code")
  125. List<Diagnoses> selectMzDiags(String patNo, int times);
  126. @Select("select icd_code_new from mz_visit_table where patient_id=#{patNo} and times=#{times}")
  127. String selectIcdCodeNew(String patNo, int times);
  128. @Select("select top 1 rtrim(yb_name) from zd_icd_code_new where yb_code=#{code}")
  129. String selectIcdTextNew(String code);
  130. @Select("select visit_date from mz_visit_table with(nolock) where patient_id=#{patNo} and times=#{times} ")
  131. Date selectBegntime(String patNo, int times);
  132. @Delete("delete from t_mt_receipt where patient_id=#{patNo} and times=#{times}")
  133. void deleteAllReceipts(String patNo, int times);
  134. @Select("select b.si_caty as visitDeptCode,rtrim(c.name) as visitDeptName " +
  135. "from mz_visit_table a, zd_unit_code b, t_yb_dept c where " +
  136. "a.patient_id=#{patNo} and a.times=#{times} and a.visit_dept_code=b.code " +
  137. "and b.si_caty=c.code")
  138. MzVisit selectMzVisitInfo(String patNo, int times);
  139. @Select("select his_item_code from t_mt_receipt where patient_id=#{patNo} and times=#{times}")
  140. List<String> selectHisChargeCodes(String patNo, int times);
  141. @Select("select acct_pay from t_si_presetlinfo where mdtrt_id=#{mdtrtId}")
  142. Double selectAcctPayInPreSettle(String mdtrtId);
  143. @Select("select rtrim(social_no) from mz_patient_mi where patient_id=#{patNo}")
  144. String selectSocialNo(String patNo);
  145. @Select("select insuplc_admdvs_name from t_si_pat_info where mdtrt_id=#{mdtrtId}")
  146. String getInsuplcAdmdvsName(String mdtrtId);
  147. @Select("select count(1) from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=0")
  148. int getSetlCount(String patNo, int times);
  149. @Select("select count(1) from powersi_mip_setlinfo where " +
  150. "med_org_ord=#{id} and ord_state='SETTLED'")
  151. int getMipSettleCount(String id);
  152. @Select("select count(1) from mz_order_lock where his_order_num=#{id} and lock_flag=1 and ybzf=1")
  153. int getLockedCount(String id);
  154. @Select("select count(1) from t_mt_receipt where patient_id=#{patNo} and times=#{times}")
  155. int getUpldfCnt(String patNo, int times);
  156. }