DismissDao.java 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. package thyyxxk.webserver.dao.his.yibao;
  2. import org.apache.ibatis.annotations.*;
  3. import thyyxxk.webserver.entity.yibao.dismiss.ActOrderDetail;
  4. import thyyxxk.webserver.entity.yibao.dismiss.NegativeFee;
  5. import thyyxxk.webserver.entity.yibao.dismiss.ReceiptFee;
  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 count(1) FROM yp_zy_patient WHERE inpatient_no=#{patNo} AND " +
  46. "admiss_times=#{times} AND amount <> 0 and acct_sign <> '2' ")
  47. int hasUnreceivedDrugList(@Param("patNo") String patNo, @Param("times") Integer times);
  48. @Select("SELECT count(1) FROM yz_zy_patient_fee WHERE inpatient_no=#{patNo} " +
  49. "AND admiss_times=#{times} and charge_date<=#{actOrderDisDate} AND charge_fee <> 0 " +
  50. "and charge_status <> '0' and charge_status <> '2' ")
  51. int hasUnreceivedFees(@Param("patNo") String patNo,
  52. @Param("times") Integer times,
  53. @Param("actOrderDisDate") Date actOrderDisDate);
  54. @Select("SELECT count(1) FROM yz_yp_zy_order ( nolock ) WHERE inpatient_no=#{patNo} " +
  55. "AND admiss_times=#{times} AND ( amount > 0 or ( amount < 0 and " +
  56. "drug_class <> 'd' ) ) and status_flag='1' and page_no=0")
  57. int hasUnSubmitDrugList(@Param("patNo") String patNo, @Param("times") Integer times);
  58. @Select("SELECT count(1) FROM yz_yp_zy_order ( nolock ) WHERE inpatient_no=#{patNo} " +
  59. "AND admiss_times=#{times} AND ( amount > 0 or ( amount < 0 and " +
  60. "drug_class <> 'd' ) ) and status_flag='1' and ( case when amount > 0 then " +
  61. "page_no else page_no_ty end > 0 ) ")
  62. int hasUntreatedDrugWithdrawalOrder(@Param("patNo") String patNo,
  63. @Param("times") Integer times);
  64. @Select("SELECT count(1) FROM yz_zy_patient_fee WHERE inpatient_no=#{patNo} " +
  65. "AND admiss_times=#{times} and charge_date<=#{actOrderDisDate} AND " +
  66. "charge_fee <> 0 and charge_status='3'")
  67. int hasUnconfirmedMedicalTech(@Param("patNo") String patNo,
  68. @Param("times") Integer times,
  69. @Param("actOrderDisDate") Date actOrderDisDate);
  70. @Select("select * from (select sum(a.charge_fee) as code,a.charge_code_mx as chargeCode,b.name from zy_detail_charge a, " +
  71. "zd_charge_item b where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and " +
  72. "a.charge_code_mx=b.code group by a.charge_code_mx,b.name union select " +
  73. "sum(a.charge_fee) as code,a.charge_code_mx as chargeCode,b.name from zy_detail_charge a,yp_zd_dict b " +
  74. "where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and a.charge_code_mx=b.code " +
  75. "group by a.charge_code_mx,b.name ) as x where x.code<0")
  76. List<NegativeFee> feeOrderNegative(@Param("patNo") String patNo, @Param("times") Integer times);
  77. @Delete("delete zy_tmp_settle_select_detail where inpatient_no=#{patNo} and admiss_times=#{times}")
  78. void deleteTemporaryTable(@Param("patNo") String patNo, @Param("times") Integer times);
  79. @Select("select top 1 date_2 from zy_receipt where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn>0 order by ledger_sn desc")
  80. Date selectAccountDate(@Param("patNo") String patNo, @Param("times") int times);
  81. @Select("select admiss_date from ${table} where inpatient_no=#{patNo} and admiss_times=#{times}")
  82. Date selectAdmissDate(@Param("patNo") String patNo, @Param("times") Integer times, @Param("table") String table);
  83. @Select("SELECT settle_type FROM zy_ledger_file WHERE inpatient_no=#{patNo} " +
  84. "AND admiss_times=#{times} AND ledger_sn=#{ledgerSn}")
  85. int hasSettled(@Param("patNo") String patNo,
  86. @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
  87. @Select("select count(1) from zy_tmp_settle_select_detail where inpatient_no=#{patNo} " +
  88. "and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  89. int hasUncheckedFee(@Param("patNo") String patNo,
  90. @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
  91. @Select("select count(1) from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
  92. "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')")
  93. Integer countDisActOrders(@Param("patNo") String patNo, @Param("times") Integer times);
  94. @Select("select count(1) from yz_inact_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
  95. "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')")
  96. Integer countDisActOrders2(@Param("patNo") String patNo, @Param("times") Integer times);
  97. @Select("select (select isnull(sum(charge_fee),0) from zy_detail_charge where inpatient_no=#{patNo} " +
  98. "AND admiss_times=#{times} AND ledger_sn=#{ledgerSn} and isnull(charge_status, '1') <> '1' " +
  99. "and charge_date>=#{begntime} and charge_date<=#{endtime})-(select isnull(total_charge,0) from zy_ledger_file " +
  100. "where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn})")
  101. int getFeeOffset(@Param("patNo") String patNo,
  102. @Param("times") Integer times,
  103. @Param("ledgerSn") int ledgerSn,
  104. @Param("begntime") Date begntime,
  105. @Param("endtime") Date endtime);
  106. @Update("update zy_ledger_file set deposit=(select sum(depo_amount) from zy_deposit_file f with(nolock) " +
  107. "where f.inpatient_no=#{zyh} and f.admiss_times=#{times} and f.ledger_sn=#{ledger} and f.status = '1') " +
  108. "where inpatient_no=#{zyh} and admiss_times=#{times} and ledger_sn=#{ledger}")
  109. void recountDeposit(@Param("zyh") String zyh,
  110. @Param("times") int times,
  111. @Param("ledger") int ledger);
  112. @Delete("delete zy_ledger_file_yb where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  113. void deleteZyLedgerFileYb(@Param("patNo") String patNo,
  114. @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
  115. @Insert("insert into zy_ledger_file_yb (inpatient_no,admiss_times,ledger_sn,total_cost,tczf,grzhzf,dbzf,xjzf," +
  116. "full_self_pay,part_self_pay,hospital_pay) " +
  117. "values (#{patNo},#{times},#{ledgerSn},#{fee0},#{fee1},#{fee2},#{fee3},#{fee4}," +
  118. "#{fullSelfPay},#{partSelfPay},#{hospitalPay})")
  119. int writeYbSettleTable(@Param("patNo") String patNo,
  120. @Param("times") Integer times, @Param("ledgerSn") int ledgerSn,
  121. @Param("fee0") String fee0, @Param("fee1") String fee1, @Param("fee2") String fee2,
  122. @Param("fee3") String fee3, @Param("fee4") String fee4,
  123. @Param("fullSelfPay") String fullSelfPay, @Param("partSelfPay") String partSelfPay,
  124. @Param("hospitalPay") String hospitalPay);
  125. @Update("update zy_ledger_file set charge_yb=1 where inpatient_no=#{patNo} and " +
  126. "admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  127. int beforeWriteReceiptTable(@Param("patNo") String patNo,
  128. @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
  129. @Insert("insert into zy_receipt (inpatient_no,admiss_times,ledger_sn,receipt_sn,receipt_no," +
  130. "account_date,date_1,date_2,ward,dept,print_date,responce_unit,op_id_code,total_charge," +
  131. "charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,charge10,charge11," +
  132. "charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,charge21," +
  133. "charge22,charge23,charge24,charge25,charge26,charge27,charge28,charge29,charge30) " +
  134. "values (#{patNo},#{times},#{ledgerSn},#{receiptSn},'0000000',#{dismissDate}," +
  135. "#{admissDate},#{dismissDate},#{wardCode},#{deptCode},#{printDate},#{responceUnit},#{codeRs}," +
  136. "#{map.total},#{map.001},#{map.002},#{map.003},#{map.004},#{map.005},#{map.006},#{map.007},#{map.008},#{map.009},#{map.010}," +
  137. "#{map.011},#{map.012},#{map.013},#{map.014},#{map.015},#{map.016},#{map.017},#{map.018},#{map.019},#{map.020},#{map.021},#{map.022}," +
  138. "#{map.023},#{map.024},#{map.025},#{map.026},#{map.027},#{map.028},'0.00','0.00')")
  139. int writeReceiptTable(@Param("patNo") String patNo, @Param("times") Integer times,
  140. @Param("ledgerSn") int ledgerSn, @Param("receiptSn") int receiptSn,
  141. @Param("admissDate") Date admissDate, @Param("dismissDate") Date dismissDate,
  142. @Param("wardCode") String wardCode, @Param("deptCode") String deptCode,
  143. @Param("printDate") Date printDate, @Param("responceUnit") String responceUnit,
  144. @Param("codeRs") String codeRs, @Param("map") Map<String, String> map);
  145. @Select("select max(infant_flag) FROM zy_detail_charge WHERE inpatient_no=#{patNo} and admiss_times=#{times}")
  146. int hasInfant(@Param("patNo") String patNo, @Param("times") Integer times);
  147. @Update("update zy_ledger_file set account_date=#{dismissDate},settle_type='1',balance=0," +
  148. "last_balance=total_charge,settle=deposit-total_charge,ward_code=#{wardCode}," +
  149. "dept_code=#{deptCode},op_id_code=#{codeRs},responce_type='01',charge_yb=0 from zy_ledger_file " +
  150. "where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  151. int updateZifeiCostStatus(@Param("patNo") String patNo, @Param("times") Integer times,
  152. @Param("ledgerSn") int ledgerSn, @Param("wardCode") String wardCode,
  153. @Param("deptCode") String deptCode, @Param("codeRs") String codeRs,
  154. @Param("dismissDate") Date dismissDate);
  155. @Select("select case when isnull(xjzf,0)!=0 then xjzf else total_cost-tczf end from zy_ledger_file_yb " +
  156. "where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  157. String selectMedinsCashPay(@Param("patNo") String patNo,
  158. @Param("times") Integer times,
  159. @Param("ledgerSn") int ledgerSn);
  160. @Update("update zy_ledger_file set account_date=#{dismissDate},settle_type='1',balance=0,last_balance=#{cash}, " +
  161. "settle=(deposit-#{cash}),ward_code=#{wardCode},dept_code=#{deptCode},op_id_code=#{codeRs},charge_yb=0 " +
  162. "where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  163. int updateCostStatusWithoutInfant(@Param("patNo") String patNo, @Param("times") Integer times,
  164. @Param("ledgerSn") int ledgerSn, @Param("wardCode") String wardCode,
  165. @Param("deptCode") String deptCode, @Param("codeRs") String codeRs,
  166. @Param("dismissDate") Date dismissDate, @Param("cash") String cash);
  167. @Select("select tczf from zy_ledger_file_yb where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  168. String selectMedinsFundPay(@Param("patNo") String patNo,
  169. @Param("times") Integer times,
  170. @Param("ledgerSn") int ledgerSn);
  171. @Update("update zy_ledger_file set account_date=#{dismissDate},settle_type='1',balance=0, " +
  172. "last_balance=(total_charge-#{fund}),settle=(deposit-total_charge+#{fund}), " +
  173. "ward_code=#{wardCode},dept_code=#{deptCode},op_id_code=#{codeRs}, " +
  174. "charge_yb=0 where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  175. int updateCostStatusWithInfant(@Param("patNo") String patNo, @Param("times") Integer times,
  176. @Param("ledgerSn") int ledgerSn, @Param("wardCode") String wardCode,
  177. @Param("deptCode") String deptCode, @Param("codeRs") String codeRs,
  178. @Param("dismissDate") Date dismissDate, @Param("fund") String fund);
  179. @Update("update zy_detail_charge set charge_status=3 where charge_status=2 and " +
  180. "inpatient_no=#{patNo} AND admiss_times=#{times} AND ledger_sn=#{ledgerSn}")
  181. int updateZyDetailCharge(@Param("patNo") String patNo,
  182. @Param("times") Integer times, @Param("ledgerSn") int ledgerSn);
  183. @Select("select start_time from yz_act_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
  184. "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973')")
  185. Date selectActOrderDisDate(@Param("patNo") String patNo, @Param("times") Integer times);
  186. @Select("select start_time from yz_inact_order where inpatient_no=#{patNo} and admiss_times=#{times} " +
  187. "and status_flag > '1' and isnull(group_no, '00')='00' and order_code in ('06026','06053','05973')")
  188. Date selectActOrderDisDate2(@Param("patNo") String patNo, @Param("times") Integer times);
  189. @Update("update ${table} SET dis_date=#{disDate},dis_ward=ward,dis_dept=dept,job_nurse=#{codeRs}," +
  190. "bed_status='5' WHERE inpatient_no=#{patNo} AND admiss_times=#{times}")
  191. int updateZyActpatient(@Param("patNo") String patNo, @Param("times") Integer times,
  192. @Param("disDate") Date disDate, @Param("codeRs") String codeRs, @Param("table") String table);
  193. @Delete("DELETE FROM zy_inactpatient WHERE inpatient_no=#{patNo} AND admiss_times=#{times}")
  194. void deleteZyInactpatient(@Param("patNo") String patNo, @Param("times") Integer times);
  195. @Insert("INSERT INTO zy_inactpatient SELECT * FROM zy_actpatient WHERE inpatient_no=#{patNo} AND admiss_times=#{times}")
  196. int insertZyInactpatient(@Param("patNo") String patNo, @Param("times") Integer times);
  197. @Update("update ${table} SET dis_date=#{disDate},dis_ward=ward,dis_dept=dept WHERE inpatient_no >=#{patNo1} " +
  198. "and inpatient_no <= #{patNo6} and admiss_times=#{times}")
  199. void updateZyActpatientAgain(@Param("patNo1") String patNo1,
  200. @Param("patNo6") String patNo6,
  201. @Param("times") Integer times,
  202. @Param("disDate") Date disDate, @Param("table") String table);
  203. @Insert("INSERT INTO zy_inactpatient SELECT * FROM zy_actpatient WHERE inpatient_no >=#{patNo1} " +
  204. "and inpatient_no <= #{patNo6} and admiss_times=#{times}")
  205. void insertZyInactpatientAgain(@Param("patNo1") String patNo1,
  206. @Param("patNo6") String patNo6,
  207. @Param("times") Integer times);
  208. @Update("update zy_adt SET dis_date=#{disDate},orig_ward=#{wardCode},orig_dept=#{deptCode},orig_bed=#{bedNo} " +
  209. "WHERE inpatient_no=#{patNo} AND admiss_times=#{times} AND trans_times=0")
  210. int updateZyAdt(@Param("patNo") String patNo, @Param("times") Integer times,
  211. @Param("wardCode") String wardCode, @Param("deptCode") String deptCode,
  212. @Param("bedNo") String bedNo, @Param("disDate") Date disDate);
  213. @Update("update zy_bed_mi SET bed_status='1',admiss_times=NULL,inpatient_no=NULL WHERE " +
  214. "inpatient_no=#{patNo} AND admiss_times=#{times}")
  215. void updateZyBedMi(@Param("patNo") String patNo, @Param("times") Integer times);
  216. @Delete("DELETE FROM zy_actpatient WHERE inpatient_no=#{patNo}")
  217. void deleteZyActpatient(@Param("patNo") String patNo);
  218. @Delete("DELETE FROM zy_actpatient WHERE inpatient_no >= #{patNo1} and inpatient_no <= #{patNo6} " +
  219. " and admiss_times=#{times}")
  220. void deleteZyActpatientAgain(@Param("patNo1") String patNo1, @Param("patNo6") String patNo6,
  221. @Param("times") Integer times);
  222. @Insert("insert into zy_work_log (inpatient_no,admiss_times,ledger_sn,op_id,op_date,log_type," +
  223. "dept_code,ward_code,name) values (#{patNo},#{times},#{ledgerSn},#{codeRs}," +
  224. "getDate(),#{logType},#{deptCode},#{wardCode},#{userName})")
  225. int insertNewZyWorkLog(@Param("patNo") String patNo, @Param("times") Integer times,
  226. @Param("ledgerSn") int ledgerSn, @Param("wardCode") String wardCode,
  227. @Param("logType") String logType, @Param("deptCode") String deptCode,
  228. @Param("codeRs") String codeRs, @Param("userName") String userName);
  229. @Update("update ${table} set times_billed=(times_billed+1) where " +
  230. "inpatient_no=#{patNo} and admiss_times=#{times}")
  231. void updateTimesBilledByIncreaseOne(@Param("patNo") String patNo, @Param("times") Integer times, @Param("table") String table);
  232. @Insert("INSERT INTO zy_ledger_file (inpatient_no, admiss_times, ledger_sn, op_id_code, deposit, balance, " +
  233. "total_charge, charge1, charge2, charge3, charge4, charge5, charge6, charge7, charge8, charge9, " +
  234. "charge10, charge11, charge12, charge13, charge14, charge15, charge16, charge17, charge18, " +
  235. "charge19, charge20, last_balance, settle, settle_type) VALUES " +
  236. "(#{patNo}, #{times}, #{ledgerSn}, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, " +
  237. "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0')")
  238. void insertNewLedgerFile(@Param("patNo") String patNo,
  239. @Param("times") Integer times,
  240. @Param("ledgerSn") int ledgerSn);
  241. @Update("update zy_ledger_file set total_charge=" +
  242. "(select isnull(sum(charge_fee),0) from zy_detail_charge where inpatient_no=#{patNo} and " +
  243. "admiss_times=#{times} and ledger_sn=#{ledgerSn}) where inpatient_no=#{patNo} " +
  244. "and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  245. void updateZyLedgerFileTotalCharge(@Param("patNo") String patNo,
  246. @Param("times") Integer times,
  247. @Param("ledgerSn") int ledgerSn);
  248. @Update("update zy_detail_charge set ledger_sn=#{ledgerSn} where inpatient_no=#{patNo} " +
  249. "and admiss_times=#{times} and ledger_sn=#{lastSn} and charge_date>#{zjdzDate}")
  250. void updateFeesLedgerSn(@Param("patNo") String patNo,
  251. @Param("times") Integer times,
  252. @Param("ledgerSn") int ledgerSn,
  253. @Param("lastSn") int lastSn,
  254. @Param("zjdzDate") Date zjdzDate);
  255. @Update("update zy_actpatient set responce_type='01', visit_type='01', yb_type='', treat_type=''," +
  256. "yb_register_date=#{date} where inpatient_no=#{patNo} and admiss_times=#{times}")
  257. void retractYbsf1(@Param("patNo") String patNo, @Param("times") Integer times, @Param("date") Date date);
  258. @Update("delete from yb_zy_review_record where inpatient_no=#{patNo} and admiss_times=#{times}")
  259. void retractYbsf2(@Param("patNo") String patNo, @Param("times") Integer times);
  260. @Select("select rtrim(hic_no_new) from a_patient_mi where inpatient_no=#{zyh}")
  261. String getHicNoNew(@Param("zyh") String zyh);
  262. @Update("update a_patient_mi set cpy=#{hicNew} where inpatient_no=#{zyh}")
  263. void updateCpy(@Param("zyh") String zyh, @Param("hicNew") String hicNew);
  264. @Update("update a_patient_mi set hic_no=#{hicNew} where inpatient_no=#{zyh}")
  265. void updateHic(@Param("zyh") String zyh, @Param("hicNew") String hicNew);
  266. @Select("select mdtrt_id from t_si_pat_info where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
  267. String selectMdtrtId(@Param("patNo") String patNo,
  268. @Param("times") Integer times,
  269. @Param("ledgerSn") int ledgerSn);
  270. @Select("select serial_no from t_injury_si_pat_info where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn}")
  271. String selectInjurySerialNo(@Param("patNo") String patNo,
  272. @Param("times") Integer times,
  273. @Param("ledgerSn") int ledgerSn);
  274. @Update("update zy_actpatient set total_charge=#{map.total},charge1=#{map.001},charge2=#{map.002}, " +
  275. "charge3=#{map.003},charge4=#{map.004},charge5=#{map.005},charge6=#{map.006},charge7=#{map.007}, " +
  276. "charge8=#{map.008},charge9=#{map.009},charge10=#{map.010},charge11=#{map.011},charge12=#{map.012}, " +
  277. "charge13=#{map.013},charge14=#{map.014},charge15=#{map.015},charge16=#{map.016},charge17=#{map.017}, " +
  278. "charge18=#{map.018},charge19=#{map.019},charge20=#{map.020},charge21=#{map.021},charge22=#{map.022}," +
  279. "charge23=#{map.023},charge24=#{map.024},charge25=#{map.025},charge26=#{map.026},charge27=#{map.027}, " +
  280. "charge28=#{map.028},charge29=0,charge30=0 where inpatient_no>=#{patNo1} and inpatient_no<=#{patNo6} and admiss_times=#{times} ")
  281. void updateInfantfee(@Param("patNo1") String patNo1,
  282. @Param("patNo6") String patNo6,
  283. @Param("times") int times,
  284. @Param("map") Map<String, String> map);
  285. @Select("select b.bill_item_zy as bill_code, ledger_fee=sum(a.charge_fee), " +
  286. "infant_fee=sum(case when isnull(infant_flag,0)=1 then charge_fee else 0 end), " +
  287. "adult_fee=sum(case when isnull(infant_flag,0)!=1 then charge_fee else 0 end) " +
  288. "from zy_detail_charge a, zd_charge_item b " +
  289. "where a.inpatient_no=#{patNo} and a.admiss_times=#{times} and " +
  290. "a.ledger_sn=#{ledgerSn} and a.charge_status!='1' and " +
  291. "a.charge_date>=#{begntime} and a.charge_date<=#{endtime} and " +
  292. "a.charge_code=b.code group by b.bill_item_zy, a.ledger_sn")
  293. List<ReceiptFee> selectLedgerFees(@Param("patNo") String patNo,
  294. @Param("times") int times,
  295. @Param("ledgerSn") int ledgerSn,
  296. @Param("begntime") Date begntime,
  297. @Param("endtime") Date endtime);
  298. @Select("select code from zy_bill_item")
  299. List<String> selectBillCodes();
  300. @Select("select code from zy_zd_responce_type where med_type=(select med_type from t_si_pat_info " +
  301. "where pat_no=#{patNo} and times=#{times} and ledger_sn=#{ledgerSn} and isnull(mdtrt_id,'')!='')")
  302. String selectResponceType(@Param("patNo") String patNo,
  303. @Param("times") int times,
  304. @Param("ledgerSn") int ledgerSn);
  305. @Select("select cast(sum(depo_amount) as varchar(16)) from zy_deposit_file where " +
  306. "inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn} and status = '1' ")
  307. String selectDepositSumamt(@Param("patNo") String patNo,
  308. @Param("times") int times,
  309. @Param("ledgerSn") int ledgerSn);
  310. @Update("update zy_ledger_file set deposit=#{deposit}, balance=#{balance}, responce_type=#{restype}, " +
  311. "total_charge=#{map.total},charge1=#{map.001},charge2=#{map.002}, charge3=#{map.003},charge4=#{map.004}, " +
  312. "charge5=#{map.005},charge6=#{map.006},charge7=#{map.007}, charge8=#{map.008},charge9=#{map.009}, " +
  313. "charge10=#{map.010},charge11=#{map.011},charge12=#{map.012}, charge13=#{map.013},charge14=#{map.014}, " +
  314. "charge15=#{map.015},charge16=#{map.016},charge17=#{map.017}, charge18=#{map.018},charge19=#{map.019}, " +
  315. "charge20=#{map.020},charge21=#{map.021},charge22=#{map.022}, charge23=#{map.023},charge24=#{map.024}, " +
  316. "charge25=#{map.025},charge26=#{map.026},charge27=#{map.027}, charge28=#{map.028},charge29=0,charge30=0 " +
  317. "where inpatient_no=#{patNo} and admiss_times=#{times} and ledger_sn=#{ledgerSn}")
  318. void updateZyLedgerFileCharges(@Param("patNo") String patNo,
  319. @Param("times") int times,
  320. @Param("ledgerSn") int ledgerSn,
  321. @Param("deposit") String deposit,
  322. @Param("balance") String balance,
  323. @Param("restype") String restype,
  324. @Param("map") Map<String, String> map);
  325. @Update("update zy_actpatient set balance=#{balance},responce_type=#{restype}, total_charge=#{totalCost}, " +
  326. "charge1=#{map.001},charge2=#{map.002}, charge3=#{map.003},charge4=#{map.004},charge5=#{map.005}, " +
  327. "charge6=#{map.006},charge7=#{map.007}, charge8=#{map.008},charge9=#{map.009},charge10=#{map.010}, " +
  328. "charge11=#{map.011},charge12=#{map.012}, charge13=#{map.013},charge14=#{map.014},charge15=#{map.015}, " +
  329. "charge16=#{map.016},charge17=#{map.017}, charge18=#{map.018},charge19=#{map.019},charge20=#{map.020}, " +
  330. "charge21=#{map.021},charge22=#{map.022}, charge23=#{map.023},charge24=#{map.024},charge25=#{map.025}, " +
  331. "charge26=#{map.026},charge27=#{map.027}, charge28=#{map.028},charge29=0,charge30=0 where inpatient_no=#{patNo} ")
  332. void updateZyActpatientCharges(@Param("patNo") String patNo,
  333. @Param("totalCost") String totalCost,
  334. @Param("balance") String balance,
  335. @Param("restype") String restype,
  336. @Param("map") Map<String, String> map);
  337. @Select("select isnull(sum(charge_fee),0) from zy_detail_charge where inpatient_no=#{patNo} " +
  338. "and admiss_times=#{times} and ledger_sn>0 and isnull(charge_status,'1')!='1' ")
  339. String selectTotalCharge(@Param("patNo") String patNo,
  340. @Param("times") int times);
  341. }