SMARC00800.js 8.5 KB

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