CLIP.e-Form.Hospital.Dfh.Patient.xml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <sqlMap namespace="CLIP.e-Form.Consent.Dfh" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  3. <statements>
  4. <statement id="GET_PATIENT_DETAIL_INFO" parameterClass="System.Collections.Hashtable" resultMap="PatientMap">
  5. <![CDATA[
  6. select #pid# IO_Pt_ID,
  7. 'M/90y05m' IO_sex_age_y_m,
  8. '홍길동' IO_Pt_Name,
  9. '123456-1234567' IO_JuminNo,
  10. '111' IO_HosType,
  11. #cretno# IO_CretNo,
  12. '본관' IO_Ward,
  13. '906' IO_roomNO,
  14. '2016-07-01' IO_ADdate,
  15. #ordtype# IO_VisitType,
  16. #ordddeptcd# IO_DeptCd,
  17. #ordddeptcd# IO_DeptNm,
  18. 'CV' IO_OPdeptCd,
  19. '신경정신과' IO_OPdeptNm,
  20. '123456' IO_OPdrId,
  21. '나의사' IO_OPdrNm,
  22. '' IO_DxCd,
  23. '진단명' IO_DxNm,
  24. null IO_bp, null IO_dm, null IO_heart, null IO_kidney, null IO_respiration,
  25. null IO_hx, null IO_allergy, null IO_drug, null IO_smoking,
  26. null IO_idio, null IO_nacrotics, null IO_airway, null IO_hemorrhage,
  27. '요거이 테스트' IO_status_etc,
  28. 456 IO_OrderNo,
  29. '' IO_printtime,
  30. '' IO_maindrId,
  31. '' IO_maindrNm,
  32. '' IO_ocrcd,
  33. '' IO_INPUTId,
  34. '' IO_INPUTNM,
  35. '' IO_SIGNIMG
  36. from DUAL
  37. ]]>
  38. </statement>
  39. <statement id="GET_TRMT_DATE_LIST2" parameterClass="System.Collections.Hashtable" resultMap="ClnDateForDropdownMap">
  40. <isEqual property="searchType" compareValue="=">
  41. <![CDATA[
  42. select '20160701' ClnDate, '2016-07-01' ClnFormatDate, 'CV' VisitType, '외래' VisitTypeName, 'CV' ClnDeptCode, '신경정신과' ClnDeptName
  43. from DUAL
  44. ]]>
  45. </isEqual>
  46. <isNotEqual property="searchType" compareValue="=">
  47. <![CDATA[
  48. select '20160613' ClnDate, '2016-06-13' ClnFormatDate, 'CV' VisitType, '외래' VisitTypeName, 'CV2' ClnDeptCode, '치과' ClnDeptName
  49. from DUAL
  50. union
  51. select '20160625' ClnDate, '2016-06-25' ClnFormatDate, 'CV' VisitType, '외래' VisitTypeName, 'CV' ClnDeptCode, '신경정신과' ClnDeptName
  52. from DUAL
  53. union
  54. select '20160701' ClnDate, '2016-07-01' ClnFormatDate, 'CV' VisitType, '외래' VisitTypeName, 'CV' ClnDeptCode, '신경정신과' ClnDeptName
  55. from DUAL
  56. ]]>
  57. </isNotEqual>
  58. </statement>
  59. <statement id="GET_TRMT_DATE_LIST" parameterClass="System.Collections.Hashtable" resultMap="ClnDateForDropdownMap">
  60. <isEqual property="searchType" compareValue="=">
  61. <![CDATA[
  62. SELECT '1' AS ORDERBY,
  63. indd as ClnDate,
  64. substr(indd, 1, 4) || '-' || substr(indd, 5, 2) || '-' ||
  65. substr(indd, 7, 2) as ClnFormatDate,
  66. inpt.ordtype as VisitType,
  67. case
  68. when ordtype = 'O' then
  69. '외래'
  70. when ordtype = 'I' then
  71. '입원'
  72. when ordtype = 'E' then
  73. '응급'
  74. end as VisitTypeName,
  75. dept.deptengabbr as ClnDeptCode,
  76. dept.depthngnm as ClnDeptName,
  77. dept.deptcd as DeptCd,
  78. inpt.cretno,
  79. inpt.medispclid as orddrid
  80. FROM pam.pmihinpt inpt
  81. left outer join com.zsdddept dept
  82. on (dept.instcd = inpt.instcd and dept.deptcd = inpt.orddeptcd and
  83. dept.valitodd = '99991231')
  84. WHERE inpt.instcd = #instcd#
  85. AND inpt.pid = #pid#
  86. AND inpt.indd = #searchClnDate#
  87. AND inpt.histstat = 'Y'
  88. AND inpt.mskind = 'M'
  89. AND inpt.ORDDEPTCD = #orddeptcd#
  90. union all
  91. SELECT '1' AS ORDERBY,
  92. orddd as ClnDate,
  93. substr(orddd, 1, 4) || '-' || substr(orddd, 5, 2) || '-' ||
  94. substr(orddd, 7, 2) as ClnFormatDate,
  95. otpt.ordtype as VisitType,
  96. case
  97. when ordtype = 'O' then
  98. '외래'
  99. when ordtype = 'I' then
  100. '입원'
  101. when ordtype = 'E' then
  102. '응급'
  103. end as VisitTypeName,
  104. dept.deptengabbr as ClnDeptCode,
  105. dept.depthngnm as ClnDeptName,
  106. dept.deptcd as DeptCd,
  107. otpt.cretno,
  108. otpt.orddrid as orddrid
  109. FROM pam.pmohotpt otpt
  110. left outer join com.zsdddept dept
  111. on (dept.instcd = otpt.instcd and dept.deptcd = otpt.orddeptcd and
  112. dept.valitodd = '99991231')
  113. WHERE otpt.instcd = #instcd#
  114. AND otpt.pid = #pid#
  115. AND otpt.orddd = #searchClnDate#
  116. AND OTPT.ORDDEPTCD = #orddeptcd#
  117. AND otpt.HISTSTAT IN ('R', 'T')
  118. AND otpt.MSKIND = 'M'
  119. UNION ALL
  120. SELECT '99' AS ORDERBY,
  121. indd as ClnDate,
  122. substr(indd, 1, 4) || '-' || substr(indd, 5, 2) || '-' ||
  123. substr(indd, 7, 2) as ClnFormatDate,
  124. inpt.ordtype as VisitType,
  125. case
  126. when ordtype = 'O' then
  127. '외래'
  128. when ordtype = 'I' then
  129. '입원'
  130. when ordtype = 'E' then
  131. '응급'
  132. end as VisitTypeName,
  133. dept.deptengabbr as ClnDeptCode,
  134. dept.depthngnm as ClnDeptName,
  135. dept.deptcd as DeptCd,
  136. inpt.cretno,
  137. inpt.medispclid as orddrid
  138. FROM pam.pmihinpt inpt
  139. left outer join com.zsdddept dept
  140. on (dept.instcd = inpt.instcd and dept.deptcd = inpt.orddeptcd and
  141. dept.valitodd = '99991231')
  142. WHERE inpt.instcd = #instcd#
  143. AND inpt.pid = #pid#
  144. AND inpt.indd = #searchClnDate#
  145. AND inpt.histstat = 'Y'
  146. AND inpt.mskind = 'M'
  147. AND inpt.ORDDEPTCD != #orddeptcd#
  148. union all
  149. SELECT '99' AS ORDERBY,
  150. orddd as ClnDate,
  151. substr(orddd, 1, 4) || '-' || substr(orddd, 5, 2) || '-' ||
  152. substr(orddd, 7, 2) as ClnFormatDate,
  153. otpt.ordtype as VisitType,
  154. case
  155. when ordtype = 'O' then
  156. '외래'
  157. when ordtype = 'I' then
  158. '입원'
  159. when ordtype = 'E' then
  160. '응급'
  161. end as VisitTypeName,
  162. dept.deptengabbr as ClnDeptCode,
  163. dept.depthngnm as ClnDeptName,
  164. dept.deptcd as DeptCd,
  165. otpt.cretno,
  166. otpt.orddrid as orddrid
  167. FROM pam.pmohotpt otpt
  168. left outer join com.zsdddept dept
  169. on (dept.instcd = otpt.instcd and dept.deptcd = otpt.orddeptcd and
  170. dept.valitodd = '99991231')
  171. WHERE otpt.instcd = #instcd#
  172. AND otpt.pid = #pid#
  173. AND otpt.orddd = #searchClnDate#
  174. AND OTPT.ORDDEPTCD != #orddeptcd#
  175. AND otpt.HISTSTAT IN ('R', 'T')
  176. AND otpt.MSKIND = 'M'
  177. order by ORDERBY, cretno desc
  178. ]]>
  179. </isEqual>
  180. <isNotEqual property="searchType" compareValue="=">
  181. <![CDATA[
  182. SELECT indd as ClnDate,
  183. substr(indd, 1, 4) || '-' || substr(indd, 5, 2) || '-' ||
  184. substr(indd, 7, 2) as ClnFormatDate,
  185. inpt.ordtype as VisitType,
  186. case
  187. when ordtype = 'O' then
  188. '외래'
  189. when ordtype = 'I' then
  190. '입원'
  191. when ordtype = 'E' then
  192. '응급'
  193. end as VisitTypeName,
  194. dept.deptengabbr as ClnDeptCode,
  195. dept.depthngnm as ClnDeptName,
  196. inpt.cretno
  197. FROM pam.pmihinpt inpt
  198. left outer join com.zsdddept dept
  199. on (dept.instcd = inpt.instcd and dept.deptcd = inpt.orddeptcd and
  200. dept.valitodd = '99991231')
  201. WHERE inpt.instcd = #instcd#
  202. AND inpt.pid = #pid#
  203. AND inpt.indd >= #searchClnDate#
  204. AND inpt.histstat = 'Y'
  205. AND inpt.mskind = 'M'
  206. union all
  207. SELECT orddd as ClnDate,
  208. substr(orddd, 1, 4) || '-' || substr(orddd, 5, 2) || '-' ||
  209. substr(orddd, 7, 2) as ClnFormatDate,
  210. otpt.ordtype as VisitType,
  211. case
  212. when ordtype = 'O' then
  213. '외래'
  214. when ordtype = 'I' then
  215. '입원'
  216. when ordtype = 'E' then
  217. '응급'
  218. end as VisitTypeName,
  219. dept.deptengabbr as ClnDeptCode,
  220. dept.depthngnm as ClnDeptName,
  221. otpt.cretno
  222. FROM pam.pmohotpt otpt
  223. left outer join com.zsdddept dept
  224. on (dept.instcd = otpt.instcd and dept.deptcd = otpt.orddeptcd and
  225. dept.valitodd = '99991231')
  226. WHERE otpt.instcd = #instcd#
  227. AND otpt.pid = #pid#
  228. AND otpt.orddd >= #searchClnDate#
  229. AND otpt.HISTSTAT IN ('R', 'T')
  230. AND otpt.MSKIND = 'M'
  231. ]]>
  232. </isNotEqual>
  233. </statement>
  234. <statement id="getPatientInfoOut" parameterClass="System.Collections.Hashtable" resultMap="PatientMap">
  235. <![CDATA[
  236. SELECT a.orddeptcd,
  237. a.pid as IO_Pt_ID,
  238. to_char(a.cretno) as IO_CretNo,
  239. ( ptbs.sex || '/' ||
  240. com.FN_ZZ_GETAGE_REC(ptbs.rrgstno1,
  241. ptbs.rrgstno2,
  242. TO_CHAR(SYSDATE, 'YYYYMMDD'),
  243. 'A',
  244. ptbs.brthdd)) as IO_sex_age_y_m,
  245. ptbs.hngnm as IO_Pt_Name,
  246. (ptbs.rrgstno1 || '-' || substr(ptbs.rrgstno2, 1, 1) ||'******') IO_JuminNo,
  247. ptbs.zipcdaddr as IO_Zipcdaddr,
  248. ptbs.mpphontel as IO_Tel,
  249. (select cdnm from com.zbcmcode where cdgrupid='P0008' and cdid =a.insukind) as IO_Insukind,
  250. '' as IO_Ward,
  251. '' as IO_roomNO,
  252. a.orddd as IO_ADdate,
  253. a.orddd as IO_Dschdd,
  254. a.ordtype as IO_VisitType,
  255. a.orddeptcd as IO_DeptCd,
  256. (select dept.deptengabbr
  257. from com.zsdddept dept
  258. where dept.deptcd = a.orddeptcd
  259. and dept.instcd = a.instcd
  260. and dept.valitodd >= a.orddd
  261. and dept.valifromdd <= a.orddd) as IO_DeptNm,
  262. COM.FN_ZS_GETDEPTNAME(a.instcd, a.orddeptcd, a.orddd) AS IO_Dept2,
  263. '' AS IO_OPdeptCd,
  264. '' AS IO_OPdeptNm,
  265. '' AS IO_OPdrNm,
  266. '' AS IO_OPdrId,
  267. (SELECT diag.diagcd
  268. FROM emr.mmohdiag diag
  269. WHERE diag.pid = a.pid
  270. AND diag.orddd = a.orddd
  271. AND diag.cretno = a.cretno
  272. AND diag.diaghistcd = 'O'
  273. AND diag.diagtypecd = 'D'
  274. AND diag.diagkindcdflag = 'M'
  275. AND diag.genrflagcd = a.ordtype
  276. and diag.orddeptcd = a.orddeptcd
  277. and rownum = 1
  278. AND diag.diaghistno = (select max(diagh.diaghistno)
  279. from emr.mmohdiag diagh
  280. where diagh.pid = a.pid
  281. AND diagh.orddd = a.orddd
  282. AND diagh.cretno = a.cretno
  283. AND diagh.instcd = '111'
  284. AND diagh.diaghistcd = 'O'
  285. AND diagh.diagkindcdflag = 'M'
  286. AND diagh.genrflagcd = a.ordtype
  287. and diagh.orddeptcd = a.orddeptcd
  288. and rownum = 1
  289. group by pid)) as IO_DxCd,
  290. (SELECT term.diaghngnm
  291. FROM emr.mmohdiag diag,
  292. emr.mmbvdiag term
  293. WHERE diag.pid = a.pid
  294. AND diag.orddd = a.orddd
  295. AND diag.cretno = a.cretno
  296. AND diag.instcd = term.instcd
  297. AND diag.diagcd = term.orgdiagcd
  298. AND diag.diaghistcd = 'O'
  299. AND diag.diagtypecd = 'D'
  300. AND diag.diagkindcdflag = 'M'
  301. AND diag.diagdd >= term.termfromdd
  302. AND diag.diagdd <= term.termtodd
  303. AND diag.diagdd >= term.diagattrfromdd
  304. AND diag.diagdd <= term.diagattrtodd
  305. AND diag.genrflagcd = a.ordtype
  306. and diag.orddeptcd = a.orddeptcd
  307. and rownum = 1
  308. AND diag.diaghistno = (select max(diagh.diaghistno)
  309. from emr.mmohdiag diagh
  310. where diagh.pid = a.pid
  311. AND diagh.orddd = a.orddd
  312. AND diagh.cretno = a.cretno
  313. AND diagh.instcd = '111'
  314. AND diagh.diaghistcd = 'O'
  315. AND diagh.diagkindcdflag = 'M'
  316. AND diagh.genrflagcd = a.ordtype
  317. and diagh.orddeptcd = a.orddeptcd
  318. and rownum = 1
  319. group by pid)) as IO_DxNm,
  320. COM.FN_ZS_GETUSERNM(a.orddrid, a.orddd) as IO_MaindrNm,
  321. '111' as IO_HosType,
  322. case when ex.bp is null then null else ex.bp end as IO_bp,
  323. case when ex.dm is null then null else ex.dm end as IO_dm,
  324. case when ex.heart is null then null else ex.heart end as IO_heart,
  325. case when ex.kidney is null then null else ex.kidney end as IO_kidney,
  326. case when ex.respiration is null then null else ex.respiration end as IO_respiration,
  327. case when ex.hx is null then null else ex.hx end as IO_hx,
  328. case when ex.allergy is null then null else ex.allergy end as IO_allergy,
  329. case when ex.drug is null then null else ex.drug end as IO_drug,
  330. case when ex.smoking is null then null else ex.smoking end as IO_smoking,
  331. case when ex.idio is null then null else ex.idio end as IO_idio,
  332. case when ex.nacrotics is null then null else ex.nacrotics end as IO_nacrotics,
  333. case when ex.airway is null then null else ex.airway end as IO_airway,
  334. case when ex.hemorrhage is null then null else ex.hemorrhage end as IO_hemorrhage,
  335. ex.etc IO_status_etc,
  336. '111' as IO_OrderNo,
  337. '111' as IO_PrintTime,
  338. a.ORDDRID as IO_MaindrId,
  339. '' as IO_ErdrNm,
  340. COM.FN_ZS_GETUSERNM(a.ORDDRID, a.orddd) as IO_MaindrNm,
  341. '111' as IO_OcrCd,
  342. a.ORDDRID as IO_InputId,
  343. COM.FN_ZS_GETUSERNM(a.ORDDRID, a.orddd) as IO_InputNm,
  344. '111' as IO_SignImg,
  345. ptbs.detladdr
  346. FROM pam.pmohotpt a
  347. left outer join cmr.consent_data_ex ex
  348. on (ex.pid = a.pid and ex.cln_date = a.orddd)
  349. left outer join pam.pmcmptbs ptbs
  350. on (ptbs.pid = a.pid and ptbs.instcd = a.instcd)
  351. WHERE a.instcd = #instcd#
  352. AND a.pid = #pid#
  353. AND a.orddd = #orddd#
  354. AND A.HISTSTAT IN ('R', 'T')
  355. AND A.MSKIND = 'M'
  356. ]]>
  357. <isNotEmpty property="cretno">
  358. AND a.cretno = #cretno#
  359. </isNotEmpty>
  360. <isNotEmpty property="orddeptcd">
  361. AND a.orddeptcd = #orddeptcd#
  362. </isNotEmpty>
  363. </statement>
  364. <statement id="getPatientInfoIn" parameterClass="System.Collections.Hashtable" resultMap="PatientMap">
  365. <![CDATA[
  366. SELECT a.orddeptcd,
  367. a.pid as IO_Pt_ID,
  368. to_char(a.cretno) as IO_CretNo,
  369. (ptbs.sex || '/' ||
  370. com.FN_ZZ_GETAGE_REC(ptbs.rrgstno1,
  371. ptbs.rrgstno2,
  372. TO_CHAR(SYSDATE, 'YYYYMMDD'),
  373. 'A',
  374. ptbs.brthdd)) as IO_sex_age_y_m,
  375. ptbs.hngnm as IO_Pt_Name,
  376. (ptbs.rrgstno1 || '-' || substr(ptbs.rrgstno2, 1, 1) || '******') IO_JuminNo,
  377. ptbs.zipcdaddr as IO_Zipcdaddr,
  378. ptbs.mpphontel as IO_Tel,
  379. (select cdnm
  380. from com.zbcmcode
  381. where cdgrupid = 'P0008'
  382. and cdid = a.insukind) as IO_Insukind,
  383. (select dept.DEPTENGABBR
  384. from com.zsdddept dept
  385. where dept.deptcd = a.wardcd
  386. and dept.instcd = a.instcd
  387. and dept.valitodd >= a.indd
  388. and dept.valifromdd <= a.indd) as IO_Ward,
  389. a.roomcd as IO_roomNO,
  390. a.indd as IO_ADdate,
  391. a.dschdd as IO_Dschdd,
  392. a.ordtype as IO_VisitType,
  393. a.orddeptcd as IO_DeptCd,
  394. (select dept.deptengabbr
  395. from com.zsdddept dept
  396. where dept.deptcd = a.orddeptcd
  397. and dept.instcd = a.instcd
  398. and dept.valitodd >= a.indd
  399. and dept.valifromdd <= a.indd) as IO_DeptNm,
  400. COM.FN_ZS_GETDEPTNAME(a.instcd, a.orddeptcd, a.indd) AS IO_Dept2,
  401. '' AS IO_OPdeptCd,
  402. '' AS IO_OPdeptNm,
  403. '' AS IO_OPdrNm,
  404. '' AS IO_OPdrId,
  405. (SELECT diag.diagcd
  406. FROM emr.mmohdiag diag
  407. WHERE diag.pid = a.pid
  408. AND diag.orddd = a.indd
  409. AND diag.cretno = a.cretno
  410. AND diag.diaghistcd = 'O'
  411. AND diag.diagtypecd = 'D'
  412. AND diag.diagkindcdflag = 'M'
  413. AND diag.genrflagcd = a.ordtype
  414. and diag.orddeptcd = a.orddeptcd
  415. and rownum = 1
  416. AND
  417. diag.diaghistno = (select max(diagh.diaghistno)
  418. from emr.mmohdiag diagh
  419. where diagh.pid = a.pid
  420. AND diagh.orddd = a.indd
  421. AND diagh.cretno = a.cretno
  422. AND diagh.instcd = '111'
  423. AND diagh.diaghistcd = 'O'
  424. AND diagh.diagkindcdflag = 'M'
  425. AND diagh.genrflagcd = a.ordtype
  426. and diagh.orddeptcd = a.orddeptcd
  427. and rownum = 1
  428. group by pid)) as IO_DxCd,
  429. (SELECT term.diaghngnm
  430. FROM emr.mmohdiag diag,
  431. emr.mmbvdiag term
  432. WHERE diag.pid = a.pid
  433. AND diag.orddd = a.indd
  434. AND diag.cretno = a.cretno
  435. AND diag.instcd = term.instcd
  436. AND diag.diagcd = term.orgdiagcd
  437. AND diag.diaghistcd = 'O'
  438. AND diag.diagtypecd = 'D'
  439. AND diag.diagkindcdflag = 'M'
  440. AND diag.diagdd >= term.termfromdd
  441. AND diag.diagdd <= term.termtodd
  442. AND diag.diagdd >= term.diagattrfromdd
  443. AND diag.diagdd <= term.diagattrtodd
  444. AND diag.genrflagcd = a.ordtype
  445. and diag.orddeptcd = a.orddeptcd
  446. and rownum = 1
  447. AND
  448. diag.diaghistno = (select max(diagh.diaghistno)
  449. from emr.mmohdiag diagh
  450. where diagh.pid = a.pid
  451. AND diagh.orddd = a.indd
  452. AND diagh.cretno = a.cretno
  453. AND diagh.instcd = '111'
  454. AND diagh.diaghistcd = 'O'
  455. AND diagh.diagkindcdflag = 'M'
  456. AND diagh.genrflagcd = a.ordtype
  457. and diagh.orddeptcd = a.orddeptcd
  458. and rownum = 1
  459. group by pid)) as IO_DxNm,
  460. '111' as IO_HosType,
  461. case
  462. when ex.bp is null then
  463. null
  464. else
  465. ex.bp
  466. end as IO_bp,
  467. case
  468. when ex.dm is null then
  469. null
  470. else
  471. ex.dm
  472. end as IO_dm,
  473. case
  474. when ex.heart is null then
  475. null
  476. else
  477. ex.heart
  478. end as IO_heart,
  479. case
  480. when ex.kidney is null then
  481. null
  482. else
  483. ex.kidney
  484. end as IO_kidney,
  485. case
  486. when ex.respiration is null then
  487. null
  488. else
  489. ex.respiration
  490. end as IO_respiration,
  491. case
  492. when ex.hx is null then
  493. null
  494. else
  495. ex.hx
  496. end as IO_hx,
  497. case
  498. when ex.allergy is null then
  499. null
  500. else
  501. ex.allergy
  502. end as IO_allergy,
  503. case
  504. when ex.drug is null then
  505. null
  506. else
  507. ex.drug
  508. end as IO_drug,
  509. case
  510. when ex.smoking is null then
  511. null
  512. else
  513. ex.smoking
  514. end as IO_smoking,
  515. case
  516. when ex.idio is null then
  517. null
  518. else
  519. ex.idio
  520. end as IO_idio,
  521. case
  522. when ex.nacrotics is null then
  523. null
  524. else
  525. ex.nacrotics
  526. end as IO_nacrotics,
  527. case
  528. when ex.airway is null then
  529. null
  530. else
  531. ex.airway
  532. end as IO_airway,
  533. case
  534. when ex.hemorrhage is null then
  535. null
  536. else
  537. ex.hemorrhage
  538. end as IO_hemorrhage,
  539. ex.etc IO_status_etc,
  540. '' as IO_OrderNo,
  541. '111' as IO_PrintTime,
  542. a.medispclid as IO_MaindrId,
  543. COM.FN_ZS_GETUSERNM(a.ermedispclid, a.indd) as IO_ErdrNm,
  544. COM.FN_ZS_GETUSERNM(a.medispclid, a.indd) as IO_MaindrNm,
  545. '111' as IO_OcrCd,
  546. '111' as IO_InputId,
  547. '111' as IO_InputNm,
  548. '111' as IO_SignImg,
  549. a.fstrgstdt
  550. FROM pam.pmihinpt a
  551. left outer join cmr.consent_data_ex ex
  552. on (ex.pid = a.pid and ex.cln_date = a.indd)
  553. left outer join pam.pmcmptbs ptbs
  554. on (ptbs.pid = a.pid and ptbs.instcd = a.instcd)
  555. WHERE a.instcd = #instcd#
  556. AND a.pid = #pid#
  557. AND a.indd = #orddd#
  558. AND a.histstat = 'Y'
  559. AND a.mskind = 'M'
  560. ]]>
  561. <isNotEmpty property="cretno">
  562. AND a.cretno = #cretno#
  563. </isNotEmpty>
  564. <isNotEqual property="orddeptcd" compareValue="2280000000">
  565. <isNotEmpty property="orddeptcd">
  566. AND a.orddeptcd = #orddeptcd#
  567. </isNotEmpty>
  568. </isNotEqual>
  569. order by a.fstrgstdt desc
  570. </statement>
  571. <statement id="getOcrTag" parameterClass="System.Collections.Hashtable" resultClass="System.String">
  572. <!--<![CDATA[
  573. SELECT to_char(sysdate,'YYYYMMDDhh24miss') AS ocrtag
  574. FROM dual
  575. ]]>-->
  576. <![CDATA[
  577. SELECT to_char(sysdate,'YYYYMMDD') || SUBSTR(LPAD((EMR.SQ_MRFMOCRP_01.NEXTVAL), 10, '0'), 6, 5) AS ocrtag
  578. FROM dual
  579. ]]>
  580. </statement>
  581. <!--
  582. <statement id="getDiagList" parameterClass="System.Collections.Hashtable" resultClass="System.String">
  583. <![CDATA[
  584. select '신경성 위염'|| #pid# as diagengnm from dual
  585. union select '알레르기 비염'|| #orddd# as diagengnm from dual
  586. union select '손목터널증후군' as diagengnm from dual
  587. ]]>
  588. </statement>
  589. -->
  590. <statement id="getDiagList" parameterClass="System.Collections.Hashtable" resultClass="System.String">
  591. <![CDATA[
  592. SELECT term.diaghngnm
  593. FROM emr.mmohdiag diag,
  594. emr.mmbvdiag term,
  595. pam.pmihinpt inpt
  596. WHERE inpt.instcd = '111'
  597. AND inpt.pid = #pid#
  598. AND inpt.indd = #orddd#
  599. AND inpt.histstat = 'Y'
  600. AND inpt.mskind = 'M'
  601. AND inpt.pid = diag.pid
  602. AND inpt.indd = diag.orddd
  603. AND diag.cretno = inpt.cretno
  604. AND diag.instcd = inpt.instcd
  605. AND diag.instcd = term.instcd
  606. AND diag.diagcd = term.orgdiagcd
  607. AND diag.diaghistcd = 'O'
  608. AND diag.diagtypecd = 'D'
  609. AND diag.diagdd >= term.termfromdd
  610. AND diag.diagdd <= term.termtodd
  611. AND diag.diagdd >= term.diagattrfromdd
  612. AND diag.diagdd <= term.diagattrtodd
  613. AND diag.genrflagcd in ('I','E')
  614. union all
  615. SELECT term.diaghngnm as diaghngnm
  616. FROM emr.mmohdiag diag,
  617. emr.mmbvdiag term,
  618. pam.pmohotpt otpt
  619. WHERE otpt.instcd = '111'
  620. AND otpt.pid = #pid#
  621. AND otpt.orddd = #orddd#
  622. AND otpt.pid = diag.pid
  623. AND otpt.orddd = diag.orddd
  624. AND diag.cretno = otpt.cretno
  625. AND diag.instcd = otpt.instcd
  626. AND diag.instcd = term.instcd
  627. AND diag.diagcd = term.orgdiagcd
  628. AND diag.diaghistcd = 'O'
  629. AND diag.diagtypecd = 'D'
  630. AND diag.diagdd >= term.termfromdd
  631. AND diag.diagdd <= term.termtodd
  632. AND diag.diagdd >= term.diagattrfromdd
  633. AND diag.diagdd <= term.diagattrtodd
  634. AND diag.genrflagcd in ('O','S')
  635. ]]>
  636. </statement>
  637. <insert id="setFileName" parameterClass="System.Collections.Hashtable">
  638. <![CDATA[
  639. declare
  640. I_PID VARCHAR2(10) := #pid#;
  641. I_IOFLAG VARCHAR2(1) := #ordtype#;
  642. I_ORDDD VARCHAR2(8) := #orddd#;
  643. I_DSCHDD VARCHAR2(8) := #dschdd#;
  644. I_CRETNO NUMBER(10) := #cretno#;
  645. I_FILESIZE NUMBER(18) := #filesize#;
  646. I_FORMCD VARCHAR2(10) := #formcd#;
  647. I_PAGE NUMBER(18) := #pageno#;
  648. I_OCRCODE VARCHAR2(13) := #ocrtag#;
  649. I_USERID VARCHAR2(10) := #userid#;
  650. I_ORDDEPTCD VARCHAR2(10) := #orddeptcd#;
  651. begin
  652. EMR.LCTECH_PROCESS(I_PID, I_IOFLAG, I_ORDDD, I_DSCHDD, I_CRETNO, I_FILESIZE, I_FORMCD, I_PAGE, I_OCRCODE, I_ORDDEPTCD, I_USERID);
  653. end;
  654. ]]>
  655. </insert>
  656. <insert id="delEformData" parameterClass="System.Collections.Hashtable">
  657. <![CDATA[
  658. declare
  659. I_PID VARCHAR2(10) := #pid#; /* 등록번호 */
  660. I_IOFLAG VARCHAR2(1) := #ordtype#; /* 입원/외래 구분 */
  661. I_ORDDD VARCHAR2(8) := #orddd#; /* 입원일 또는 진료일 */
  662. I_DSCHDD VARCHAR2(8) := #dschdd#; /* 입원환자 퇴원일 외래환자면 값이 '' */
  663. I_CRETNO NUMBER(10) := #cretno#; /* 원무정보의 생성번호 */
  664. I_FORMCD VARCHAR2(10) := #formcd#; /* FORMCD */
  665. I_OCRCODE VARCHAR2(13) := #ocrtag#; /* OCRCODE */
  666. I_USERID VARCHAR2(10) := #userid#; /* 사용자 ID 실제 동의서 구득 행위를 하는 사람 */
  667. I_USERNM VARCHAR2(10) := #username#; /* 사용자 이름 */
  668. I_CONSENT_MST_RID NUMBER(18) := #consentmstrid#; /* 동의서 작성 마스터 ID */
  669. I_HOS_TYPE VARCHAR2(10) := #hostype#; /* 병원구분(대구파티마 - '111') */
  670. I_ORDDEPTCD VARCHAR2(10) := #orddeptcd#;
  671. begin
  672. EMR.EFORM_DELETE(I_PID, I_IOFLAG, I_ORDDD, I_DSCHDD, I_CRETNO, I_FORMCD, I_OCRCODE, I_USERID, I_USERNM, I_CONSENT_MST_RID, I_ORDDEPTCD, I_HOS_TYPE);
  673. end;
  674. ]]>
  675. </insert>
  676. <statement id="getFileName" parameterClass="System.Collections.Hashtable" resultClass="System.String">
  677. <![CDATA[
  678. SELECT d.alias||'\'||'fnuImage'||'\'||substr(c.cdate,1,6)||'\'||substr(c.cdate,7)||'\'||to_char(c.pageno) AS filename
  679. FROM cmr.treatt a, cmr.chartpaget b, cmr.paget c, cmr.patht d
  680. WHERE a.patid = #pid#
  681. AND a.class = #ordtype#
  682. AND a.indate = #orddd#
  683. ]]>
  684. <isNotEqual property="ordtype" compareValue="O">
  685. <isNotEqual property="ordtype" compareValue="S">
  686. AND a.outdate = #dschdd#
  687. </isNotEqual>
  688. </isNotEqual>
  689. <![CDATA[
  690. and a.TREATNO = b.TREATNO
  691. and b.formcode = #formcd#
  692. and b.ocrcode = #ocrtag#
  693. and b.page = #pageno#
  694. and b.pageno = c.pageno
  695. and d.pathid = c.pathid
  696. and d.active = 'Y'
  697. ]]>
  698. </statement>
  699. <statement id="getFormFromdt" parameterClass="System.Collections.Hashtable" resultClass="System.String">
  700. <![CDATA[
  701. select a.formfromdt
  702. from emr.mrfmform a
  703. where instcd = #instcd#
  704. and formcd = #formcd#
  705. and formtodt like '99991231%'
  706. ]]>
  707. </statement>
  708. <insert id="setOcrPrntInfo" parameterClass="System.Collections.Hashtable">
  709. <![CDATA[
  710. merge into emr.mrfmocrprnt a
  711. using dual
  712. on(instcd = #instcd#
  713. and pid = #pid#
  714. and orddd = #orddd#
  715. and cretno = #cretno#
  716. and ocrtag = #ocrtag#
  717. )
  718. when not matched then
  719. INSERT (
  720. ocrtag,
  721. pid,
  722. ordtype,
  723. orddd,
  724. cretno,
  725. orddrid,
  726. orddeptcd,
  727. instcd,
  728. formcd,
  729. formfromdt,
  730. fstprntdt,
  731. fstprntdeptcd,
  732. fstprntid,
  733. updtdt,
  734. updtdeptcd,
  735. updtuserid,
  736. diagnm,
  737. opnm,
  738. fstrgstrid,
  739. fstrgstdt,
  740. lastupdtrid,
  741. lastupdtdt
  742. )
  743. VALUES(
  744. #ocrtag#,
  745. #pid#,
  746. #ordtype#,
  747. #orddd#,
  748. #cretno#,
  749. #orddrid#,
  750. #orddeptcd#,
  751. #instcd#,
  752. #formcd#,
  753. #formfromdt#,
  754. #fstprntdt#,
  755. #fstprntdeptcd#,
  756. #fstprntid#,
  757. #updtdt#,
  758. #updtdeptcd#,
  759. #updtuserid#,
  760. '',
  761. '',
  762. #fstprntid#,
  763. SYSTIMESTAMP,
  764. #fstprntid#,
  765. SYSTIMESTAMP
  766. )
  767. ]]>
  768. </insert><insert id="setOcrPrntHistInfo" parameterClass="System.Collections.Hashtable">
  769. <![CDATA[
  770. merge into emr.mrfhocrprnt a
  771. using dual
  772. on(instcd = #instcd#
  773. and ocrtag = #ocrtag#
  774. )
  775. when not matched then
  776. INSERT (
  777. instcd,
  778. ocrtag,
  779. statcd,
  780. updtdt,
  781. updtresncnts,
  782. updtdeptcd,
  783. scanyn,
  784. updtuserid,
  785. pagecnt,
  786. scanpagecnt,
  787. fstrgstrid,
  788. fstrgstdt,
  789. lastupdtrid,
  790. lastupdtdt
  791. )
  792. VALUES(
  793. #instcd#,
  794. #ocrtag#,
  795. 'P',
  796. #updtdt#,
  797. '',
  798. #updtdeptcd#,
  799. 'N',
  800. #updtuserid#,
  801. #prntcnt#,
  802. 0,
  803. #updtuserid#,
  804. SYSTIMESTAMP,
  805. #updtuserid#,
  806. SYSTIMESTAMP
  807. )
  808. ]]>
  809. </insert>
  810. <update id="UPDATE_USERSETUP" parameterClass="System.Collections.Hashtable">
  811. <![CDATA[
  812. UPDATE MIS.RPBMEMPL
  813. SET MOBILE = #status#
  814. WHERE EMPLNO = #userid#
  815. ]]>
  816. </update>
  817. <statement id="getHardCodeYN" parameterClass="System.Collections.Hashtable" resultClass="System.String">
  818. <![CDATA[
  819. select 'Y'
  820. from emr.mnwmcode a
  821. where a.instcd = '111'
  822. and a.cdgrupid in ('399')
  823. and substr(cdid, 3) = #formcd#
  824. and rownum = 1
  825. ]]>
  826. </statement>
  827. </statements>
  828. </sqlMap>