CaseFrontSheetDao.java 38 KB

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