SiMzDao.java 11 KB

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