SMARC00700.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. /***********************************************************************************************************************************************************
  2. *
  3. * @ creat date - 2007.12.20
  4. * @ author - dhkim
  5. * @ desc - SMARC00700_입원수술 환자조회.xrw에서 사용하는 스크립트이다.
  6. * 조회조건의 의뢰환자체크박스가 체크되어있지 않을때는 환자번호를 필수로 조회조건으로 줘야한다.
  7. * 조회하여 그리드에 출력할때 내부적으로 key를 리턴하여 그리드 더블클릭 이벤트 발생시 상단정보를 등록하고 의뢰환자등록화면을 호출한다.
  8. * 그리드에 병동~주민번호까지 틀고정한다.
  9. * 환자번호를 입력하고 엔터를 누르면 환자명을 출력한다. 없는 번호일때에는 팝업화면을 호출한다.
  10. * 환자명을 임력하고 엔터를 누르면 환자번호를 출력한다. 없는 번호이거나 동명이인일때에는 팝업화면을 호출한다.
  11. **********************************************************************************************************************************************************/
  12. var xSearchPath = '/root/main/search';
  13. var xTempPath = '/root/temp';
  14. var xSendpath = '/root/send';
  15. var xGridPath = '/root/main/list/inpatlist';
  16. var CurrentDate = getCurrentDate();
  17. // 초기값 셋팅
  18. function fInit(){
  19. //병원구분코드(공통코드)조회
  20. model.removeNodeset('/root/init/cond/A0429');
  21. zbcfGetCodeList(new Array('A0429'), new Array('/root/init/cond'));
  22. model.removeNodeset(xGridPath);
  23. //조회조건 세팅
  24. fSetCondition();
  25. }
  26. /**
  27. * 2007.12.22
  28. * 내원자, 퇴원일자 별로 날짜를 세팅한다.
  29. * default - 내원자
  30. */
  31. function fSetCondition(condflag){
  32. if(condflag == null || condflag == '' ){
  33. condflag = '1';
  34. }
  35. //condflag : 1 (내원자) , 2(퇴원일자)
  36. //내원자 조회는 잘짜입력안함.. 퇴원일자는 조회조건에 날짜선택가능하고 default는 오늘날짜만 ..
  37. if(condflag == '1'){
  38. model.setValue(xSearchPath + '/fromdd', '');
  39. model.setValue(xSearchPath + '/todd', '');
  40. ipt_fromdd.disabled = 'true';
  41. ipt_todd.disabled = 'true';
  42. model.setValue(xSearchPath + '/reqyn', 'CP');
  43. }else if(condflag == '2' || condflag == '3'){
  44. model.setValue(xSearchPath + '/fromdd', CurrentDate);
  45. model.setValue(xSearchPath + '/todd', CurrentDate);
  46. ipt_fromdd.disabled = 'false';
  47. ipt_todd.disabled = 'false';
  48. }
  49. model.setValue(xSearchPath + '/condflag', condflag);
  50. //model.setValue(xSearchPath + '/reqyn', 'CP');
  51. model.refresh();
  52. }
  53. /**
  54. * 2007.12.21
  55. * 환자번호 입력시 환자명 출력
  56. * 환자명 입력시 환자번호 출력
  57. * 입력한 값이 존재하지않으면 팝업호출
  58. */
  59. function fGetPatientInfo(srchcond, keyword){
  60. model.removeNodeset(xSendpath );
  61. model.removeNodeset(xTempPath );
  62. model.makeValue(xSendpath + '/reqdata/srchcond', srchcond);//1:환자번호조회, 2:환자명조회
  63. if(srchcond == '1'){
  64. model.makeValue(xSendpath + '/reqdata/pid', keyword);
  65. }else if(srchcond == '2'){
  66. model.makeValue(xSendpath + '/reqdata/hngnm', keyword);
  67. }
  68. if(submit('TRARC00702')){
  69. if(getNodesetCount(xTempPath + '/patientinfo') != 1){
  70. fPopupWindowPatient(srchcond, keyword);
  71. }else if(getNodesetCount(xTempPath + '/patientinfo') == 1){
  72. model.setValue(xSearchPath + '/pid', model.getValue(xTempPath + '/patientinfo/pid'));
  73. model.setValue(xSearchPath + '/hngnm', model.getValue(xTempPath + '/patientinfo/hngnm'));
  74. model.refresh();
  75. }
  76. }
  77. }
  78. /**
  79. * 2007.12.21
  80. * 원무팀의 환자조회팝업을 호출한다.
  81. */
  82. function fPopupWindowPatient(srchcond, keyword){
  83. //parameter값 세팅
  84. model.removeNodeset(xTempPath );
  85. model.makeValue(xTempPath + '/pid', keyword==''? ipt_pid.currentText : keyword);
  86. model.makeValue(xTempPath + '/hngnm', keyword==''? ipt_hngnm.currentText : keyword);
  87. model.makeValue(xTempPath + '/srchcond', srchcond);
  88. //원무팀의 환자명을 받아오는 팝업창을 띄운다.
  89. modal('SPPMC02500', '1','150', '150', 'SPPMC02500', xTempPath , xSendpath );
  90. //팝업의 result는 /root/main/patinfo/patinfolist 에 들어온다.
  91. model.removeNodeset(xSearchPath + '/pid');
  92. model.removeNodeset(xSearchPath + '/hngnm');
  93. model.makeValue(xSearchPath + '/pid', model.getValue('/root/main/patinfo/patinfolist/pid'));
  94. model.makeValue(xSearchPath + '/hngnm', model.getValue('/root/main/patinfo/patinfolist/hngnm'));
  95. model.refresh();
  96. }
  97. /**
  98. * 2007.12.20
  99. * 조회버튼(btn_search) 클릭 이벤트 발생시 입원/수술환자내역을 조회한다.
  100. * 조회조건 : condflag(재원자:1, 퇴원일자:2, 입원일자:3), fromdd(시작일), todd(종료일), pid(등록번호), hngnm(환자명), opyn(수술환자체크), reqyn(의뢰환자체크)
  101. * 의뢰환자가 체크된 상태가 아니면 조회조건에 환자번호 필수로 넘겨야한다.
  102. *
  103. */
  104. function fSearch(){
  105. var reqyn = model.getValue(xSearchPath + '/reqyn'); //조회조건의 의뢰환자 chk true일때의 값:CP
  106. var opyn = model.getValue(xSearchPath + '/opyn'); //조회조건의 수술환자 chk true일때의 값:E
  107. var pid = ipt_pid.currentText; //환자등록번호
  108. var hngnm = ipt_hngnm.currentText; //환자명
  109. var condflag = model.getValue(xSearchPath + '/condflag'); //조회조건
  110. var fromdd = model.getValue(xSearchPath + '/fromdd');
  111. var todd = model.getValue(xSearchPath + '/todd');
  112. /*
  113. if(reqyn != 'CP'){
  114. if (pid.length < 2 && hngnm.length < 2) {
  115. messageBox( '환자번호 또는 환자명을 2자리 이상', 'C001' );
  116. return;
  117. }
  118. }
  119. */
  120. if (condflag == "1")
  121. {
  122. if(reqyn != 'CP'){
  123. /*
  124. if (pid.length < 2 && hngnm.length < 2) {
  125. messageBox( '환자번호 또는 환자명을 2자리 이상', 'C001' );
  126. return;
  127. }
  128. */
  129. }
  130. }
  131. else
  132. {
  133. if( ! isValidDateTime( fromdd, 'YYYYMMDD') || ! isValidDateTime( todd, 'YYYYMMDD') ){
  134. messageBox("입력하신 일자구분이 정확한 날짜타입이 아닙니다.", "E999", "");
  135. return;
  136. }
  137. if( getDateInterval(fromdd, todd) > 31 ){
  138. messageBox("조회가능한 최대 기간은 1달입니다. 일자구분에서 날짜를 수정하세요!", "E999", "");
  139. return;
  140. }
  141. if( getDateInterval(fromdd, todd) < 0 ){
  142. messageBox("일자구분에서 시작일자가 종료일자보다 미래일자 입니다. 확인하세요!", "E999", "");
  143. return;
  144. }
  145. if (hngnm.length > 0 && hngnm.length < 2) {
  146. messageBox( '환자명을 2자리 이상', 'C001' );
  147. return;
  148. }
  149. }
  150. model.removeNodeset(xSearchPath);
  151. model.makeValue(xSearchPath + '/condflag', condflag);
  152. model.makeValue(xSearchPath + '/reqyn', reqyn);
  153. model.makeValue(xSearchPath + '/pid', pid);
  154. model.makeValue(xSearchPath + '/hngnm', hngnm);
  155. model.makeValue(xSearchPath + '/fromdd', fromdd);
  156. model.makeValue(xSearchPath + '/todd', todd);
  157. model.makeValue(xSearchPath + '/opyn', opyn);
  158. if(!submit('TRARC00701', false)){
  159. messageBox('조회를', 'E009');
  160. return ;
  161. }else{
  162. model.refresh();
  163. }
  164. }
  165. /*
  166. * 그리드 더블클릭 이벤트 발생시 상단정보 올리고 의뢰환자등록 팝업 호출
  167. */
  168. function fOpen(){
  169. var mainObj = getMainViewer();
  170. var curRow = grd_list.row; //그리드에서 해당 환자 선택
  171. if (curRow < 1) return;
  172. var pid = model.getValue(xGridPath + '[' + curRow + ']/pid');
  173. var orddd = model.getValue(xGridPath + '[' + curRow + ']/indd');
  174. var cretno = model.getValue(xGridPath + '[' + curRow + ']/cretno');
  175. var instcd = model.getValue(xGridPath + '[' + curRow + ']/instcd');
  176. var acptseqno = model.getValue(xGridPath + '[' + curRow + ']/seqno');
  177. var dschdd = model.getValue(xGridPath + '[' + curRow + ']/dschdd');
  178. var indschacptstat = model.getValue(xGridPath + '[' + curRow + ']/indschacptstat');
  179. var ordtype = model.getValue(xGridPath + '[' + curRow + ']/ordtype');
  180. var curdate = getCurrentDate();
  181. if (ordtype == "E")
  182. {
  183. curdate = orddd;
  184. }
  185. else if (ordtype == "I")
  186. {
  187. if (indschacptstat == "D")
  188. {
  189. curdate = dschdd;
  190. }
  191. else if (indschacptstat == "T")
  192. {
  193. if (dschdd != "99991231")
  194. {
  195. curdate = dschdd;
  196. }
  197. }
  198. }
  199. else
  200. {
  201. ordtype = "I";
  202. if (indschacptstat == "D")
  203. {
  204. curdate = dschdd;
  205. }
  206. }
  207. //var condparam = 'I▦' + pid + '▦' + orddd + '▦' + cretno + '▦' + instcd + '▦' + curdate;
  208. var condparam = ordtype + '▦' + pid + '▦' + orddd + '▦' + cretno + '▦' + instcd + '▦' + curdate;
  209. setParameter('condparam', condparam);
  210. modal('SPMMO08900', 1, '', '', '', '', '', 'left:0; right:0; width:0; height:0; sysmenu:hidden; caption:hidden; min:hidden, max:hidden;');
  211. //open('SPARC00100',1,1,1);
  212. var curEmrRecObj = getOpenWindow("SPARC00100"); //활성화된 진료기록 화면 object loading
  213. //var curCpObj = mainObj.javascript.getOpenWindow("SPARC00100"); //활성화된 CP Main 화면 object loading
  214. //alert(curCpObj);
  215. if (curEmrRecObj != null)
  216. {
  217. curEmrRecObj.javascript.fInit();
  218. }
  219. else
  220. {
  221. //curCpObj.javascript.fInit();
  222. open("SPARC00100",1,1,1, "SPARC00100", "", "", "", false);
  223. }
  224. }