CaseFrontSheetDao.java 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. package thyyxxk.webserver.dao.his.casefrontsheet;
  2. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  3. import org.apache.ibatis.annotations.*;
  4. import thyyxxk.webserver.entity.casefrontsheet.*;
  5. import java.util.Date;
  6. import java.util.List;
  7. /**
  8. * @author dj
  9. */
  10. @Mapper
  11. public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
  12. @Select("select " +
  13. "bedNo=rtrim(bed_no)," +
  14. "bah=rtrim(inpatient_no)," +
  15. "times=rtrim(admiss_times)," +
  16. "name=rtrim(name)," +
  17. "sex," +
  18. "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=refer_physician), " +
  19. "admiss_date " +
  20. "from zy_actpatient with(nolock) where (small_dept=#{ward} or ward=#{ward}) and " +
  21. "charindex('$',inpatient_no)=0 " +
  22. "ORDER BY cast(bed_no AS int)")
  23. List<SheetOverview> getPatientOverview(@Param("ward") String ward);
  24. @Select("select " +
  25. "bedNo=rtrim(bed_no)," +
  26. "bah=rtrim(inpatient_no)," +
  27. "times=rtrim(admiss_times)," +
  28. "name=rtrim(name)," +
  29. "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=refer_physician), " +
  30. "sex " +
  31. "from zy_inactpatient with(nolock) where " +
  32. "dis_date>=#{start} and dis_date<=#{end} and " +
  33. "(small_dept=#{ward} or ward=#{ward}) and " +
  34. "charindex('$',inpatient_no)=0 " +
  35. "ORDER BY cast(bed_no AS int)")
  36. List<SheetOverview> getOutPatients(GetOutSheet param);
  37. @Select("select " +
  38. "healthCardNo=rtrim(health_card_no), " +
  39. "bah=rtrim(inpatient_no), " +
  40. "name=rtrim(name), " +
  41. "sex=rtrim(sex), " +
  42. "birthDate=birth_date, " +
  43. "country=rtrim(country), " +
  44. "birthPlace=rtrim(birth_place)," +
  45. "birthPlaceName=(select rtrim(name) from zd_district_code with(nolock) where code=birth_place), " +
  46. "nation=rtrim(nation_code), " +
  47. "socialNo=rtrim(social_no), " +
  48. "occupation=rtrim(occupation_code), " +
  49. "marriage=rtrim(marry_code), " +
  50. "livePlace=rtrim(home_street), " +
  51. "phone=rtrim(home_tel), " +
  52. "addrZipCode=rtrim(home_zipcode), " +
  53. "hkZipCode=rtrim(account_zipcode), " +
  54. "unitName=rtrim(employer_name)," +
  55. "unitPlace=rtrim(employer_street)," +
  56. "unitPhone=rtrim(employer_tel), " +
  57. "unitZipCode=rtrim(employer_zipcode), " +
  58. "contactName=rtrim(relation_name), " +
  59. "contactRelation=rtrim(relation_code), " +
  60. "contactPhone=(rtrim(relation_tel)) " +
  61. "from a_patient_mi with(nolock) " +
  62. "where inpatient_no=#{bah}")
  63. CaseFrontsheetMain getAPatientMi(@Param("bah") String bah);
  64. @Select("select sum(charge12) surgeryFee,sum(charge1) westMedicineFee,sum(charge2) chineseHerbalMedicineFee, " +
  65. "sum(charge10) anesthetizeFee,sum(charge28) chinesePatentMedicineFee,sum(charge19) careFee, " +
  66. "sum(charge25) generalTreatmentOperatingFee, surgicalFee=(sum(charge10) + sum(charge12)) from " +
  67. "zy_ledger_file with(nolock) where inpatient_no=#{bah} and admiss_times=#{times}")
  68. CaseFrontsheetMain getZyLedgerFile(@Param("bah") String bah, @Param("times") int times);
  69. @Select("select " +
  70. "admissTimes=#{times}, " +
  71. "transDept=(select rtrim(name) from zd_unit_code with(nolock) where code=zk_ward)," +
  72. "dismissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=isnull(isnull(zk_dept,zk_ward),small_dept))," +
  73. "dismissWard=(select rtrim(name) from zd_unit_code with(nolock) where code=isnull(zk_ward,ward))," +
  74. "admiss_date, med_type=(select top 1 med_type from t_si_pat_info with(nolock) where pat_no=#{bah} and times=#{times} order by ledger_sn desc)," +
  75. "dismissDate=(select start_time from yz_act_order with(nolock) where inpatient_no=#{bah} " +
  76. "and admiss_times=#{times} and status_flag > '1' and isnull (group_no,'00')='00' " +
  77. "and order_code in ('06025','06026','06027','06053','05973')), " +
  78. "admissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=small_dept), " +
  79. "zk_ward zkWardCode, " +
  80. "admissWard=(select rtrim(name) from zd_unit_code with(nolock) where code=admiss_ward), " +
  81. "clinicDiagStr=rtrim(clinic_diag_str), " +
  82. "clinicDiagCode=rtrim(clinic_diag), " +
  83. "totalCost=total_charge, " +
  84. "selfPay=(select sum(total_charge) - sum(isnull(charge_yb,0)) from " +
  85. "zy_ledger_file with(nolock) where inpatient_no=#{bah} and admiss_times=#{times})," +
  86. "autopsy=rtrim(autopsy_mark)," +
  87. "hasSurgery=rtrim(operation)," +
  88. "diagConform1=rtrim(diagnose_conform1)," +
  89. "diagConform2=rtrim(diagnose_conform2)," +
  90. "diagConform3=rtrim(diagnose_conform3)," +
  91. "diagConform4=rtrim(diagnose_conform4)," +
  92. "diagConform5=rtrim(diagnose_conform5)," +
  93. "pathologicDiagStr=rtrim(pathology_diag_comment)," +
  94. "pathologicDiagCode=rtrim(pathology_diag)," +
  95. "fileStatus=isnull(file_status, 0), " +
  96. "lendFlag=isnull(lend_flag, 0), " +
  97. "balance=(select balance+charge_yb from zy_ledger_file with(nolock) where inpatient_no=#{bah} " +
  98. "and admiss_times=#{times} and ledger_sn=(select max(ledger_sn) from zy_ledger_file with(nolock) " +
  99. "where inpatient_no=#{bah} and admiss_times=#{times})) " +
  100. "from zy_actpatient with(nolock) where inpatient_no=#{bah}")
  101. CaseFrontsheetMain getZyActPatient(@Param("bah") String bah, @Param("times") int times);
  102. @Select("select top 1 serial_no from t_injury_si_pat_info with(nolock) where pat_no=#{patNo} and times=#{times} order by ledger_sn desc")
  103. String selectInjurySerialNo(@Param("patNo") String patNo,
  104. @Param("times") Integer times);
  105. @Select("select [dbo].[judge_infant](#{bah}, #{times})")
  106. int getInfant(@Param("bah") String bah, @Param("times") int times);
  107. @Select("select start_time from yz_inact_order with(nolock) where inpatient_no=#{bah} " +
  108. "and admiss_times=#{times} and status_flag > '1' and isnull (group_no,'00')='00' " +
  109. "and order_code in ('06025','06026','06027','06053','05973')")
  110. Date getDismissDateFromYzInActOrder(@Param("bah") String bah, @Param("times") int times);
  111. @Select("select " +
  112. "admissTimes=#{times}, " +
  113. "transDept=(select rtrim(name) from zd_unit_code with(nolock) where code=zk_ward)," +
  114. "dismissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=isnull(isnull(zk_dept,zk_ward),small_dept))," +
  115. "dismissWard=(select rtrim(name) from zd_unit_code with(nolock) where code=isnull(zk_ward,ward))," +
  116. "admiss_date, med_type=(select top 1 med_type from t_si_pat_info with(nolock) where pat_no=#{bah} and times=#{times} order by ledger_sn desc), " +
  117. "dismissDate=(select start_time from yz_inact_order with(nolock) where inpatient_no=#{bah} " +
  118. "and admiss_times=#{times} and status_flag > '1' and isnull (group_no,'00')='00' " +
  119. "and order_code in ('06025','06026','06027','06053','05973')), " +
  120. "admissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=small_dept), " +
  121. "admissWard=(select rtrim(name) from zd_unit_code with(nolock) where code=admiss_ward), " +
  122. "clinicDiagStr=rtrim(clinic_diag_str), " +
  123. "clinicDiagCode=rtrim(clinic_diag), " +
  124. "totalCost=total_charge, " +
  125. "selfPay=(select sum(last_balance) from zy_ledger_file with(nolock) where inpatient_no=#{bah} and admiss_times=#{times})," +
  126. "autopsy=rtrim(autopsy_mark)," +
  127. "hasSurgery=rtrim(operation)," +
  128. "diagConform1=rtrim(diagnose_conform1)," +
  129. "diagConform2=rtrim(diagnose_conform2)," +
  130. "diagConform3=rtrim(diagnose_conform3)," +
  131. "diagConform4=rtrim(diagnose_conform4)," +
  132. "diagConform5=rtrim(diagnose_conform5)," +
  133. "pathologicDiagStr=rtrim(pathology_diag_comment)," +
  134. "pathologicDiagCode=rtrim(pathology_diag)," +
  135. "lendFlag=isnull(lend_flag, 0), " +
  136. "fileStatus=isnull(file_status, 0) " +
  137. "from zy_inactpatient with(nolock) where inpatient_no=#{bah} and admiss_times=#{times}")
  138. CaseFrontsheetMain getZyInActPatient(@Param("bah") String bah, @Param("times") int times);
  139. @Select("select start_time from yz_act_order with(nolock) where inpatient_no=#{bah} " +
  140. "and admiss_times=#{times} and status_flag > '1' and isnull (group_no,'00')='00' " +
  141. "and order_code in ('06025','06026','06027','06053','05973')")
  142. Date getDismissDateFromYzActOrder(@Param("bah") String bah, @Param("times") int times);
  143. @Select("select " +
  144. "payMethod=rtrim(pay_method)," +
  145. "ageDays=rtrim(age_days)," +
  146. "newBornWeight=rtrim(new_born_weight)," +
  147. "newBornAdmissWeight=rtrim(new_born_admiss_weight)," +
  148. "zyAdmissWay=rtrim(rytj)," +
  149. "nativePlace=rtrim(jg)," +
  150. "nativePlaceName=(select rtrim(name) from zd_district_code with(nolock) where code=jg)," +
  151. "hkPlace=rtrim(hkdz)," +
  152. "hkPlaceName=rtrim(hkdz2)," +
  153. "contactAddr=rtrim(lxdz)," +
  154. "contactAddrName=rtrim(lxdz2)," +
  155. "hkZipCode=rtrim(hkyb) " +
  156. "from batj_ba1 with(nolock) where bah=#{bah} and zycs=#{times}")
  157. CaseFrontsheetMain getBatjBa1(@Param("bah") String bah, @Param("times") int times);
  158. @Select("select " +
  159. "blh=rtrim(a.blzd_qph)," +
  160. "allergy=rtrim(a.gm_flag)," +
  161. "allergicMedicine=rtrim(a.gmwy)," +
  162. "hbsAg=rtrim(a.hbsag)," +
  163. "hcvAb=rtrim(a.hcv_vb)," +
  164. "hivAb=rtrim(a.hiv_vb)," +
  165. "tpAb=rtrim(a.tp_ab)," +
  166. "bloodType=rtrim(a.xx)," +
  167. "rh=rtrim(a.xx_rh)," +
  168. "deptLeader=rtrim(isnull(kzr, b.dept_director))," +
  169. "deptLeaderName=(select rtrim(name) from a_employee_mi with(nolock) where code=(isnull(kzr, b.dept_director)))," +
  170. "leaderDoctor=rtrim(isnull(zrys, b.dept_director))," +
  171. "leaderDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=(isnull(zrys, b.dept_director)))," +
  172. "mainDoctor=rtrim(isnull(zzys, b.consult_physician))," +
  173. "mainDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=(isnull(zzys, b.consult_physician)))," +
  174. "admissDoctor=rtrim(isnull(zyys, b.refer_physician))," +
  175. "admissDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=isnull(zyys, b.refer_physician))," +
  176. "dutyNurse=rtrim(a.job_nurse)," +
  177. "dutyNurseName=(select rtrim(name) from a_employee_mi with(nolock) where code=a.job_nurse)," +
  178. "studyDoctor=rtrim(a.jxys)," +
  179. "studyDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=jxys)," +
  180. "internshipDoctor=rtrim(a.sxys)," +
  181. "internshipDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=sxys)," +
  182. "coder=rtrim(a.bmy)," +
  183. "coderName=(select rtrim(name) from a_employee_mi with(nolock) where code=bmy)," +
  184. "qualityControlLevel=rtrim(a.bazl)," +
  185. "qualityControlDoctor=rtrim(a.zkys)," +
  186. "qualityControlDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=zkys)," +
  187. "qualityControlNurse=rtrim(a.zkhs)," +
  188. "qualityControlNurseName=(select rtrim(name) from a_employee_mi with(nolock) where code=zkhs)," +
  189. "qualityControlDate=a.barq," +
  190. "zyDismissWay=rtrim(a.lyfs)," +
  191. "dismissDestination=rtrim(a.jsjg)," +
  192. "admissAgainInOneMonth=rtrim(a.zzy_flag)," +
  193. "admissAgainPurpose=rtrim(a.zzy_md)," +
  194. "comaDaysBeforeAdmiss=rtrim(a.ryq_hmsj_day)," +
  195. "comaHoursBeforeAdmiss=rtrim(a.ryq_hmsj_hour)," +
  196. "comaMinutesBeforeAdmiss=rtrim(a.ryq_hmsj_min)," +
  197. "comaDaysAfterAdmiss=rtrim(a.ryh_hmsj_day)," +
  198. "comaHoursAfterAdmiss=rtrim(a.ryh_hmsj_hour)," +
  199. "comaMinutesAfterAdmiss=rtrim(a.ryh_hmsj_min)," +
  200. "rescueTimes=rtrim(a.qjcs)," +
  201. "rescueSuccessTimes=rtrim(a.cgcs)," +
  202. "caseClassification=rtrim(a.blfx)," +
  203. "hasIcu=rtrim(a.zzjh)," +
  204. "icuDays=rtrim(a.zzjh_day)," +
  205. "icuHours=rtrim(a.zzjh_hour)," +
  206. "monopathyManagement=rtrim(a.dbz)," +
  207. "clinicalPathwayManagement=rtrim(a.lclj)," +
  208. "drgsManagement=rtrim(a.drgs)," +
  209. "useAntibiotic=rtrim(a.kss)," +
  210. "bacilliculture=rtrim(a.xjpy)," +
  211. "statutoryEpidemic=rtrim(a.fdcrb)," +
  212. "hurtReasonName=rtrim(a.hurt_reason_name)," +
  213. "hurtReasonCode=rtrim(a.hurt_reason_code)," +
  214. "tumorLevelT=rtrim(a.tumor_level_t)," +
  215. "tumorLevelN=rtrim(a.tumor_level_n)," +
  216. "tumorLevelM=rtrim(a.tumor_level_m)," +
  217. "xxeApgar=rtrim(a.apgar) " +
  218. "from batj_ba2 a with(nolock), zy_actpatient b with(nolock) where " +
  219. "b.inpatient_no=a.bah and " +
  220. "a.bah=#{bah} and a.zycs=#{times}")
  221. CaseFrontsheetMain getBatjBa2ForInPatient(@Param("bah") String bah, @Param("times") int times);
  222. @Select("select " +
  223. "late_flag lateFlag, " +
  224. "signDate=(convert(varchar(19), sign_date, 21)), " +
  225. "blh=rtrim(a.blzd_qph)," +
  226. "allergy=rtrim(a.gm_flag)," +
  227. "allergicMedicine=rtrim(a.gmwy)," +
  228. "hbsAg=rtrim(a.hbsag)," +
  229. "hcvAb=rtrim(a.hcv_vb)," +
  230. "hivAb=rtrim(a.hiv_vb)," +
  231. "tpAb=rtrim(a.tp_ab)," +
  232. "bloodType=rtrim(a.xx)," +
  233. "rh=rtrim(a.xx_rh)," +
  234. "deptLeader=rtrim(isnull(kzr, b.dept_director))," +
  235. "deptLeaderName=(select rtrim(name) from a_employee_mi with(nolock) where code=(isnull(kzr, b.dept_director)))," +
  236. "leaderDoctor=rtrim(isnull(zrys, b.dept_director))," +
  237. "leaderDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=(isnull(zrys, b.dept_director)))," +
  238. "mainDoctor=rtrim(isnull(zzys, b.consult_physician))," +
  239. "mainDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=(isnull(zzys, b.consult_physician)))," +
  240. "admissDoctor=rtrim(isnull(zyys, b.refer_physician))," +
  241. "admissDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=isnull(zyys, b.refer_physician))," +
  242. "dutyNurse=rtrim(a.job_nurse)," +
  243. "dutyNurseName=(select rtrim(name) from a_employee_mi with(nolock) where code=a.job_nurse)," +
  244. "studyDoctor=rtrim(a.jxys)," +
  245. "studyDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=jxys)," +
  246. "internshipDoctor=rtrim(a.sxys)," +
  247. "internshipDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=sxys)," +
  248. "coder=rtrim(a.bmy)," +
  249. "coderName=(select rtrim(name) from a_employee_mi with(nolock) where code=bmy)," +
  250. "qualityControlLevel=rtrim(a.bazl)," +
  251. "qualityControlDoctor=rtrim(a.zkys)," +
  252. "qualityControlDoctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=zkys)," +
  253. "qualityControlNurse=rtrim(a.zkhs)," +
  254. "qualityControlNurseName=(select rtrim(name) from a_employee_mi with(nolock) where code=zkhs)," +
  255. "qualityControlDate=a.barq," +
  256. "zyDismissWay=rtrim(a.lyfs)," +
  257. "dismissDestination=rtrim(a.jsjg)," +
  258. "admissAgainInOneMonth=rtrim(a.zzy_flag)," +
  259. "admissAgainPurpose=rtrim(a.zzy_md)," +
  260. "comaDaysBeforeAdmiss=rtrim(a.ryq_hmsj_day)," +
  261. "comaHoursBeforeAdmiss=rtrim(a.ryq_hmsj_hour)," +
  262. "comaMinutesBeforeAdmiss=rtrim(a.ryq_hmsj_min)," +
  263. "comaDaysAfterAdmiss=rtrim(a.ryh_hmsj_day)," +
  264. "comaHoursAfterAdmiss=rtrim(a.ryh_hmsj_hour)," +
  265. "comaMinutesAfterAdmiss=rtrim(a.ryh_hmsj_min)," +
  266. "rescueTimes=rtrim(a.qjcs)," +
  267. "rescueSuccessTimes=rtrim(a.cgcs)," +
  268. "caseClassification=rtrim(a.blfx)," +
  269. "hasIcu=rtrim(a.zzjh)," +
  270. "icuDays=rtrim(a.zzjh_day)," +
  271. "icuHours=rtrim(a.zzjh_hour)," +
  272. "monopathyManagement=rtrim(a.dbz)," +
  273. "clinicalPathwayManagement=rtrim(a.lclj)," +
  274. "drgsManagement=rtrim(a.drgs)," +
  275. "useAntibiotic=rtrim(a.kss)," +
  276. "bacilliculture=rtrim(a.xjpy)," +
  277. "statutoryEpidemic=rtrim(a.fdcrb)," +
  278. "hurtReasonName=rtrim(a.hurt_reason_name)," +
  279. "hurtReasonCode=rtrim(a.hurt_reason_code)," +
  280. "tumorLevelT=rtrim(a.tumor_level_t)," +
  281. "tumorLevelN=rtrim(a.tumor_level_n)," +
  282. "tumorLevelM=rtrim(a.tumor_level_m)," +
  283. "xxeApgar=rtrim(a.apgar) " +
  284. "from batj_ba2 a with(nolock), zy_inactpatient b with(nolock) where " +
  285. "b.inpatient_no=a.bah and b.admiss_times=a.zycs and " +
  286. "a.bah=#{bah} and a.zycs=#{times}")
  287. CaseFrontsheetMain getBatjBa2ForOutPatient(@Param("bah") String bah, @Param("times") int times);
  288. @Select("select no=rtrim(dis_diag_no), name=rtrim(dis_diag_comment), " +
  289. "code=rtrim(dis_diag), admissStatus=rtrim(admiss_status), " +
  290. "dismissStatus=rtrim(dis_diag_status) from ba_first_page1 with(nolock) " +
  291. "where inpatient_no=#{bah} and admiss_times=#{times}")
  292. List<CaseFrontsheetDisdiag> getDisdiags(@Param("bah") String bah, @Param("times") int times);
  293. @Select("select no=rtrim(ssxh)," +
  294. "name=rtrim(ssmc)," +
  295. "date=ssrq," +
  296. "level=rtrim(ssjb)," +
  297. "code=rtrim(ssbm)," +
  298. "operator=rtrim(ssys)," +
  299. "operatorName=(select rtrim(name) from a_employee_mi with(nolock) where code=ssys)," +
  300. "assistantOne=rtrim(sszs1)," +
  301. "assistantOneName=(select rtrim(name) from a_employee_mi with(nolock) where code=sszs1)," +
  302. "assistantTwo=rtrim(sszs2)," +
  303. "assistantTwoName=(select rtrim(name) from a_employee_mi with(nolock) where code=sszs2)," +
  304. "cut=rtrim(qkjb), " +
  305. "heal=rtrim(yhqk), " +
  306. "anaesthesia=rtrim(mzff)," +
  307. "anaesthesiaor=rtrim(mzys), " +
  308. "anaesthesiaorName=(select rtrim(name) from a_employee_mi with(nolock) where code=mzys) " +
  309. "from batj_ba4 with(nolock) " +
  310. "where bah=#{bah} and zycs=#{times}")
  311. List<CaseFrontsheetSurgery> getSurgeries(@Param("bah") String bah, @Param("times") int times);
  312. @Select("select (select count(*) from yz_act_order with(nolock) where order_code in ('06026','06053','06027') " +
  313. "and inpatient_no=#{bah} and admiss_times=#{times}) + " +
  314. "(select count(*) from yz_inact_order with(nolock) where order_code in ('06026','06053','06027') and " +
  315. "inpatient_no=#{bah} and admiss_times=#{times})")
  316. int getDismissOrder(@Param("bah") String bah, @Param("times") int times);
  317. @Select("select (select count(*) from yz_act_order with(nolock) where order_code='05973' and inpatient_no=#{bah} " +
  318. "and admiss_times=#{times}) + (select count(*) from yz_inact_order with(nolock) where order_code='05973' " +
  319. "and inpatient_no=#{bah} and admiss_times=#{times})")
  320. int getDeathOrder(@Param("bah") String bah, @Param("times") int times);
  321. @Update("update a_patient_mi set name=#{name}, " +
  322. "sex=#{sex}, " +
  323. "health_card_no=#{healthCardNo}," +
  324. "birth_date=#{birthDate}, " +
  325. "country=#{country}, " +
  326. "birth_place=#{birthPlace}, " +
  327. "nation_code=#{nation}, " +
  328. "social_no=#{socialNo}, " +
  329. "occupation_code=#{occupation}, " +
  330. "marry_code=#{marriage}, " +
  331. "home_street=#{livePlace}, " + // max 32 char
  332. "home_tel=#{phone}, " +
  333. "home_zipcode=#{addrZipCode}, " +
  334. "account_street=#{hkPlaceName}, " + // max 20 char
  335. "account_zipcode=#{hkZipCode}, " +
  336. "employer_name=#{unitName}, " +
  337. "employer_street=#{unitPlace}, " + // max 32 char
  338. "employer_tel=#{unitPhone}, " +
  339. "employer_zipcode=#{unitZipCode}, " +
  340. "relation_name=#{contactName}, " +
  341. "relation_code=#{contactRelation}, " +
  342. "relation_street=#{contactAddrName}, " + // max 32 char
  343. "relation_tel=#{contactPhone} " +
  344. "where inpatient_no=#{bah}")
  345. void updateAPatientMi(CaseFrontsheetMain sheet);
  346. @Update("update zy_actpatient set autopsy_mark=#{autopsy},clinic_diag_str=#{clinicDiagStr}, " +
  347. "diagnose_conform1=#{dc1},diagnose_conform2=#{dc2},diagnose_conform3=#{dc3}," +
  348. "diagnose_conform4=#{dc4}, diagnose_conform5=#{dc5}, operation=#{hasSurgery}," +
  349. "pathology_diag_comment=#{pathologicDiagStr},pathology_diag=#{pathologicDiagCode}, " +
  350. "clinic_diag=#{clinicDiagCode} where inpatient_no=#{bah} and admiss_times=#{times}")
  351. void updateZyActPatient(@Param("bah") String bah, @Param("times") int times,
  352. @Param("autopsy") String autopsy,
  353. @Param("dc1") String dc1, @Param("dc2") String dc2,
  354. @Param("dc3") String dc3, @Param("dc4") String dc4,
  355. @Param("dc5") String dc5, @Param("hasSurgery") String hasSurgery,
  356. @Param("pathologicDiagStr") String pathologicDiagStr,
  357. @Param("pathologicDiagCode") String pathologicDiagCode,
  358. @Param("clinicDiagCode") String clinicDiagCode,
  359. @Param("clinicDiagStr") String clinicDiagStr);
  360. @Update("update zy_inactpatient set autopsy_mark=#{autopsy},clinic_diag_str=#{clinicDiagStr}, " +
  361. "diagnose_conform1=#{dc1},diagnose_conform2=#{dc2},diagnose_conform3=#{dc3}," +
  362. "diagnose_conform4=#{dc4}, diagnose_conform5=#{dc5}, operation=#{hasSurgery}," +
  363. "pathology_diag_comment=#{pathologicDiagStr},pathology_diag=#{pathologicDiagCode}, " +
  364. "clinic_diag=#{clinicDiagCode} where inpatient_no=#{bah} and admiss_times=#{times}")
  365. void updateZyInActPatient(@Param("bah") String bah, @Param("times") int times,
  366. @Param("autopsy") String autopsy,
  367. @Param("dc1") String dc1, @Param("dc2") String dc2,
  368. @Param("dc3") String dc3, @Param("dc4") String dc4,
  369. @Param("dc5") String dc5, @Param("hasSurgery") String hasSurgery,
  370. @Param("pathologicDiagStr") String pathologicDiagStr,
  371. @Param("pathologicDiagCode") String pathologicDiagCode,
  372. @Param("clinicDiagCode") String clinicDiagCode,
  373. @Param("clinicDiagStr") String clinicDiagStr);
  374. @Select("select count(*) from batj_ba1 with(nolock) where bah=#{bah} and zycs=#{times}")
  375. int isBatjBa1Exist(@Param("bah") String bah, @Param("times") int times);
  376. @Select("select count(*) from batj_ba2 with(nolock) where bah=#{bah} and zycs=#{times}")
  377. int isBatjBa2Exist(@Param("bah") String bah, @Param("times") int times);
  378. @Insert("insert into batj_ba1 (bah, zyh, zycs, xm, ryrq, ryks, rybf) values " +
  379. "(#{bah}, #{bah}, #{times}, #{name}, #{ryrq}, " +
  380. "(select code from zd_unit_code with(nolock) where name=#{dept}), " +
  381. "(select code from zd_unit_code with(nolock) where name=#{ward}))")
  382. void createBatjBa1(@Param("bah") String bah, @Param("times") int times,
  383. @Param("name") String name, @Param("ryrq") Date ryrq,
  384. @Param("dept") String dept, @Param("ward") String ward);
  385. @Insert("insert into batj_ba2 (bah, zyh, zycs) values (#{bah}, #{bah}, #{times})")
  386. void createBatjBa2(@Param("bah") String bah, @Param("times") int times);
  387. @Update("update batj_ba1 set " +
  388. "pay_method=#{payMethod}," +
  389. "age_days=#{ageDays}," +
  390. "jg=#{nativePlace}," +
  391. "new_born_weight=#{newBornWeight}," +
  392. "new_born_admiss_weight=#{newBornAdmissWeight}," +
  393. "xm=#{name}, " +
  394. "xb=#{sex}, " +
  395. "csrq=#{birthDate}, " +
  396. "hyzk=#{marriage}, " +
  397. "zy=#{occupation}, " +
  398. "csd=#{birthPlace}, " +
  399. "mz=#{nation}, " +
  400. "gj=#{country}, " +
  401. "sfzh=#{socialNo}, " +
  402. "gzdw=#{unitName}, " +
  403. "gzdh=#{unitPhone}, " +
  404. "gzyb=#{unitZipCode}, " +
  405. "hkdz=#{hkPlace}, " +
  406. "hkdz2=#{hkPlaceName}," +
  407. "hkyb=#{hkZipCode}, " +
  408. "lxr=#{contactName}, " +
  409. "lxrgx=#{contactRelation}, " +
  410. "lxdh=#{contactPhone}, " +
  411. "lxdz=#{contactAddr}, " +
  412. "lxdz2=#{contactAddrName}," +
  413. "rytj=#{zyAdmissWay}, " +
  414. "xzz=#{livePlace}, " +
  415. "xdh=#{phone} " +
  416. "where bah=#{bah} and zycs=#{admissTimes}")
  417. void updateBatjBa1(CaseFrontsheetMain info);
  418. @Update("update batj_ba2 set " +
  419. "blzd_qph=#{blh}," +
  420. "gm_flag=#{allergy}," +
  421. "gmwy=#{allergicMedicine}," +
  422. "hbsag=#{hbsAg}," +
  423. "hcv_vb=#{hcvAb}," +
  424. "hiv_vb=#{hivAb}," +
  425. "tp_ab=#{tpAb}," +
  426. "xx=#{bloodType}," +
  427. "xx_rh=#{rh}," +
  428. "kzr=#{deptLeader}," +
  429. "zrys=#{leaderDoctor}," +
  430. "zzys=#{mainDoctor}," +
  431. "zyys=#{admissDoctor}," +
  432. "job_nurse=#{dutyNurse}," +
  433. "jxys=#{studyDoctor}," +
  434. "sxys=#{internshipDoctor}," +
  435. "bmy=#{coder}," +
  436. "bazl=#{qualityControlLevel}," +
  437. "zkys=#{qualityControlDoctor}," +
  438. "zkhs=#{qualityControlNurse}," +
  439. "barq=#{qualityControlDate}," +
  440. "lyfs=#{zyDismissWay}," +
  441. "jsjg=#{dismissDestination}," +
  442. "zzy_flag=#{admissAgainInOneMonth}," +
  443. "zzy_md=#{admissAgainPurpose}," +
  444. "ryq_hmsj=#{comaDaysBeforeAdmiss}," +
  445. "ryh_hmsj=#{comaDaysAfterAdmiss}," +
  446. "qjcs=#{rescueTimes}," +
  447. "cgcs=#{rescueSuccessTimes}," +
  448. "blfx=#{caseClassification}," +
  449. "zzjh=#{hasIcu}," +
  450. "zzjh_day=#{icuDays}," +
  451. "zzjh_hour=#{icuHours}," +
  452. "dbz=#{monopathyManagement}," +
  453. "lclj=#{clinicalPathwayManagement}," +
  454. "drgs=#{drgsManagement}," +
  455. "kss=#{useAntibiotic}," +
  456. "xjpy=#{bacilliculture}," +
  457. "fdcrb=#{statutoryEpidemic}," +
  458. "hurt_reason_name=#{hurtReasonName}," +
  459. "hurt_reason_code=#{hurtReasonCode}," +
  460. "tumor_level_t=#{tumorLevelT}," +
  461. "tumor_level_n=#{tumorLevelN}," +
  462. "tumor_level_m=#{tumorLevelM}," +
  463. "apgar=#{xxeApgar} " +
  464. "where bah=#{bah} and zycs=#{admissTimes}")
  465. void updateBatjBa2(CaseFrontsheetMain info);
  466. @Delete("delete from ba_first_page1 where inpatient_no=#{bah} and admiss_times=#{times}")
  467. void deleteOldDisdiag(@Param("bah") String bah, @Param("times") int times);
  468. @Delete("delete from batj_ba4 where bah=#{bah} and zycs=#{times}")
  469. void deleteOldSurgeryRecord(@Param("bah") String bah, @Param("times") int times);
  470. @Insert("insert into ba_first_page1 (inpatient_no, admiss_times, dis_diag_no," +
  471. "dis_diag_comment, dis_diag, admiss_status, dis_diag_status, op_id_code) " +
  472. "values (#{bah}, #{times}, #{no}, #{name}, #{code}, #{admissStatus}, " +
  473. "#{dismissStatus}, #{opIdCode})")
  474. void writeNewDisdiag(CaseFrontsheetDisdiag disDiag);
  475. @Insert("insert into batj_ba4 (bah, zyh, zycs, ssxh, ssmc, ssrq, ssjb,ssbm," +
  476. "ssys, sszs1, sszs2, qkjb, yhqk, mzff, mzys) " +
  477. "values (#{bah}, #{bah}, #{times}, #{no}, #{name}, #{date}, #{level}," +
  478. " #{code}, #{operator}, #{assistantOne}, #{assistantTwo}, #{cut}, #{heal}, " +
  479. "#{anaesthesia}, #{anaesthesiaor})")
  480. void writeNewZySurgeryRecord(CaseFrontsheetSurgery surgery);
  481. @Update("update zy_actpatient set file_status=#{status} where inpatient_no=#{bah} and " +
  482. "admiss_times=#{times}")
  483. void updateZyFileStatus(@Param("status") int status, @Param("bah") String bah, @Param("times") int times);
  484. @Update("update zy_inactpatient set file_status=#{status} where inpatient_no=#{bah} and " +
  485. "admiss_times=#{times}")
  486. void updateZyInFileStatus(@Param("status") int status, @Param("bah") String bah, @Param("times") int times);
  487. @Update("update batj_ba2 set late_flag=#{flag}, sign_date=getdate() where zyh=#{bah} and zycs=#{times}")
  488. void updateLateSubmitFlag(@Param("flag") int flag, @Param("bah") String bah, @Param("times") int times);
  489. @Update("update batj_ba2 set sign_date=null where zyh=#{bah} and zycs=#{times}")
  490. void clearSignDate(@Param("bah") String bah, @Param("times") int times);
  491. @Insert("insert into ba_op_log (op_type, op_id, op_time, inpatient_no, admiss_times) values " +
  492. "(#{opType}, #{staffId}, getDate(), #{bah}, #{admissTimes})")
  493. void writeBaOpLog(@Param("opType") int opType,
  494. @Param("staffId") String staffId,
  495. @Param("bah") String bah,
  496. @Param("admissTimes") int admissTimes);
  497. @Select("select rtrim(dis_diag_no) no, rtrim(dis_diag) code, " +
  498. "rtrim(dis_diag_comment) name, rtrim(dis_diag_status) cyzg, " +
  499. "rtrim(op_id_code) operId, convert(varchar(19), op_diag_date, 21) opDate, " +
  500. "diagType='13', bzfx='普通', admiss_cond " +
  501. "from zy_dis_diag_yb with(nolock) where inpatient_no=#{bah} and admiss_times=#{times}")
  502. List<YiBaoDisdiag> getYbDiags(@Param("bah") String bah, @Param("times") int times);
  503. @Delete("delete from zy_dis_diag_yb where inpatient_no=#{bah} and admiss_times=#{times}")
  504. void deleteOldYbDiag(@Param("bah") String bah, @Param("times") int times);
  505. @Insert("insert into zy_dis_diag_yb (inpatient_no, admiss_times, dis_diag_no, dis_diag_type, dis_diag, " +
  506. "dis_diag_comment, op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, si_diag_type, admiss_cond) " +
  507. "values (#{bah},#{times},#{no},13,#{code},#{name},#{operId},#{opDate},'普通',#{cyzg},#{siDiagType},#{admissCond}) ")
  508. void insertNewYbDiag(YiBaoDisdiag diag);
  509. @Update("update zy_actpatient set lend_flag=1 where inpatient_no=#{bah} " +
  510. "and admiss_times=#{times}")
  511. void lendZyOut(@Param("bah") String bah, @Param("times") int times);
  512. @Update("update zy_inactpatient set lend_flag=1 where inpatient_no=#{bah} " +
  513. "and admiss_times=#{times}")
  514. void lendZyInOut(@Param("bah") String bah, @Param("times") int times);
  515. @Insert("insert into ba_op_log (op_type, op_id, op_time, inpatient_no, " +
  516. "admiss_times, borrow_id, borrow_date) values (5, #{staffId}, getDate(), #{bah}, " +
  517. "#{admissTimes}, #{borrowId}, #{borrowDate})")
  518. void writeLendOutLog(@Param("staffId") String staffId,
  519. @Param("bah") String bah,
  520. @Param("admissTimes") int admissTimes,
  521. @Param("borrowId") String borrowId,
  522. @Param("borrowDate") Date borrowDate);
  523. @Update("update zy_actpatient set lend_flag=2 where inpatient_no=#{bah} " +
  524. "and admiss_times=#{times}")
  525. void lendZyBack(@Param("bah") String bah, @Param("times") int times);
  526. @Update("update zy_inactpatient set lend_flag=2 where inpatient_no=#{bah} " +
  527. "and admiss_times=#{times}")
  528. void lendZyInBack(@Param("bah") String bah, @Param("times") int times);
  529. @Insert("insert into ba_op_log (op_type, op_id, op_time, inpatient_no, " +
  530. "admiss_times, borrow_id, borrow_date) values (6, #{staffId}, getDate(), #{bah}, " +
  531. "#{admissTimes}, #{borrowId}, #{borrowDate})")
  532. void writeLendBackLog(@Param("staffId") String staffId,
  533. @Param("bah") String bah,
  534. @Param("admissTimes") int admissTimes,
  535. @Param("borrowId") String borrowId,
  536. @Param("borrowDate") Date borrowDate);
  537. @Select("select top 1 borrow_id, " +
  538. "borrow_name=(select rtrim(name) from a_employee_mi with(nolock) where code=borrow_id), " +
  539. "borrow_date from ba_op_log with(nolock) where op_type=5 and inpatient_no=#{bah} and admiss_times=#{times} " +
  540. "order by borrow_date desc")
  541. BorrowBase getBorrowInfo(@Param("bah") String bah, @Param("times") int times);
  542. @Select("select count(*) from zy_inactpatient a with(nolock), batj_ba2 b with(nolock) " +
  543. "where (dis_dept=#{ward} or dis_ward=#{ward}) and " +
  544. "b.bah=a.inpatient_no and " +
  545. "b.zycs=a.admiss_times and " +
  546. "b.blfx>2")
  547. Integer getCDBlfxCount(@Param("ward") String ward);
  548. @Select("select count(*) from zy_inactpatient with(nolock) where dis_dept=#{ward} or dis_ward=#{ward}")
  549. Integer getAllDisPatientCount(@Param("ward") String ward);
  550. @Select("select " +
  551. "rtrim(a.inpatient_no) bah, " +
  552. "a.admiss_times times, " +
  553. "rtrim(a.name) name, " +
  554. "a.sex, " +
  555. "admissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=a.admiss_dept), " +
  556. "dismissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=a.dis_dept), " +
  557. "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=b.zyys), " +
  558. "signDate=(convert(varchar(10), b.sign_date, 21)), " +
  559. "rtrim(b.blfx) blfx, " +
  560. "a.dis_date," +
  561. "inDays=(select datediff(day, a.admiss_date, a.dis_date)), " +
  562. "a.total_charge totalCost " +
  563. "from zy_inactpatient a with(nolock), batj_ba2 b with(nolock) " +
  564. "where " +
  565. "b.zyh=a.inpatient_no and " +
  566. "b.zycs=a.admiss_times and " +
  567. "a.dis_date>=#{start} and " +
  568. "a.dis_date<=#{end} and " +
  569. "(a.refer_physician like #{doctorCode} or b.zyys like #{doctorCode}) and " +
  570. "a.sex like #{sex}")
  571. List<SheetOverview> pureAdvanceSearch(AdvanceSearchParam param);
  572. @Select("select " +
  573. "rtrim(a.inpatient_no) bah, " +
  574. "a.admiss_times times, " +
  575. "rtrim(a.name) name, " +
  576. "a.sex, " +
  577. "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=b.zyys), " +
  578. "signDate=(convert(varchar(10), b.sign_date, 21)), " +
  579. "a.dis_date," +
  580. "admissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=a.admiss_dept), " +
  581. "dismissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=a.dis_dept), " +
  582. "rtrim(b.blfx) blfx, " +
  583. "inDays=(select datediff(day, a.admiss_date, a.dis_date)), " +
  584. "a.total_charge totalCost " +
  585. "from zy_inactpatient a with(nolock), batj_ba2 b with(nolock), ba_first_page1 c with(nolock), batj_ba4 d with(nolock) " +
  586. "where " +
  587. "b.zyh=a.inpatient_no and " +
  588. "b.zycs=a.admiss_times and " +
  589. "a.dis_date>=#{start} and " +
  590. "a.dis_date<=#{end} and " +
  591. "(a.refer_physician like #{doctorCode} or b.zyys like #{doctorCode}) and " +
  592. "a.sex like #{sex} and " +
  593. "c.inpatient_no=a.inpatient_no and " +
  594. "c.admiss_times=a.admiss_times and " +
  595. "c.dis_diag like #{icdCode} and " +
  596. "d.zyh=a.inpatient_no and " +
  597. "d.zycs=a.admiss_times and " +
  598. "d.ssbm like #{surgeryCode}")
  599. List<SheetOverview> maxAdvanceSearch(AdvanceSearchParam param);
  600. @Select("select " +
  601. "rtrim(a.inpatient_no) bah, " +
  602. "a.admiss_times times, " +
  603. "rtrim(a.name) name, " +
  604. "a.sex, " +
  605. "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=b.zyys), " +
  606. "signDate=(convert(varchar(10), b.sign_date, 21)), " +
  607. "a.dis_date," +
  608. "admissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=a.admiss_dept), " +
  609. "dismissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=a.dis_dept), " +
  610. "rtrim(b.blfx) blfx, " +
  611. "inDays=(select datediff(day, a.admiss_date, a.dis_date)), " +
  612. "a.total_charge totalCost " +
  613. "from zy_inactpatient a with(nolock), batj_ba2 b with(nolock), ba_first_page1 c with(nolock) " +
  614. "where " +
  615. "b.zyh=a.inpatient_no and " +
  616. "b.zycs=a.admiss_times and " +
  617. "a.dis_date>=#{start} and " +
  618. "a.dis_date<=#{end} and " +
  619. "(a.refer_physician like #{doctorCode} or b.zyys like #{doctorCode}) and " +
  620. "a.sex like #{sex} and " +
  621. "c.inpatient_no=a.inpatient_no and " +
  622. "c.admiss_times=a.admiss_times and " +
  623. "c.dis_diag like #{icdCode}")
  624. List<SheetOverview> advanceSearchWithIcd(AdvanceSearchParam param);
  625. @Select("select " +
  626. "rtrim(a.inpatient_no) bah, " +
  627. "a.admiss_times times, " +
  628. "rtrim(a.name) name, " +
  629. "a.dis_date," +
  630. "a.sex, " +
  631. "doctorName=(select rtrim(name) from a_employee_mi with(nolock) where code=b.zyys), " +
  632. "signDate=(convert(varchar(10), b.sign_date, 21)), " +
  633. "admissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=a.admiss_dept), " +
  634. "dismissDept=(select rtrim(name) from zd_unit_code with(nolock) where code=a.dis_dept), " +
  635. "rtrim(b.blfx) blfx, " +
  636. "inDays=(select datediff(day, a.admiss_date, a.dis_date)), " +
  637. "a.total_charge totalCost " +
  638. "from zy_inactpatient a with(nolock), batj_ba2 b with(nolock), batj_ba4 d with(nolock) " +
  639. "where " +
  640. "b.zyh=a.inpatient_no and " +
  641. "b.zycs=a.admiss_times and " +
  642. "a.dis_date>=#{start} and " +
  643. "a.dis_date<=#{end} and " +
  644. "(a.refer_physician like #{doctorCode} or b.zyys like #{doctorCode}) and " +
  645. "a.sex like #{sex} and " +
  646. "d.zyh=a.inpatient_no and " +
  647. "d.zycs=a.admiss_times and " +
  648. "d.ssbm like #{surgeryCode}")
  649. List<SheetOverview> advanceSearchWithSurgery(AdvanceSearchParam param);
  650. @Select("select file_status from t_case_frontsheet_main with(nolock) where bah=#{bah} and admiss_times=#{admissTimes}")
  651. Integer selectFileStatus(@Param("bah") String bah,
  652. @Param("admissTimes") Integer admissTimes);
  653. @Update("update t_case_frontsheet_main set file_status=#{status} where bah=#{bah} and admiss_times=#{admissTimes}")
  654. void updateFileStatus(@Param("bah") String bah,
  655. @Param("admissTimes") Integer admissTimes,
  656. @Param("status") int status);
  657. @Select("select top 1 * from t_si_disefamily_diagnose with(nolock) where dise_code=#{code} or disefamily_code=#{code}")
  658. DisefamilyGrade selectDisefamilyGrade(@Param("code") String code);
  659. @Select("select ssbm from batj_ba4 with(nolock) where zyh=#{bah} and zycs=#{times} and isnull(ssbm,'')!='' ")
  660. List<String> selectPatientSurgeryCodes(@Param("bah") String bah, @Param("times") Integer times);
  661. @Select("select * from t_si_operation_disefamily with(nolock) where disefamily_code=#{code}")
  662. List<OprnDisefamilyGrade> selectOperationDisefamilies(@Param("code") String code);
  663. @Select("select rtrim(zk_ward) as deptCode,isnull(file_status,0) as fileStatus, count(1) as dismissCount " +
  664. "from zy_inactpatient with(nolock) where dis_date>=#{start} and dis_date<=#{end} group by zk_ward, file_status")
  665. List<TempDismissCount> selectDismissCount(@Param("start") String start,
  666. @Param("end") String end);
  667. @Select("select rtrim(a.inpatient_no) as patNo,a.admiss_times as times, " +
  668. "rtrim(a.name) as name,gender=(case when a.sex='1' then '男' else '女' end), " +
  669. "age=datediff(year,b.birth_date,getdate()),a.admiss_date,a.dis_date, " +
  670. "inHospDays=datediff(day, a.admiss_date, a.dis_date),a.total_charge, " +
  671. "rtrim(a.zk_ward) as disDept, " +
  672. "disDiag=(select dis_diag_comment from ba_first_page1 t where t.inpatient_no=a.inpatient_no " +
  673. "and t.admiss_times=a.admiss_times and t.dis_diag_no=1), " +
  674. "blfx=isnull(c.blfx,''),rtrim(a.small_dept) as admissDept,rtrim(a.zk_ward) as zkWard, " +
  675. "c.kzr,c.zzys,c.zyys,fdcrb=isnull(c.fdcrb,'')," +
  676. "deadOrder=(select count(1) from yz_inact_order t where t.inpatient_no=a.inpatient_no and " +
  677. "t.admiss_times=a.admiss_times and t.order_code='05973') " +
  678. "from zy_inactpatient a, a_patient_mi b, batj_ba2 c where " +
  679. "a.inpatient_no not like 'S%' and " +
  680. "a.inpatient_no not like 'JT%' and " +
  681. "charindex('$',a.inpatient_no)=0 and " +
  682. "a.dis_date>=#{begntime} and a.dis_date<=#{endtime} and " +
  683. "a.inpatient_no=b.inpatient_no and a.inpatient_no=c.zyh and a.admiss_times=c.zycs " +
  684. "order by a.zk_ward")
  685. List<DismissCount> selectDismissDetailCount(@Param("begntime") String begntime,
  686. @Param("endtime") String endtime);
  687. @Update("update zd_icd_code set weight=(weight+1) where code=#{code}")
  688. void increaseDiagWeight(@Param("code") String code);
  689. }