DismissDao.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. package thyyxxk.webserver.dao.his.inpatient;
  2. import org.apache.ibatis.annotations.*;
  3. import thyyxxk.webserver.entity.dictionary.PureCodeName;
  4. import thyyxxk.webserver.entity.inpatient.dismiss.*;
  5. import java.math.BigDecimal;
  6. import java.util.Date;
  7. import java.util.List;
  8. import java.util.Map;
  9. @Mapper
  10. public interface DismissDao {
  11. @Select("select top 1 ltrim(rtrim(name)) from a_employee_mi where code=#{code}")
  12. String getOperateName(@Param("code") String code);
  13. @Select("select isnull(max ( ledger_sn ), isnull(min ( ledger_sn ), 1)) from zy_ledger_file where " +
  14. "inpatient_no=#{patNo} and admiss_times=#{times}")
  15. Integer getLedgerSn(@Param("patNo") String patNo, @Param("times") Integer times);
  16. @Update("exec zy_receive_drug @in_no=#{patNo},@times=#{times},@v_no=#{patNo}, @is_infant=0")
  17. void acceptFeeStepOne(@Param("patNo") String patNo, @Param("times") Integer times);
  18. @Update("exec zy_receive_one @in_no=#{patNo},@times=#{times},@v_no=#{patNo}, @is_infant=0")
  19. int acceptFeeStepTwo(@Param("patNo") String patNo, @Param("times") Integer times);
  20. @Update("exec dbo.zy_cngl_fyjs_list_yz_1 @in_no=#{patNo}, @in_times=#{times}")
  21. int getOrderList(@Param("patNo") String patNo, @Param("times") Integer times);
  22. @Select("select ltrim(rtrim(str(act_order_no))) as actOrderNo,rtrim(order_name) as orderName," +
  23. "charge_date as chargeDate, rtrim(charge_code) as chargeCode,charge_fee=rtrim(charge_fee), " +
  24. "chargeName=rtrim(charge_name), frequCode=rtrim(frequ_code)," +
  25. "cxFlag=cx_flag,drugSpecification=rtrim(drug_specification)," +
  26. "start_time,end_time,chargeAmount=charge_amount,page_no,charge_status," +
  27. "supplyCode=(select rtrim(name) from view_zd_supply_type where code=supply_code)," +
  28. "physician=(select rtrim(name) from a_employee_mi where code=physician)," +
  29. "enterOper=(select rtrim(name) from a_employee_mi where code=enter_oper)," +
  30. "execUnit=(select rtrim(name) from zd_unit_code where code=exec_unit)," +
  31. "wardName=(select rtrim(name) from zd_unit_code where code=ward_code)," +
  32. "order_code, group_no from zy_list where charge_status in ('5','6','8')")
  33. List<ActOrderDetail> getActOrderDetail();
  34. @Update("exec zy_calc_detail_again_new @in_no=#{patNo}," +
  35. "@times=#{times},@sn=#{ledgerSn},@orig_type='1',@new_type='1'")
  36. int hasUnsettledStepOne(@Param("patNo") String patNo,
  37. @Param("times") Integer times,
  38. @Param("ledgerSn") int ledgerSn);
  39. @Select("select isnull(sum(depo_amount),0) from zy_deposit_file where depo_type='Y' " +
  40. "and inpatient_no=#{patNo} and admiss_times=#{times}")
  41. int hasUnsettledStepTwo(@Param("patNo") String patNo, @Param("times") Integer times);
  42. @Select("SELECT count(1) FROM zy_detail_charge WHERE inpatient_no=#{patNo} AND " +
  43. "admiss_times=#{times} and ledger_sn>=1 AND charge_fee <> 0 and charge_status ='1'")
  44. int hasNotAccounted(@Param("patNo") String patNo, @Param("times") Integer times);
  45. @Select("SELECT message = N'药单号:' + CAST(page_no as VARCHAR) + " +
  46. " N',药品名称:' + + (select top 1 name from yp_zd_dict where charge_code = code) + " +
  47. " N',医嘱号:' + CAST(CAST(act_order_no AS DECIMAL) AS VARCHAR(20)) " +
  48. " FROM yp_zy_patient WHERE inpatient_no=#{patNo} AND " +
  49. "admiss_times=#{times} AND amount <> 0 and acct_sign <> '2' ")
  50. List<String> hasUnreceivedDrugList(@Param("patNo") String patNo, @Param("times") Integer times);
  51. @Select("SELECT count(1) FROM yz_zy_patient_fee WHERE inpatient_no=#{patNo} " +
  52. "AND admiss_times=#{times} and charge_date<=#{actOrderDisDate} AND charge_fee <> 0 " +
  53. "and charge_status <> '0' and charge_status <> '2' ")
  54. int hasUnreceivedFees(@Param("patNo") String patNo,
  55. @Param("times") Integer times,
  56. @Param("actOrderDisDate") Date actOrderDisDate);
  57. @Select("SELECT count(1) FROM yz_yp_zy_order ( nolock ) WHERE inpatient_no=#{patNo} " +
  58. "AND admiss_times=#{times} AND ( amount > 0 or ( amount < 0 and " +
  59. "drug_class <> 'd' ) ) and status_flag='1' and page_no=0")
  60. int hasUnSubmitDrugList(@Param("patNo") String patNo, @Param("times") Integer times);
  61. @Select("SELECT count(1) FROM yz_yp_zy_order ( nolock ) WHERE inpatient_no=#{patNo} " +
  62. "AND admiss_times=#{times} AND ( amount > 0 or ( amount < 0 and " +
  63. "drug_class <> 'd' ) ) and status_flag='1' and ( case when amount > 0 then " +
  64. "page_no else page_no_ty end > 0 ) ")
  65. int hasUntreatedDrugWithdrawalOrder(@Param("patNo") String patNo,
  66. @Param("times") Integer times);
  67. @Select("SELECT count(1) FROM yz_zy_patient_fee WHERE inpatient_no=#{patNo} " +
  68. "AND admiss_times=#{times} and charge_date<=#{actOrderDisDate} AND " +
  69. "charge_fee <> 0 and charge_status='3'")
  70. int hasUnconfirmedMedicalTech(@Param("patNo") String patNo,
  71. @Param("times") Integer times,
  72. @Param("actOrderDisDate") Date actOrderDisDate);
  73. @Select("select * from (select sum(a.charge_fee) as code,a.charge_code_mx as chargeCode,b.name from zy_detail_charge a, " +
  74. "zd_charge_item b where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and " +
  75. "a.charge_code_mx=b.code group by a.charge_code_mx,b.name union select " +
  76. "sum(a.charge_fee) as code,a.charge_code_mx as chargeCode,b.name from zy_detail_charge a,yp_zd_dict b " +
  77. "where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and a.charge_code_mx=b.code " +
  78. "group by a.charge_code_mx,b.name ) as x where x.code<0")
  79. List<NegativeFee> feeOrderNegative(@Param("patNo") String patNo, @Param("times") Integer times);
  80. @Delete("delete zy_tmp_settle_select_detail where inpatient_no=#{patNo} and admiss_times=#{times}")
  81. void deleteTemporaryTable(@Param("patNo") String patNo, @Param("times") Integer times);
  82. @Select("select dateadd(second,1,account_date) from zy_ledger_file where inpatient_no=#{patNo} and " +
  83. "admiss_times=#{times} and ledger_sn=(#{ledgerSn}-1)")
  84. Date selectLastLedgerAccountDate(@Param("patNo") String patNo, @Param("times") int times, @Param("ledgerSn") int ledgerSn);
  85. @Select("select admiss_date from ${table} where inpatient_no=#{patNo} and admiss_times=#{times}")
  86. Date selectAdmissDate(@Param("patNo") String patNo, @Param("times") Integer times, @Param("table") String table);
  87. @Select("SELECT settle_type FROM zy_ledger_file WHERE inpatient_no=#{patNo} " +
  88. "AND admiss_times=#{times} AND ledger_sn=#{ledgerSn}")
  89. int hasSettled(@Param("patNo") String patNo,
  90. @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
  91. @Select("select count(1) from zy_tmp_settle_select_detail where inpatient_no=#{patNo} " +
  92. "and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  93. int hasUncheckedFee(@Param("patNo") String patNo,
  94. @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
  95. @Select("select count(1) from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
  96. "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')")
  97. Integer countDisActOrders(@Param("patNo") String patNo, @Param("times") Integer times);
  98. @Select("select count(1) from yz_inact_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
  99. "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')")
  100. Integer countDisActOrders2(@Param("patNo") String patNo, @Param("times") Integer times);
  101. @Select("select (select isnull(sum(charge_fee),0) from zy_detail_charge where inpatient_no=#{patNo} " +
  102. "and admiss_times=#{times} and ledger_sn=#{ledgerSn} and isnull(charge_status, '1') <> '1') - " +
  103. "(select isnull(total_charge,0) from zy_ledger_file " +
  104. "where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn})")
  105. BigDecimal getFeeOffset(@Param("patNo") String patNo,
  106. @Param("times") Integer times,
  107. @Param("ledgerSn") int ledgerSn);
  108. @Select("select isnull(sum(charge_fee),0) from zy_detail_charge where inpatient_no=#{patNo} and " +
  109. "admiss_times=#{times} and ledger_sn=#{ledgerSn} and isnull(charge_status, '1')!='1' and " +
  110. "isnull(trans_flag_yb,0)!=2 and charge_date ${compare} #{timeLimit}")
  111. BigDecimal selectOverTimeLimitFee(@Param("patNo") String patNo,
  112. @Param("times") Integer times,
  113. @Param("ledgerSn") int ledgerSn,
  114. @Param("compare") String compare,
  115. @Param("timeLimit") Date timeLimit);
  116. @Delete("delete zy_ledger_file_yb where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  117. void deleteZyLedgerFileYb(@Param("patNo") String patNo,
  118. @Param("times") Integer times,
  119. @Param("ledgerSn") int ledgerSn);
  120. @Insert("insert into zy_ledger_file_yb (inpatient_no,admiss_times,ledger_sn,total_cost,tczf,grzhzf,dbzf,xjzf," +
  121. "full_self_pay,part_self_pay,hospital_pay) values (#{inpatientNo},#{admissTimes},#{ledgerSn},#{totalCost}," +
  122. "#{tczf},#{grzhzf},#{dbzf},#{xjzf},#{fullSelfPay},#{partSelfPay},#{hospitalPay})")
  123. int insertZyLedgerFileYb(MedinsSettleFee settleFee);
  124. @Update("update zy_ledger_file set charge_yb=1 where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  125. int beforeWriteReceiptTable(@Param("patNo") String patNo,
  126. @Param("times") Integer times,
  127. @Param("ledgerSn") int ledgerSn);
  128. @Insert("insert into zy_receipt (inpatient_no,admiss_times,ledger_sn,receipt_sn,receipt_no," +
  129. "account_date,date_1,date_2,ward,dept,print_date,responce_unit,op_id_code,total_charge," +
  130. "charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,charge10,charge11," +
  131. "charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,charge21," +
  132. "charge22,charge23,charge24,charge25,charge26,charge27,charge28,charge29,charge30) " +
  133. "values (#{patNo},#{times},#{ledgerSn},#{receiptSn},'0000000',#{dismissDate}," +
  134. "#{admissDate},#{dismissDate},#{wardCode},#{deptCode},#{printDate},#{responceUnit},#{codeRs}," +
  135. "#{map.total},#{map.001},#{map.002},#{map.003},#{map.004},#{map.005},#{map.006},#{map.007},#{map.008},#{map.009},#{map.010}," +
  136. "#{map.011},#{map.012},#{map.013},#{map.014},#{map.015},#{map.016},#{map.017},#{map.018},#{map.019},#{map.020},#{map.021},#{map.022}," +
  137. "#{map.023},#{map.024},#{map.025},#{map.026},#{map.027},#{map.028},'0.00','0.00')")
  138. int writeReceiptTable(@Param("patNo") String patNo, @Param("times") Integer times,
  139. @Param("ledgerSn") int ledgerSn, @Param("receiptSn") int receiptSn,
  140. @Param("admissDate") Date admissDate, @Param("dismissDate") Date dismissDate,
  141. @Param("wardCode") String wardCode, @Param("deptCode") String deptCode,
  142. @Param("printDate") Date printDate, @Param("responceUnit") String responceUnit,
  143. @Param("codeRs") String codeRs, @Param("map") Map<String, String> map);
  144. @Select("select max(infant_flag) FROM zy_detail_charge WHERE inpatient_no=#{patNo} and admiss_times=#{times}")
  145. int hasInfant(@Param("patNo") String patNo, @Param("times") Integer times);
  146. @Update("update zy_ledger_file set account_date=#{zjdzDatetime},settle_type='1',balance=0,dept_code=#{deptCode}," +
  147. "last_balance=total_charge,settle=deposit-total_charge,ward_code=#{wardCode},op_id_code=#{staffId}," +
  148. "responce_type='01',charge_yb=0,fund_pay_sumamt=0,acct_pay=0 from zy_ledger_file " +
  149. "where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} and ledger_sn=#{ledgerSn}")
  150. int updateZifeiCostStatus(MedinsSettleFee settleFee);
  151. @Update("update zy_ledger_file set account_date=#{zjdzDatetime},settle_type='1',balance=0,last_balance=#{xjzf}, " +
  152. "settle=(deposit-#{xjzf}),ward_code=#{wardCode},dept_code=#{deptCode},op_id_code=#{staffId},charge_yb=0," +
  153. "fund_pay_sumamt=#{tczf},acct_pay=#{grzhzf} where inpatient_no=#{inpatientNo} and " +
  154. "admiss_times=#{admissTimes} and ledger_sn=#{ledgerSn}")
  155. int updateCostStatusWithoutInfant(MedinsSettleFee settleFee);
  156. @Update("update zy_ledger_file set account_date=#{zjdzDatetime},settle_type='1',balance=0,charge_yb=0, " +
  157. "last_balance=(total_charge-#{tczf}-#{grzhzf}),settle=(deposit-total_charge+#{tczf}+#{grzhzf}), " +
  158. "ward_code=#{wardCode},dept_code=#{deptCode},op_id_code=#{staffId},fund_pay_sumamt=#{tczf},acct_pay=#{grzhzf} " +
  159. "where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} and ledger_sn=#{ledgerSn}")
  160. int updateCostStatusWithInfant(MedinsSettleFee settleFee);
  161. @Update("update zy_detail_charge set charge_status=3 where charge_status=2 and " +
  162. "inpatient_no=#{patNo} AND admiss_times=#{times} AND ledger_sn=#{ledgerSn}")
  163. int updateZyDetailCharge(@Param("patNo") String patNo,
  164. @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
  165. @Select("select start_time from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
  166. "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973')")
  167. Date selectActOrderDisDate(@Param("patNo") String patNo, @Param("times") Integer times);
  168. @Select("select start_time from yz_inact_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
  169. "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973')")
  170. Date selectActOrderDisDate2(@Param("patNo") String patNo, @Param("times") Integer times);
  171. @Update("update ${table} SET dis_date=#{disDate},dis_ward=ward,dis_dept=dept,job_nurse=#{codeRs}," +
  172. "bed_status='5' WHERE inpatient_no=#{patNo} AND admiss_times=#{times}")
  173. int updateZyActpatient(@Param("patNo") String patNo, @Param("times") Integer times,
  174. @Param("disDate") Date disDate, @Param("codeRs") String codeRs, @Param("table") String table);
  175. @Delete("DELETE FROM zy_inactpatient WHERE inpatient_no=#{patNo} AND admiss_times=#{times}")
  176. void deleteZyInactpatient(@Param("patNo") String patNo, @Param("times") Integer times);
  177. @Insert("INSERT INTO zy_inactpatient SELECT * FROM zy_actpatient WHERE inpatient_no=#{patNo} AND admiss_times=#{times}")
  178. int insertZyInactpatient(@Param("patNo") String patNo, @Param("times") Integer times);
  179. @Update("update ${table} SET dis_date=#{disDate},dis_ward=ward,dis_dept=dept WHERE inpatient_no >=#{patNo1} " +
  180. "and inpatient_no <= #{patNo6} and admiss_times=#{times}")
  181. void updateZyActpatientAgain(@Param("patNo1") String patNo1,
  182. @Param("patNo6") String patNo6,
  183. @Param("times") Integer times,
  184. @Param("disDate") Date disDate, @Param("table") String table);
  185. @Insert("INSERT INTO zy_inactpatient SELECT * FROM zy_actpatient WHERE inpatient_no >=#{patNo1} " +
  186. "and inpatient_no <= #{patNo6} and admiss_times=#{times}")
  187. void insertZyInactpatientAgain(@Param("patNo1") String patNo1,
  188. @Param("patNo6") String patNo6,
  189. @Param("times") Integer times);
  190. @Update("update zy_adt SET dis_date=#{disDate},orig_ward=#{wardCode},orig_dept=#{deptCode},orig_bed=#{bedNo} " +
  191. "WHERE inpatient_no=#{patNo} AND admiss_times=#{times} AND trans_times=0")
  192. int updateZyAdt(@Param("patNo") String patNo, @Param("times") Integer times,
  193. @Param("wardCode") String wardCode, @Param("deptCode") String deptCode,
  194. @Param("bedNo") String bedNo, @Param("disDate") Date disDate);
  195. @Update("update zy_bed_mi SET bed_status='1',admiss_times=NULL,inpatient_no=NULL WHERE " +
  196. "inpatient_no=#{patNo} AND admiss_times=#{times}")
  197. void updateZyBedMi(@Param("patNo") String patNo, @Param("times") Integer times);
  198. @Delete("DELETE FROM zy_actpatient WHERE inpatient_no=#{patNo}")
  199. void deleteZyActpatient(@Param("patNo") String patNo);
  200. @Delete("DELETE FROM zy_actpatient WHERE inpatient_no >= #{patNo1} and inpatient_no <= #{patNo6} " +
  201. " and admiss_times=#{times}")
  202. void deleteZyActpatientAgain(@Param("patNo1") String patNo1, @Param("patNo6") String patNo6,
  203. @Param("times") Integer times);
  204. @Insert("insert into zy_work_log (inpatient_no,admiss_times,ledger_sn,op_id,op_date,log_type," +
  205. "dept_code,ward_code,name) values (#{patNo},#{times},#{ledgerSn},#{codeRs}," +
  206. "getDate(),#{logType},#{deptCode},#{wardCode},#{userName})")
  207. int insertNewZyWorkLog(@Param("patNo") String patNo, @Param("times") Integer times,
  208. @Param("ledgerSn") int ledgerSn, @Param("wardCode") String wardCode,
  209. @Param("logType") String logType, @Param("deptCode") String deptCode,
  210. @Param("codeRs") String codeRs, @Param("userName") String userName);
  211. @Update("update ${table} set times_billed=(times_billed+1) where " +
  212. "inpatient_no=#{patNo} and admiss_times=#{times}")
  213. void updateTimesBilledByIncreaseOne(@Param("patNo") String patNo, @Param("times") Integer times, @Param("table") String table);
  214. @Insert("INSERT INTO zy_ledger_file (inpatient_no, admiss_times, ledger_sn, op_id_code, deposit, balance, " +
  215. "total_charge, charge1, charge2, charge3, charge4, charge5, charge6, charge7, charge8, charge9, " +
  216. "charge10, charge11, charge12, charge13, charge14, charge15, charge16, charge17, charge18, " +
  217. "charge19, charge20, last_balance, settle, settle_type) VALUES " +
  218. "(#{patNo}, #{times}, #{ledgerSn}, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, " +
  219. "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0')")
  220. void insertNewLedgerFile(@Param("patNo") String patNo,
  221. @Param("times") Integer times,
  222. @Param("ledgerSn") int ledgerSn);
  223. @Update("update zy_ledger_file set total_charge=" +
  224. "(select isnull(sum(charge_fee),0) from zy_detail_charge where inpatient_no=#{patNo} and " +
  225. "admiss_times=#{times} and ledger_sn=#{ledgerSn}) where inpatient_no=#{patNo} " +
  226. "and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  227. void updateZyLedgerFileTotalCharge(@Param("patNo") String patNo,
  228. @Param("times") Integer times,
  229. @Param("ledgerSn") int ledgerSn);
  230. @Update("update zy_detail_charge set ledger_sn=#{ledgerSn} where inpatient_no=#{patNo} " +
  231. "and admiss_times=#{times} and ledger_sn=#{lastSn} and charge_date>#{zjdzDate}")
  232. void updateFeesLedgerSn(@Param("patNo") String patNo,
  233. @Param("times") Integer times,
  234. @Param("ledgerSn") int ledgerSn,
  235. @Param("lastSn") int lastSn,
  236. @Param("zjdzDate") Date zjdzDate);
  237. @Update("update zy_actpatient set responce_type='01', visit_type='01', yb_type='', treat_type=''," +
  238. "yb_register_date=#{date} where inpatient_no=#{patNo} and admiss_times=#{times}")
  239. void clearMedinsInfo(@Param("patNo") String patNo, @Param("times") Integer times, @Param("date") Date date);
  240. @Select("select rtrim(hic_no_new) from a_patient_mi where inpatient_no=#{zyh}")
  241. String getHicNoNew(@Param("zyh") String zyh);
  242. @Update("update a_patient_mi set cpy=#{hicNew} where inpatient_no=#{zyh}")
  243. void updateCpy(@Param("zyh") String zyh, @Param("hicNew") String hicNew);
  244. @Update("update a_patient_mi set hic_no=#{hicNew} where inpatient_no=#{zyh}")
  245. void updateHic(@Param("zyh") String zyh, @Param("hicNew") String hicNew);
  246. @Select("select mdtrt_id,med_type from t_si_pat_info where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
  247. BriefMdtrtInfo selectMdtrtId(@Param("patNo") String patNo,
  248. @Param("times") Integer times,
  249. @Param("ledgerSn") int ledgerSn);
  250. @Select("select serial_no from t_injury_si_pat_info where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
  251. String selectInjurySerialNo(@Param("patNo") String patNo,
  252. @Param("times") Integer times,
  253. @Param("ledgerSn") int ledgerSn);
  254. @Select("select count(1) from zy_dis_diag_yb where inpatient_no=#{patNo} and admiss_times=#{times}")
  255. int hasDismissDiag(@Param("patNo") String patNo,
  256. @Param("times") Integer times);
  257. @Update("update zy_actpatient set total_charge=#{map.total},charge1=#{map.001},charge2=#{map.002}, " +
  258. "charge3=#{map.003},charge4=#{map.004},charge5=#{map.005},charge6=#{map.006},charge7=#{map.007}, " +
  259. "charge8=#{map.008},charge9=#{map.009},charge10=#{map.010},charge11=#{map.011},charge12=#{map.012}, " +
  260. "charge13=#{map.013},charge14=#{map.014},charge15=#{map.015},charge16=#{map.016},charge17=#{map.017}, " +
  261. "charge18=#{map.018},charge19=#{map.019},charge20=#{map.020},charge21=#{map.021},charge22=#{map.022}," +
  262. "charge23=#{map.023},charge24=#{map.024},charge25=#{map.025},charge26=#{map.026},charge27=#{map.027}, " +
  263. "charge28=#{map.028},charge29=0,charge30=0 where inpatient_no>=#{patNo1} and inpatient_no<=#{patNo6} and " +
  264. "admiss_times=#{times} ")
  265. void updateInfantfee(@Param("patNo1") String patNo1,
  266. @Param("patNo6") String patNo6,
  267. @Param("times") int times,
  268. @Param("map") Map<String, String> map);
  269. @Select("select b.bill_item_zy as bill_code, ledger_fee=sum(a.charge_fee), " +
  270. "infant_fee=sum(case when isnull(infant_flag,0)=1 then charge_fee else 0 end), " +
  271. "adult_fee=sum(case when isnull(infant_flag,0)!=1 then charge_fee else 0 end) " +
  272. "from zy_detail_charge a, zd_charge_item b " +
  273. "where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and " +
  274. "a.ledger_sn=#{ledgerSn} and a.charge_status!='1' and " +
  275. "a.charge_date>=#{begntime} and a.charge_date<=#{endtime} and " +
  276. "a.charge_code=b.code group by b.bill_item_zy, a.ledger_sn")
  277. List<ReceiptFee> selectLedgerFees(@Param("patNo") String patNo,
  278. @Param("times") int times,
  279. @Param("ledgerSn") int ledgerSn,
  280. @Param("begntime") Date begntime,
  281. @Param("endtime") Date endtime);
  282. @Select("select code from zy_bill_item")
  283. List<String> selectBillCodes();
  284. @Select("select code from zy_zd_responce_type where med_type=(select med_type from t_si_pat_info " +
  285. "where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn} and isnull(mdtrt_id,'')!='')")
  286. String selectResponceType(@Param("patNo") String patNo,
  287. @Param("times") int times,
  288. @Param("ledgerSn") int ledgerSn);
  289. @Select("select cast(isnull(sum(depo_amount),0) as varchar(16)) from zy_deposit_file where " +
  290. "inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} and status in (1,2) ")
  291. String selectDepositSumamt(@Param("patNo") String patNo,
  292. @Param("times") int times,
  293. @Param("ledgerSn") int ledgerSn);
  294. @Update("update zy_ledger_file set deposit=#{deposit}, balance=#{balance}, responce_type=#{restype}, " +
  295. "total_charge=#{map.total},charge1=#{map.001},charge2=#{map.002}, charge3=#{map.003},charge4=#{map.004}, " +
  296. "charge5=#{map.005},charge6=#{map.006},charge7=#{map.007}, charge8=#{map.008},charge9=#{map.009}, " +
  297. "charge10=#{map.010},charge11=#{map.011},charge12=#{map.012}, charge13=#{map.013},charge14=#{map.014}, " +
  298. "charge15=#{map.015},charge16=#{map.016},charge17=#{map.017}, charge18=#{map.018},charge19=#{map.019}, " +
  299. "charge20=#{map.020},charge21=#{map.021},charge22=#{map.022}, charge23=#{map.023},charge24=#{map.024}, " +
  300. "charge25=#{map.025},charge26=#{map.026},charge27=#{map.027}, charge28=#{map.028},charge29=0,charge30=0 " +
  301. "where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  302. void updateZyLedgerFileCharges(@Param("patNo") String patNo,
  303. @Param("times") int times,
  304. @Param("ledgerSn") int ledgerSn,
  305. @Param("deposit") String deposit,
  306. @Param("balance") String balance,
  307. @Param("restype") String restype,
  308. @Param("map") Map<String, String> map);
  309. @Update("update zy_actpatient set balance=#{balance},responce_type=#{restype}, total_charge=#{totalCost}, " +
  310. "charge1=#{map.001},charge2=#{map.002}, charge3=#{map.003},charge4=#{map.004},charge5=#{map.005}, " +
  311. "charge6=#{map.006},charge7=#{map.007}, charge8=#{map.008},charge9=#{map.009},charge10=#{map.010}, " +
  312. "charge11=#{map.011},charge12=#{map.012}, charge13=#{map.013},charge14=#{map.014},charge15=#{map.015}, " +
  313. "charge16=#{map.016},charge17=#{map.017}, charge18=#{map.018},charge19=#{map.019},charge20=#{map.020}, " +
  314. "charge21=#{map.021},charge22=#{map.022}, charge23=#{map.023},charge24=#{map.024},charge25=#{map.025}, " +
  315. "charge26=#{map.026},charge27=#{map.027}, charge28=#{map.028},charge29=0,charge30=0 where inpatient_no=#{patNo} ")
  316. void updateZyActpatientCharges(@Param("patNo") String patNo,
  317. @Param("totalCost") String totalCost,
  318. @Param("balance") String balance,
  319. @Param("restype") String restype,
  320. @Param("map") Map<String, String> map);
  321. @Select("select isnull(sum(charge_fee),0) from zy_detail_charge where inpatient_no=#{patNo} " +
  322. "and admiss_times=#{times} and ledger_sn>0 and isnull(charge_status,'1')!='1' ")
  323. String selectTotalCharge(@Param("patNo") String patNo,
  324. @Param("times") int times);
  325. @Select("select datediff(day,#{begn},#{end}) ")
  326. int selectInhospdays(@Param("begn") Date begn, @Param("end") Date end);
  327. @Select("select b.bill_item_zy as code,sum(a.charge_amount) as name from zy_detail_charge a, zd_charge_item b " +
  328. "where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and a.charge_status!='1' and b.bill_item_zy " +
  329. "in ('003') and a.charge_code_mx not in ('017623','011062','010437','010435','011193') " +
  330. "and a.charge_code=b.code group by b.bill_item_zy")
  331. List<PureCodeName> selectChargeQuantities(@Param("patNo") String patNo,
  332. @Param("times") int times);
  333. }