SMMNR04500.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. /*
  2. 투약기록(SMMNR04500_투약기록 조회.xrw - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. */
  6. var xCondPath = "/root/main/cond";
  7. var xDrugListPath = "/root/main/druglist/druglist";
  8. var xWardPatListPath = "/root/main/wardpatinfo/wardpatlist";
  9. var xPatInfoPath = "/root/main/paminfo/pamlist";
  10. var xDschPatInfoPath = "/root/main/patinfo/patinfolist";
  11. /**
  12. * @group :
  13. * @ver : 2007.06.23
  14. * @by : 최경용
  15. * @---------------------------------------------------
  16. * @type : function
  17. * @access : public
  18. * @desc : 투약기록 조회 초기값 셋팅 및 초기조회
  19. * @param :
  20. * @param :
  21. * @return :
  22. * @---------------------------------------------------
  23. */
  24. function fInitialize(){
  25. // 일자 초기화
  26. fnDateInit();
  27. // 환자정보 조회
  28. var sPamInfo = getGlobalVariable("paminfo");
  29. setCSVToNode("/root/main/paminfo",sPamInfo,"pamlist");
  30. var sPID = model.getValue(xPatInfoPath + "/pid");
  31. var sIndd = model.getValue(xPatInfoPath + "/indd");
  32. var sCretno = model.getValue(xPatInfoPath + "/cretno");
  33. var sWardCd = model.getValue(xPatInfoPath + "/wardcd");
  34. var sRoomCd = model.getValue(xPatInfoPath + "/roomcd");
  35. submit("TRMNR00601");
  36. grd_druglist.removeRow(true);
  37. grd_patlist.removeRow(true);
  38. if(sPID == ""){
  39. model.setValue("/root/main/cond/wardcd", getUserInfo("dutplcecd"));
  40. fGetPatList();
  41. //-----------------------------(20080906)
  42. fSetsettingrnid();
  43. //-----------------------------(20080906)
  44. fGetRoomList();
  45. }else if(model.getValue("/root/hidden/cond/pid") != ""){//보험
  46. model.setValue(xCondPath + "/pid", model.getValue("/root/hidden/cond/pid"));
  47. model.setValue(xCondPath + "/pid_search", model.getValue("/root/hidden/cond/pid"));
  48. model.setValue(xCondPath + "/indd", model.getValue("/root/hidden/cond/indd"));
  49. model.setValue(xCondPath + "/cretno", model.getValue("/root/hidden/cond/cretno"));
  50. //----------------(20080715)
  51. model.setValue(xCondPath + "/medfromdd", model.getValue("/root/hidden/cond/medrfromdd"));
  52. model.setValue(xCondPath + "/medtodd", model.getValue("/root/hidden/cond/medrtodd"));
  53. //------------------
  54. fGetPatList();
  55. //-----------------------------(20080906)
  56. fSetsettingrnid();
  57. //-----------------------------(20080906)
  58. fGetRoomList();
  59. grd_patlist.row = 1;
  60. grd_patlist.dispatch("onentercell");
  61. fGetDrugList();
  62. }else{//상단정보
  63. model.setValue(xCondPath + "/wardcd", sWardCd);
  64. fGetPatList();
  65. //-----------------------------(20080906)
  66. fSetsettingrnid();
  67. //-----------------------------(20080906)
  68. model.setValue(xCondPath + "/roomcd", sRoomCd);
  69. fGetRoomList();
  70. for(var i = 1; i <= getNodesetCount(xWardPatListPath); i++){
  71. if(model.getValue(xWardPatListPath + "[" + i + "]/pid") == sPID){
  72. model.setFocus("grd_patlist");
  73. grd_patlist.row = i;
  74. grd_patlist.dispatch("onentercell");
  75. fGetDrugList();
  76. }
  77. }
  78. }
  79. //원본 grd_druglist.frozenCols = grd_druglist.colRef("prcpvol");
  80. grd_druglist.frozenCols = grd_druglist.colRef("abbrnm"); // [TASK번호:33173] 투약기록조회 틀 고정 : ~ 경로까지_20091008(ByJA)
  81. model.refresh();
  82. }
  83. /**
  84. * @group :
  85. * @ver : 2008.09.06
  86. * @by :
  87. * @---------------------------------------------------
  88. * @type : function
  89. * @access : public
  90. * @desc : 내환자가 설정되어 있으면 자동으로 내환자설정시키기(성공)
  91. * @param :
  92. * @param :
  93. * @return :
  94. * @---------------------------------------------------
  95. */
  96. function fSetsettingrnid(){
  97. var sUserId = getUserId();
  98. var sUserIdFind = ""
  99. for(i = 1; i <= getNodesetCount("/root/main/wardpatinfo/settingrn"); i++ ) {
  100. sUserIdFind = model.getValue("/root/main/wardpatinfo/settingrn["+ i +"]/settingrnid");
  101. if (sUserId == sUserIdFind) {
  102. model.setValue("/root/main/cond/settingrnid", sUserIdFind);
  103. model.refresh();
  104. fGetPatList();
  105. return;
  106. }
  107. }
  108. }
  109. /**
  110. * @group :
  111. * @ver : 2007.06.23
  112. * @by : 최경용
  113. * @---------------------------------------------------
  114. * @type : function
  115. * @access : public
  116. * @desc : 투약기록 병동별 병실 리스트 조회
  117. * @param :
  118. * @param :
  119. * @return :
  120. * @---------------------------------------------------
  121. */
  122. function fGetRoomList(){
  123. if(model.getValue(xCondPath + "/settingrnid") == ""){
  124. model.setValue(xCondPath + "/roomflag", "");
  125. }else{
  126. model.setValue(xCondPath + "/roomflag", "settingrnid");
  127. }
  128. model.resetInstanceNode("/root/send/reqdata");
  129. model.copynode("/root/send/reqdata", xCondPath);
  130. //----------------------(20080922)
  131. model.removenodeset("/root/main/druglist/druglist");
  132. //----------------------(20080922)
  133. submit("TRMNR00602");
  134. }
  135. /**
  136. * @group :
  137. * @ver : 2007.06.23
  138. * @by : 최경용
  139. * @---------------------------------------------------
  140. * @type : function
  141. * @access : public
  142. * @desc : 투약기록 조회
  143. * @param :
  144. * @param :
  145. * @return :
  146. * @---------------------------------------------------
  147. */
  148. function fGetDrugList(){
  149. var row = grd_patlist.row;
  150. var pid = "";
  151. var indd = "";
  152. var cretno = "";
  153. //---------------------(20080510)
  154. // 환자정보 보이기
  155. if (row > 0 ) {
  156. model.setValue("/root/main/pidinfo/roomcd", model.getValue(xWardPatListPath + "[" + row + "]/roomcd"));
  157. model.setValue("/root/main/pidinfo/pid", model.getValue(xWardPatListPath + "[" + row + "]/pid"));
  158. model.setValue("/root/main/pidinfo/patnm", model.getValue(xWardPatListPath + "[" + row + "]/patnm"));
  159. model.setValue("/root/main/pidinfo/sa", model.getValue(xWardPatListPath + "[" + row + "]/sexage"));
  160. model.setValue("/root/main/pidinfo/rrgstno", model.getValue(xWardPatListPath + "[" + row + "]/rrgstno"));
  161. }
  162. //-------------------------------------------------
  163. if(model.getValue(xCondPath + "/acpstatyn") == "true"){//등록번호로 조회시
  164. //model.resetInstanceNode("/root/send/reqdata");
  165. model.setValue(xCondPath + "/pid", xCondPath + "/pid_search");
  166. model.removeNode("/root/send/reqdata");
  167. model.makeNode("/root/send/reqdata");
  168. model.copynode("/root/send/reqdata", xCondPath);
  169. submit("TRMNR04501");
  170. }else{//환자 리스트에서 조회시
  171. if(row > 0){
  172. pid = model.getValue(xWardPatListPath + "[" + row + "]/pid");
  173. indd = model.getValue(xWardPatListPath + "[" + row + "]/indd");
  174. cretno = model.getValue(xWardPatListPath + "[" + row + "]/cretno");
  175. model.setValue(xCondPath + "/pid", pid);
  176. model.setValue(xCondPath + "/indd", indd);
  177. model.setValue(xCondPath + "/cretno", cretno);
  178. //model.resetInstanceNode("/root/send/reqdata");
  179. model.removeNode("/root/send/reqdata");
  180. model.makeNode("/root/send/reqdata");
  181. model.copynode("/root/send/reqdata", xCondPath);
  182. submit("TRMNR04501");
  183. }else{
  184. messageBox("환자 리스트가 선택되지","E007");
  185. }
  186. }
  187. }
  188. /**
  189. * @group :
  190. * @ver : 2007.06.23
  191. * @by : 최경용
  192. * @---------------------------------------------------
  193. * @type : function
  194. * @access : public
  195. * @desc : 환자명 조회
  196. * @param :
  197. * @param :
  198. * @return :
  199. * @---------------------------------------------------
  200. */
  201. function fGetPatList(){
  202. model.setValue(xCondPath + "/acpstatflag", "A");//재원환자만
  203. model.resetInstanceNode("/root/send/reqdata");
  204. model.copynode("/root/send/reqdata", xCondPath);
  205. submit("TRMNR00603");
  206. }
  207. /**
  208. * @group :
  209. * @ver : 2008.05.10
  210. * @by : 김보성
  211. * @---------------------------------------------------
  212. * @type : function
  213. * @access : public
  214. * @desc : 조회일자 초기화
  215. * @param :
  216. * @param :
  217. * @return :
  218. * @---------------------------------------------------
  219. */
  220. function fnDateInit() {
  221. model.setValue("/root/main/cond/medfromdd", getDateAddc(getCurrentDate(), -7));
  222. model.setValue("/root/main/cond/medtodd", getCurrentDate());
  223. }
  224. /**
  225. * @group :
  226. * @ver : 2008.05.10
  227. * @by : 김보성
  228. * @---------------------------------------------------
  229. * @type : function
  230. * @access : public
  231. * @desc : 입원일자 정보 조회
  232. * @param :
  233. * @param :
  234. * @return :
  235. * @---------------------------------------------------
  236. */
  237. function fnhisindd() {
  238. var pGrd = grd_patlist;
  239. var row = pGrd.row;
  240. // if (row <= 1 ) return;
  241. if (bool_acptstat.value == "true") {
  242. cap_hisindd.visible = true;
  243. cbo_hisindd.visible = true;
  244. } else {
  245. cap_hisindd.visible = false;
  246. cbo_hisindd.visible = false;
  247. }
  248. //var pid = model.getValue(xWardPatListPath + "[" + row + "]/pid");
  249. var pid = model.getValue("/root/main/cond/pid_search");
  250. model.setValue(xCondPath + "/pid", pid);
  251. model.resetInstanceNode("/root/send/reqdata");
  252. model.copynode("/root/send/reqdata", xCondPath);
  253. submit("TRMNR04502");
  254. if (pid == '') return;
  255. if (cbo_hisindd.length < 1) {
  256. messageBox("입원정보가 존재하지 않습니다","E999");
  257. } else {
  258. messageBox(cbo_hisindd.length + " 건의 입원정보가 존재합니다","E999");
  259. fnhisinddmove();
  260. }
  261. }
  262. /**
  263. * @group :
  264. * @ver : 2008.05.10
  265. * @by : 김보성
  266. * @---------------------------------------------------
  267. * @type : function
  268. * @access : public
  269. * @desc : his indd -> 조회일자 이동
  270. * @param :
  271. * @param :
  272. * @return :
  273. * @---------------------------------------------------
  274. */
  275. function fnhisinddmove() {
  276. var hisindd = model.getValue("/root/main/cond/hisindd");
  277. if ( isNull(hisindd)) return;
  278. var indds = hisindd.split("-");
  279. var indd = indds[0]; //입원일자
  280. var dschdd = indds[1]; //퇴원일자
  281. var cretno = indds[2]; //입원생성번호 (20080922)
  282. var medfromdd = indd;
  283. var medtodd = ( dschdd == "99991231" ? getCurrentDate() : dschdd );
  284. var dschddM90 = medtodd.toDate().getAddDate(-90, "D").getDateFormat();
  285. if ( dschddM90 > indd ){
  286. medfromdd = dschddM90;
  287. }
  288. model.setValue("/root/main/cond/medfromdd", medfromdd);
  289. model.setValue("/root/main/cond/medtodd", medtodd);
  290. model.setValue("/root/main/cond/cretno", cretno); //---(20080922)
  291. model.setValue("/root/main/cond/indd", indd); //---(20080922)
  292. model.setValue("/root/main/cond/wardcd",""); //---(20080922)
  293. model.setValue("/root/main/cond/roomcd",""); //---(20080922)
  294. model.setValue("/root/main/cond/prcpkindcd",""); //---(20080922)
  295. model.setValue("/root/main/cond/prcpcd",""); //---(20080922)
  296. model.removenodeset("/root/main/wardpatinfo/wardpatlist"); //---(20080922)
  297. model.refresh();
  298. inp_medfromdd.refresh();
  299. inp_medtodd.refresh();
  300. }
  301. /* --------------------------------------------------*/
  302. /* type : function */
  303. /* access : public */
  304. /* desc : 환자정보 가져오기 */
  305. /* param : 검색구분 */
  306. /* return : */
  307. /* --------------------------------------------------*/
  308. function fSearchPatInfo(qryflag) {
  309. var sPath1 = "/root/main/cond";
  310. var sPath2 = "/root/main/patinfo/patinfolist";
  311. model.removenodeset("/root/temp/pidinfo");
  312. model.makeValue("/root/temp/pidinfo/pid", model.getValue(sPath1 + "/pid_search"));
  313. model.makeValue("/root/temp/pidinfo/srchcond","1");
  314. if (qryflag == "1") {
  315. model.makeValue("/root/temp/pidinfo/autoflag","Y");
  316. } else {
  317. model.makeValue("/root/temp/pidinfo/autoflag","N");
  318. }
  319. //modal("SPPMC02500", 1,10, 10, "SPPMC02500", "/root/temp", "/root/send"); 17863430
  320. //modal("../../../pam/commonweb/xrw/SPPMC02500", qryflag,"150", "150", "SPPMC02500", "/root/source", "/root/send");
  321. modal("SPPMC02500", qryflag,"150", "150", "SPPMC02500", "/root/temp/pidinfo", "/root/send");
  322. //환자번호 copy
  323. var popupendflag = model.getValue("/root/main/popupendflag");
  324. if (popupendflag == "ok"){
  325. model.setValue(sPath1 + "/pid_search" , model.getValue(sPath2 + "/pid") );
  326. model.setValue(sPath1 + "/hngnm_search", model.getValue(sPath2 + "/hngnm") );
  327. model.setValue("/root/main/pidinfo/roomcd", "");
  328. model.setValue("/root/main/pidinfo/pid", model.getValue(xDschPatInfoPath + "/pid"));
  329. model.setValue("/root/main/pidinfo/patnm", model.getValue(xDschPatInfoPath + "/hngnm"));
  330. model.setValue("/root/main/pidinfo/sa", model.getValue(xDschPatInfoPath + "/sex") + "/" + model.getValue(xDschPatInfoPath + "/age") );
  331. model.setValue("/root/main/pidinfo/rrgstno",model.getValue(xDschPatInfoPath + "/rrgstno1") + "-" + model.getValue(xDschPatInfoPath + "/rrgstno2").substring(0,1) +"******");
  332. } else {
  333. model.setValue("/root/main/pidinfo/roomcd", "");
  334. model.setValue("/root/main/pidinfo/pid", "");
  335. model.setValue("/root/main/pidinfo/patnm", "");
  336. model.setValue("/root/main/pidinfo/sa", "");
  337. model.setValue("/root/main/pidinfo/rrgstno","");
  338. }
  339. model.refresh();
  340. }
  341. /* --------------------------------------------------*/
  342. /* type : function */
  343. /* access : public */
  344. /* desc : 환자에 대한 입원정보 추출 */
  345. /* param : 검색구분 */
  346. /* return : */
  347. /* --------------------------------------------------*/
  348. function fSearchPatInddInfo() {
  349. //등록번호체크 : 이전 기능으로 막음
  350. if (model.getValue("/root/main/cond/hngnm_search") != "") {
  351. bool_acptstat.value = "true";
  352. }
  353. //콤보열기
  354. fnhisindd();
  355. model.setFocus("cbo_hisindd");
  356. cbo_hisindd.select(0);
  357. }
  358. /* --------------------------------------------------*/
  359. /* type : function */
  360. /* access : public */
  361. /* desc : 화면초기화(20080819) */
  362. /* param : */
  363. /* return : */
  364. /* --------------------------------------------------*/
  365. function fQueryinit() {
  366. // 일자 초기화
  367. fnDateInit();
  368. bool_acptstat.value = "false";
  369. // 콤보숨기기
  370. cap_hisindd.visible = false;
  371. cbo_hisindd.visible = false;
  372. // 조건 초기화
  373. model.setValue("/root/main/pidinfo/roomcd", "");
  374. model.setValue("/root/main/pidinfo/pid", "");
  375. model.setValue("/root/main/pidinfo/patnm", "");
  376. model.setValue("/root/main/pidinfo/sa", "");
  377. model.setValue("/root/main/pidinfo/rrgstno","");
  378. model.refresh();
  379. }
  380. /**
  381. * @group
  382. * @ver : 2009.06.16
  383. * @by : 최영
  384. * @---------------------------------------------------
  385. * @type : function
  386. * @access : public
  387. * @desc : 출력기능
  388. * @param :
  389. * @return :
  390. * @---------------------------------------------------
  391. */
  392. function fExecPrint(){
  393. // 출력할 데이터가 없는 경우
  394. if(getNodesetCount("/root/main/druglist/druglist")==0){
  395. messageBox("출력할 데이터가", "I004"); return;
  396. }else{
  397. model.removeNodeset("/root/hidden/druglist");
  398. model.makeNode("/root/hidden/druglist");
  399. model.copyNode("/root/hidden/druglist", "/root/main/druglist");
  400. // for(var i=1;i<grd_druglist.rows;i++) {
  401. // model.makeNode("/root/hidden/druglist/druglist["+i+"]");
  402. // model.copyNode("/root/hidden/druglist/druglist["+i+"]", "/root/main/druglist/druglist["+i+"]");
  403. // }
  404. exeReportPreview("RPMNR04500", "XMLSTR","/root/hidden/druglist","","","","","","","");
  405. model.removeNodeset("/root/hidden/druglist");
  406. }
  407. }