SMPIZ00200.js 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025
  1. /*
  2. - 상병관련 Function
  3. --------------------------------
  4. - fDiagSeqUp : 상병순서 위로
  5. - fDiagSeqDown : 상병순서 아래로
  6. - fSortDiagNo : 상병SORT
  7. - fDiagGridInsertRow : 행삽입
  8. - fDiagGridInsertRowMulti : 행추가(5줄)
  9. - fDiagGridDeleteRow : 행삭제
  10. - fDiagGridDeleteCancel : 삭제취소
  11. - fSearchDiageCode : 상병코드 PopUp 조회
  12. - fSearchSPPIZ00400 : 상병코드 PopUp 조회호출
  13. - fSetDiagCdNm : 상병코드 PopUp 반영
  14. */
  15. var gToday = new Date();
  16. var gBaseyear = gToday.getDateFormat("YYYY"); // (dateHelper.js)에서 제공하는 함수를 사용하여 해당 년를 구한다.
  17. var gBasemonth = gToday.getDateFormat("MM");
  18. var gBaseday = gToday.getDateFormat("DD");
  19. var gCurrentdd = gBaseyear + gBasemonth + gBaseday;
  20. var gCurrentym = gBaseyear + gBasemonth;
  21. var gClopSize = "AUTO"; // 현재상태 DEFAULT, FULL, AUTO, CHANGE
  22. // 20100614 환경초기화를 위한 로딩상태 저장
  23. var gCldihist_refdata = "";
  24. var gCldihist_sizedata = "";
  25. var gClodhist_refdata = "";
  26. var gClodhist_sizedata = "";
  27. var gClophist_refdata = "";
  28. var gClophist_sizedata = "";
  29. ///////////////////////////////////////////////////////////////////////////
  30. // 상병 Grid 마우스 오른쪽 버튼 클릭시 팝업 메뉴 "상병순서 위로"
  31. function fDiagSeqUp() {
  32. var rowstatus = grd_cldihist.rowstatus(grd_cldihist.row);
  33. if (rowstatus == 4) { // 4 : delete
  34. return;
  35. }
  36. var diagseq = parseInt(model.getValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagseq")); // 선택된 줄의 NO
  37. if (diagseq > 1) { // 첫번째 줄이 아닌 경우
  38. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagseq", --diagseq);
  39. if (rowstatus == 0 || rowstatus == 2) {
  40. grd_cldihist.rowstatus(grd_cldihist.row) = 2; // 2 : update
  41. }
  42. // 바로 위 상병순서와 중복되는 경우
  43. var nextrow = grd_cldihist.row - 1;
  44. var nextdiagseq = model.getValue(grd_cldihist.nodeset + "["+ nextrow +"]/diagseq");
  45. if (diagseq == nextdiagseq) {
  46. model.setValue(grd_cldihist.nodeset + "["+ nextrow +"]/diagseq", ++diagseq);
  47. rowstatus = grd_cldihist.rowstatus(nextrow);
  48. if (rowstatus == 0 || rowstatus == 2) {
  49. grd_cldihist.rowstatus(nextrow) = 2; // 2 : update
  50. }
  51. }
  52. // 20100329 MT002 입력체크
  53. if ( model.getValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagseq") == "1"
  54. && model.getValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/vcode") != ""
  55. ) {
  56. fSetDiagMT002(model.getValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/vcode"));
  57. }
  58. fSortDiagNo(false);
  59. }
  60. }
  61. // 상병 Grid 마우스 오른쪽 버튼 클릭시 팝업 메뉴 "상병순서 아래로"
  62. function fDiagSeqDown() {
  63. var rowstatus = grd_cldihist.rowstatus(grd_cldihist.row);
  64. if (rowstatus == 4) { // 4 : delete
  65. return;
  66. }
  67. // 삭제 상태가 아닌 마지막 줄을 찾는다.
  68. var lastRow = grd_cldihist.rows - 1;
  69. for (var i = 1; i < grd_cldihist.rows; i++) {
  70. if (grd_cldihist.rowstatus(i) == 4) { // delete
  71. lastRow = i - 1;
  72. i = grd_cldihist.rows;
  73. }
  74. }
  75. var diagseq = parseInt(model.getValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagseq")); // 선택된 줄의 NO
  76. if (diagseq < lastRow) { // 마지막 줄이 아닌 경우
  77. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagseq", ++diagseq);
  78. if (rowstatus == 0 || rowstatus == 2) {
  79. grd_cldihist.rowstatus(grd_cldihist.row) = 2; // 2 : update
  80. }
  81. // 바로 아래 상병순서와 중복되는 경우
  82. var nextrow = grd_cldihist.row + 1;
  83. var nextdiagseq = model.getValue(grd_cldihist.nodeset + "["+ nextrow +"]/diagseq");
  84. if (diagseq == nextdiagseq) {
  85. model.setValue(grd_cldihist.nodeset + "["+ nextrow +"]/diagseq", --diagseq);
  86. rowstatus = grd_cldihist.rowstatus(nextrow);
  87. if (rowstatus == 0 || rowstatus == 2) {
  88. grd_cldihist.rowstatus(nextrow) = 2; // 2 : update
  89. }
  90. }
  91. // 20100329 MT002 입력체크
  92. if ( model.getValue(grd_cldihist.nodeset + "["+ nextrow +"]/diagseq") == "1"
  93. && model.getValue(grd_cldihist.nodeset + "["+ nextrow +"]/vcode") != ""
  94. ) {
  95. fSetDiagMT002(model.getValue(grd_cldihist.nodeset + "["+ nextrow +"]/vcode"));
  96. }
  97. fSortDiagNo(false);
  98. }
  99. }
  100. // "상병순서 위로/아래로" 순서 변경 후에 상병 순서 NO에 따라 sorting 작업
  101. function fSortDiagNo(isNumbering) {
  102. var delcnt = 0;
  103. for (var i = 1; i < grd_cldihist.rows; i++) {
  104. grd_cldihist.rowHidden(i) = false;
  105. }
  106. if (isNumbering == false) {
  107. var maxRow = parseInt(grd_cldihist.rows) - 1; // rows는 타이틀부분 부터 개수를 센다
  108. grd_cldihist.sort(1, grd_cldihist.colRef("diagseq"), maxRow, grd_cldihist.colRef("diagseq")) = "asc"; // 타이틀을 제외한 data 부분의 첫 줄의 row = 1 / col = 3 : no
  109. // Sort 된 Grid 상의 Data 순서와 Instance Node 상의 Data 순서를 동일하게 맞춰준다.
  110. grd_cldihist.gridToInstance();
  111. }
  112. var cldino = 1;
  113. for (var i = 1; i < grd_cldihist.rows; i++) {
  114. // 2.----------------------------------------------------------------------
  115. if (grd_cldihist.rowstatus(i) != 4) { // delete
  116. var diagseq = model.getValue(grd_cldihist.nodeset + "["+ i +"]/diagseq");
  117. if (grd_cldihist.rowstatus(i) == 0 && diagseq != cldino) {
  118. grd_cldihist.rowstatus(i) = 2; // 2 : update
  119. }
  120. model.setValue(grd_cldihist.nodeset + "["+ i +"]/diagseq", cldino++);
  121. } else {
  122. delcnt++;
  123. }
  124. }
  125. var maxRow = parseInt(grd_cldihist.rows) - 1; // rows는 타이틀부분 부터 개수를 센다
  126. grd_cldihist.sort(1, grd_cldihist.colRef("diagseq"), maxRow, grd_cldihist.colRef("diagseq")) = "asc"; // 타이틀을 제외한 data 부분의 첫 줄의 row = 1 / col = 3 : no
  127. if (delcnt > 0) {
  128. grd_cldihist.sort(1, grd_cldihist.colRef("diagseq"), maxRow - delcnt, grd_cldihist.colRef("diagseq")) = "asc"; // 타이틀을 제외한 data 부분의 첫 줄의 row = 1 / col = 3 : no
  129. }
  130. // Sort 된 Grid 상의 Data 순서와 Instance Node 상의 Data 순서를 동일하게 맞춰준다.
  131. grd_cldihist.gridToInstance();
  132. /*
  133. model.setFocus("grd_cldihist");
  134. grd_cldihist.row = 1;
  135. */
  136. var rowstatus;
  137. for (var i = 1; i < grd_cldihist.rows; i++) {
  138. rowstatus = grd_cldihist.rowstatus(i);
  139. if (rowstatus > 3) { // 삭제상태
  140. grd_cldihist.rowHidden(i) = true;
  141. } else {
  142. grd_cldihist.rowHidden(i) = false;
  143. }
  144. }
  145. }
  146. // 사용자가 입력한 숫자를 기준으로 상병순서 부여
  147. function fChangeDiagNo() {
  148. var row = grd_cldihist.row;
  149. if (grd_cldihist.rowstatus(row) != 1 && grd_cldihist.rowstatus(row) != 3) { // 1 : insert, 3 : insert & new
  150. grd_cldihist.rowstatus(row) = 2; // 2 : update
  151. }
  152. var newseq = model.getValue(grd_cldihist.nodeset + "["+ row +"]/diagseq");
  153. var oldseq = model.getValue("/root/hidden/list1/cldi/oldseq");
  154. var vcode = model.getValue(grd_cldihist.nodeset + "["+ row +"]/vcode");
  155. if (newseq) {
  156. newseq = parseInt(model.getValue(grd_cldihist.nodeset + "["+ row +"]/diagseq"), 10); // '09' 와 같은 형식으로 입력한 경우 -> 9로 처리
  157. // 삭제상태가 아닌 중복된 번호가 있는지 체크한다.
  158. var sameRow = 0;
  159. for (var i = 1; i < grd_cldihist.rows; i++) {
  160. var diagseq = model.getValue(grd_cldihist.nodeset + "["+ i +"]/diagseq");
  161. if (row != i && diagseq == newseq) {
  162. sameRow = i;
  163. i = grd_cldihist.rows;
  164. }
  165. }
  166. if (sameRow > 0) { // 중복된 상병순서의 row가 있음
  167. if (newseq < oldseq) { // 이전보다 앞번호를 입력한 경우
  168. for (var j = sameRow; j < row; j++) {
  169. var rowstatus = grd_cldihist.rowstatus(j);
  170. if (rowstatus != 4) {
  171. var curseq = parseInt(model.getValue(grd_cldihist.nodeset + "["+ j +"]/diagseq"), 10);
  172. if (rowstatus != 1 && rowstatus != 3) {
  173. if (model.getValue(grd_cldihist.nodeset + "["+ j +"]/diagseq") != (curseq+1)) {
  174. grd_cldihist.rowstatus(j) = 2;
  175. }
  176. }
  177. model.setValue(grd_cldihist.nodeset + "["+ j +"]/diagseq", curseq+1);
  178. }
  179. }
  180. }
  181. else { // 이전보다 뒷번호를 입력한 경우
  182. for (var j = row+1; j <= sameRow; j++) {
  183. var rowstatus = grd_cldihist.rowstatus(j);
  184. if (rowstatus != 4) {
  185. var curseq = parseInt(model.getValue(grd_cldihist.nodeset + "["+ j +"]/diagseq"), 10);
  186. if (rowstatus != 1 && rowstatus != 3) {
  187. if (model.getValue(grd_cldihist.nodeset + "["+ j +"]/diagseq") != (curseq-1)) {
  188. grd_cldihist.rowstatus(j) = 2;
  189. }
  190. }
  191. model.setValue(grd_cldihist.nodeset + "["+ j +"]/diagseq", curseq-1);
  192. }
  193. }
  194. }
  195. fSortDiagNo(false);
  196. fDiagGridInsertRow("Y", "N"); // 상병마지막 그리드에 한 20090918 정승우
  197. // 20100329 MT002 입력체크
  198. if ( newseq == "1" && oldseq != "1" && vcode != "") {
  199. fSetDiagMT002(vcode);
  200. }
  201. } else { // 중복된 상병순서의 row가 없는 경우
  202. fSortDiagNo(false); // 현재 부여된 순번으로 sort 후
  203. fDiagGridInsertRow("Y", "N"); // 상병마지막 그리드에 한 20090918 정승우
  204. }
  205. } else { // 순번을 삭제한 경우
  206. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagseq", oldseq);
  207. grd_cldihist.rowstatus(row) = model.getValue("/root/hidden/list1/cldi/oldrowstat");
  208. //model.refresh();
  209. grd_cldihist.refresh();
  210. fDiagGridInsertRow("Y", "N"); // 상병마지막 그리드에 한
  211. }
  212. }
  213. // 상병 Grid 마우스 오른쪽 버튼 클릭시 팝업 메뉴 "행 삽입"
  214. function fDiagGridInsertRow(addyn, selectyn) {
  215. var iInsertRow = 0;
  216. if (grd_cldihist.rows == 1 || addyn == "Y") {
  217. iInsertRow = grd_cldihist.row;
  218. grd_cldihist.addRow(true, false);
  219. } else {
  220. iInsertRow = grd_cldihist.row;
  221. grd_cldihist.insertRow(iInsertRow, "below", true);
  222. }
  223. var nowRow = 0;
  224. nowRow = grd_cldihist.row;
  225. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagkindcd", "C");
  226. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagseq", grd_cldihist.row);
  227. // 청구과, 진료개시일은 주상병을 기준으로 부여한다.
  228. var clamdeptcd = model.getValue(grd_cldihist.nodeset + "/clamdeptcd");
  229. if (clamdeptcd == "") { // 주상병의 진료과가 입력되지 않은 경우 인적사항의 청구과를 입력한다.
  230. clamdeptcd = model.getValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/clamdeptcd");
  231. }
  232. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/clamdeptcd", clamdeptcd);
  233. var ordfromdd = model.getValue(grd_cldihist.nodeset + "/ordfromdd");
  234. if (ordfromdd) {
  235. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/ordfromdd", ordfromdd);
  236. } else {
  237. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/ordfromdd", model.getValue(grd_diaghistlist.nodetset + "[" + grd_diaghistlist.row + "]/ordfromdd"));
  238. }
  239. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/toot", "-");
  240. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/vcode", ""); // 20100308 추가
  241. // 상병이력조회에서 호출된 경우가 아니면
  242. if (selectyn != "Y") {
  243. fSortDiagNo(true);
  244. }
  245. // edit mode 설정위한것임 절대 지우지 말것.
  246. grd_cldihist.refresh();
  247. if (addyn != "Y") {
  248. grd_cldihist.row = nowRow;
  249. grd_cldihist.col = grd_cldihist.colRef("diagcd");
  250. grd_cldihist.dispatch("onentercell");
  251. }
  252. }
  253. // 상병 Grid 마우스 오른쪽 버튼 클릭시 팝업 메뉴 "행 추가"
  254. function fDiagGridAddRow() {
  255. grd_cldihist.insertRow(grd_cldihist.rows - 1, "below", false);
  256. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagkindcd", "C");
  257. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagseq", grd_cldihist.row);
  258. // 청구과, 진료개시일은 주상병을 기준으로 부여한다.
  259. var clamdeptcd = model.getValue(grd_cldihist.nodeset + "/clamdeptcd");
  260. if (clamdeptcd == "") { // 주상병의 진료과가 입력되지 않은 경우 인적사항의 청구과를 입력한다.
  261. clamdeptcd = model.getValue(grd_cldihist.nodeset + "/clamdeptcd");
  262. }
  263. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/clamdeptcd", clamdeptcd);
  264. var ordfromdd = model.getValue(grd_cldihist.nodeset + "/ordfromdd");
  265. if (ordfromdd) {
  266. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/ordfromdd", ordfromdd);
  267. } else {
  268. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/ordfromdd", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/ordfromdd"));
  269. }
  270. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/toot", "-");
  271. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/vcode", ""); // 20100308 추가
  272. grd_cldihist.refresh();
  273. fSortDiagNo(true);
  274. // edit mode 설정위한것임 절대 지우지 말것.
  275. grd_cldihist.refresh();
  276. grd_cldihist.row = grd_cldihist.rows -1;
  277. grd_cldihist.col = grd_cldihist.colRef("diagcd");
  278. grd_cldihist.dispatch("onentercell");
  279. }
  280. // 상병 Grid 마우스 오른쪽 버튼 클릭시 팝업 메뉴 "행 추가(5줄)"
  281. function fDiagGridInsertRowMulti() {
  282. for (var i = 1; i <= 5; i++) {
  283. grd_cldihist.insertRow(grd_cldihist.rows - 1, "below", false);
  284. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagkindcd", "C");
  285. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagseq", grd_cldihist.row);
  286. // 청구과, 진료개시일은 주상병을 기준으로 부여한다.
  287. var clamdeptcd = model.getValue(grd_cldihist.nodeset + "/clamdeptcd");
  288. if (clamdeptcd == "") { // 주상병의 진료과가 입력되지 않은 경우 인적사항의 청구과를 입력한다.
  289. clamdeptcd = model.getValue(grd_cldihist.nodeset + "/clamdeptcd");
  290. }
  291. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/clamdeptcd", clamdeptcd);
  292. var ordfromdd = model.getValue(grd_cldihist.nodeset + "/ordfromdd");
  293. if (ordfromdd) {
  294. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/ordfromdd", ordfromdd);
  295. } else {
  296. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/ordfromdd", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/ordfromdd"));
  297. }
  298. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/toot", "-");
  299. model.setValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/vcode", ""); // 20100308 추가
  300. }
  301. grd_cldihist.refresh();
  302. fSortDiagNo(true);
  303. // edit mode 설정위한것임 절대 지우지 말것.
  304. grd_cldihist.refresh();
  305. grd_cldihist.row = grd_cldihist.rows - 5;
  306. grd_cldihist.col = grd_cldihist.colRef("diagcd");
  307. grd_cldihist.dispatch("onentercell");
  308. }
  309. // 상병 Grid 마우스 오른쪽 버튼 클릭시 팝업 메뉴 "행 삭제"
  310. function fDiagGridDeleteRow() {
  311. // 여러 row를 동시에 선택하고 삭제하는 기능을 부여한다.
  312. for (var i = 0; i < grd_cldihist.selectedRows; i++) {
  313. var row = grd_cldihist.selectedrow(i);
  314. var rowstatus = grd_cldihist.rowstatus(row);
  315. if (rowstatus == 4) { // 4 : delete
  316. //return;
  317. }
  318. else if ( (rowstatus == 1 || rowstatus == 3) && rowstatus != 0) { // 1 : insert, 3 : insert & new
  319. model.resetInstanceNode(grd_cldihist.nodeset + "["+ row +"]/diagcd");
  320. model.resetInstanceNode(grd_cldihist.nodeset + "["+ row +"]/diagnm");
  321. model.resetInstanceNode(grd_cldihist.nodeset + "["+ row +"]/diagengnm");
  322. grd_cldihist.deleteRow(row, false); // 해당 라인을 Grid에서 삭제한다.
  323. } else { // 0 : new, 2 : update
  324. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagseq", "D"+row);
  325. grd_cldihist.rowstatus(row) = 4; // 4 : delete 상태로 stat를 변경한다.
  326. }
  327. }
  328. fSortDiagNo(true);
  329. }
  330. // 상병 Grid 마우스 오른쪽 버튼 클릭시 팝업 메뉴 "삭제 취소"
  331. function fDiagGridDeleteCancel() {
  332. // 여러 row를 동시에 선택하고 삭제취소하는 기능을 부여한다.
  333. for (var i = 0; i < grd_cldihist.selectedRows; i++) {
  334. var row = grd_cldihist.selectedrow(i);
  335. var rowstatus = grd_cldihist.rowstatus(row);
  336. if (rowstatus == 4) { // 4 : delete
  337. grd_cldihist.rowstatus(row) = 2 // 2 : update 상태로 stat를 변경한다.
  338. }
  339. }
  340. fSortDiagNo(true);
  341. }
  342. // 상병코드를 조회하여 해당 정보를 표시하거나 상병코드 조회용 Popup을 호출한다.
  343. function fSearchDiageCode() {
  344. var row = grd_cldihist.row;
  345. var diagcd = model.getValue(grd_cldihist.nodeset + "["+ row +"]/diagcd");
  346. if (diagcd) {
  347. model.removeNodeset("/root/hidden/sppiz00400/rslt");
  348. // 상병 Data가 2007년 이후로 설정되어 있으므로 임시로 현재 날짜를 넘긴다.
  349. //model.makeValue("/root/hidden/sppiz00400/cond/basedd", model.getValue("/root/main/item1/clbs/clamym"));
  350. model.resetInstanceNode("/root/hidden/sppiz00400/cond");
  351. model.makeValue("/root/hidden/sppiz00400/cond/basedd", getCurrentDate()); // (dateHelper.js) 현재날짜 반환
  352. model.makeValue("/root/hidden/sppiz00400/cond/diagcd", diagcd);
  353. model.makeValue("/root/hidden/sppiz00400/cond/diagnm", "");
  354. model.makeValue("/root/hidden/sppiz00400/cond/selectedrdodiagkind","1");
  355. submit("TRPID20306"); // 입력된 상병코드로 emr.mrtmicd10 테이블을 조회한다.
  356. /*
  357. var nodeList = instance1.selectNodes("/root/init/diagcd/diagcdlist[diagcd='" + diagcd + "']");
  358. if (nodeList.length == 1) {
  359. //model.makeNode("/root/hidden/srchdiagcd");
  360. //model.copyNode("/root/hidden/srchdiagcd", nodeList);
  361. var diagListCSV = getNodeListCSV(nodeList);
  362. diagList1 = diagListCSV.split("▩");
  363. diagList2 = diagList1[1].split("▦");
  364. model.makeValue("/root/hidden/sppiz00400/rslt/diagcd", diagList2[0]);
  365. model.makeValue("/root/hidden/sppiz00400/rslt/diaghngnm", diagList2[1]);
  366. model.makeValue("/root/hidden/sppiz00400/rslt/diagengnm", diagList2[2]);
  367. }
  368. */
  369. var rsltList = instance1.selectSingleNode("/root/hidden/sppiz00400/rslt");
  370. if (rsltList != null && rsltList.length == 0) {
  371. // 조회된 결과가 1건이면
  372. fSetDiagCdNm();
  373. // 다음칸에 자동 포커스 2008-11-26
  374. row++;
  375. grd_cldihist.row = row;
  376. grd_cldihist.col = grd_cldihist.colRef("diagcd");
  377. grd_cldihist.dispatch("onentercell");
  378. } else {
  379. // 조회된 결과가 없거나 여러 건이면
  380. // 상병코드 조회를 위해 SPPIZ00400_상병코드조회.xrw 를 호출한다.
  381. fSearchSPPIZ00400();
  382. if (model.getValue(grd_cldihist.nodeset + "["+ row +"]/diagnm") == "" && model.getValue(grd_cldihist.nodeset + "["+ row +"]/diagengnm") == "") {
  383. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagcd", model.getValue("/root/hidden/list1/cldi/olddiagcd"));
  384. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagnm", model.getValue("/root/hidden/list1/cldi/olddiagnm"));
  385. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagengnm", model.getValue("/root/hidden/list1/cldi/oldengnm"));
  386. grd_cldihist.rowstatus(row) = model.getValue("/root/hidden/list1/cldi/oldrowstat");
  387. grd_cldihist.refresh();
  388. return;
  389. } else {
  390. // 다음칸에 자동 포커스 2008-11-26
  391. row++;
  392. if (row < grd_cldihist.rows) {
  393. grd_cldihist.row = row;
  394. grd_cldihist.col = grd_cldihist.colRef("diagcd");
  395. grd_cldihist.dispatch("onentercell");
  396. }
  397. }
  398. }
  399. } else {
  400. // 상병 Grid에 상병코드를 입력하지 않고 Enter 친 경우
  401. // 상병코드 조회를 위해 SPPIZ00400_상병코드조회.xrw 를 호출한다.
  402. fSearchSPPIZ00400();
  403. // 다음칸에 자동 포커스 2008-11-26
  404. row++;
  405. grd_cldihist.row = row;
  406. grd_cldihist.col = grd_cldihist.colRef("diagcd");
  407. grd_cldihist.dispatch("onentercell");
  408. if (model.getValue(grd_cldihist.nodeset + "["+ row +"]/diagcd") == "") {
  409. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagcd", model.getValue("/root/hidden/list1/cldi/olddiagcd"));
  410. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagnm", model.getValue("/root/hidden/list1/cldi/olddiagnm"));
  411. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagengnm", model.getValue("/root/hidden/list1/cldi/oldengnm"));
  412. grd_cldihist.rowstatus(row) = model.getValue("/root/hidden/list1/cldi/oldrowstat");
  413. grd_cldihist.refresh();
  414. return;
  415. }
  416. }
  417. // 삭제 상태였던 상병코드를 조회하여 수정한 경우를 위해 순번을 다시 부여한다.
  418. // 2008-11-26
  419. // fSortDiagNo(true);
  420. }
  421. // 상병코드 조회를 위해 SPPIZ00400_상병코드조회.xrw 를 호출한다.
  422. function fSearchSPPIZ00400() {
  423. model.removeNodeset("/root/hidden/sppiz00400/rslt");
  424. model.makeNode("/root/hidden/sppiz00400/rslt/diagcd");
  425. model.makeNode("/root/hidden/sppiz00400/rslt/diaghngnm");
  426. model.makeNode("/root/hidden/sppiz00400/rslt/diagengnm");
  427. model.resetInstanceNode("/root/hidden/sppiz00400/cond");
  428. model.setValue("/root/hidden/sppiz00400/cond/basedd", getCurrentDate()); // (dateHelper.js) 현재날짜 반환
  429. model.setValue("/root/hidden/sppiz00400/cond/diagcd", model.getValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagcd"));
  430. model.setValue("/root/hidden/sppiz00400/cond/diagnm", "");
  431. model.setValue("/root/hidden/sppiz00400/cond/selectedrdodiagkind","3"); // 사용자가 직접검색하여 입력 할수 있도록 임의의 값(3)을 넣어줌
  432. modal("SPPIZ00400", "1", "10", "10", "SPPIZ00400", "/root/hidden/sppiz00400/cond", "/root/init", "", ""); // SPPIZ00400_상병코드조회.xrw
  433. }
  434. // [SPPIZ00400_상병코드조회.xrw 에서 호출] 상병코드조회 팝업에서 선택한 상병을 상병 그리드에 반영
  435. function fSetDiagCdNm() {
  436. var row = grd_cldihist.row;
  437. if (row > 0) {
  438. var diagcd = model.getValue("/root/hidden/sppiz00400/rslt/diagcd");
  439. var diaghngnm = model.getValue("/root/hidden/sppiz00400/rslt/diaghngnm");
  440. var diagengnm = model.getValue("/root/hidden/sppiz00400/rslt/diagengnm");
  441. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagcd", diagcd);
  442. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagnm", diaghngnm);
  443. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagengnm", diagengnm);
  444. // 해당 상병의 한글상병명과 영문상병명이 Message 용 output 컨트롤에 표시된다.
  445. model.setValue("/root/hidden/list3/msgspclformat", "상병코드 - "+ diagcd +" / "+ diaghngnm +" / "+ diagengnm);
  446. // 20100308 특정내역 조회 추가
  447. model.setValue(grd_cldihist.nodeset + "["+ row +"]/vcode", fGetDiagVcode(diagcd));
  448. // 20100329 MT002 입력체크
  449. if ( model.getValue(grd_cldihist.nodeset + "["+ row +"]/diagseq") == "1"
  450. && model.getValue(grd_cldihist.nodeset + "["+ row +"]/vcode") != ""
  451. ) {
  452. fSetDiagMT002(model.getValue(grd_cldihist.nodeset + "["+ row +"]/vcode"));
  453. }
  454. //20090918 정승우 행추가
  455. var addval1 = model.getValue("/root/main/list1/diag["+ row +"]/rowstat");
  456. var addval2 = grd_cldihist.rowstatus(row);
  457. var rowstatus = grd_cldihist.rowstatus(row);
  458. if (rowstatus != 1 && rowstatus != 3) { // 1 : insert, 3 : insert & new
  459. grd_cldihist.rowstatus(row) = 2; // 2 : update
  460. }
  461. // 4. 빈 row에 대한 입력은 행 추가를 발생시킨다. (그외에는 행추가가 일어나지 않는다.)
  462. //20090918 정승우 행추가
  463. if (addval1 == "" && (addval2 == 1 || addval2 == 3)) fDiagGridInsertRow("Y", "N");
  464. }
  465. }
  466. // 20100329 김용민 추가 상병row 로 MT002 입력
  467. // incode null 경우는 주상병의 특정기호 체크, null아니면 바로입력체크
  468. function fSetDiagMT002(incode) {
  469. var gridrowstatus = "";
  470. var existsyn = "N";
  471. var vcode = "";
  472. if ( incode == "" ) {
  473. for (var i = 1; i < grd_cldihist.rows; i++) {
  474. if ( grd_cldihist.rowHidden(i) == false
  475. && model.getValue(grd_cldihist.nodeset + "["+ i +"]/diagseq") == "1"
  476. && model.getValue(grd_cldihist.nodeset + "["+ i +"]/vcode") != ""
  477. ) {
  478. vcode = model.getValue(grd_cldihist.nodeset + "["+ i +"]/vcode")
  479. break;
  480. }
  481. }
  482. } else {
  483. vcode = incode;
  484. }
  485. if ( vcode != "" ) {
  486. for (var i = 1; i < grd_clsphist.rows; i++) {
  487. spclcd = model.getValue("/root/main/list3/clsp["+ i +"]/spclcd");
  488. spclspec = model.getValue("/root/main/list3/clsp["+ i +"]/spclspec");
  489. gridrowstatus = grd_clsphist.rowstatus(i);
  490. if ( vcode == spclspec && spclcd == "MT002" && gridrowstatus != 4 ) {
  491. existsyn = "Y";
  492. }
  493. }
  494. if ( existsyn != "Y" ) {
  495. var ans = messageBox( vcode + " 상병입니다.\n\n"
  496. + "MT002 특정내역을 \n\n"
  497. + "입력"
  498. , "S001");
  499. if ( ans == 6 ) { // yes
  500. var clsprow = grd_clsphist.rows - 1; // 특정내역 Grid 가장 마지막 줄에 추가한다.
  501. grd_clsphist.insertRow(clsprow++, true);
  502. model.setValue("/root/main/list3/clsp["+ clsprow +"]/unitflag", "M");
  503. model.setValue("/root/main/list3/clsp["+ clsprow +"]/edilnno", 0);
  504. model.setValue("/root/main/list3/clsp["+ clsprow +"]/snglcalcscorcd", "-");
  505. model.setValue("/root/main/list3/clsp["+ clsprow +"]/spclcd", "MT002");
  506. model.setValue("/root/main/list3/clsp["+ clsprow +"]/cdnm", "특정기호");
  507. model.setValue("/root/main/list3/clsp["+ clsprow +"]/spclspec", vcode);
  508. model.setValue("/root/main/list3/clsp["+ clsprow +"]/spclformat", "X(4)");
  509. model.setValue("/root/main/list3/clsp["+ clsprow +"]/detldesc", "");
  510. model.setValue("/root/main/list3/clsp["+ clsprow +"]/oldedilnno", "");
  511. model.setValue("/root/main/list3/clsp["+ clsprow +"]/clodseqno", "");
  512. // 특정내역 줄번호/특정코드에 따라 sorting 작업
  513. fSortSpclNo();
  514. grd_clsphist.refresh();
  515. }
  516. }
  517. }
  518. }
  519. // 20100308 김용민 추가 (상병코드로 특정기호 조회)
  520. function fGetDiagVcode(diagcd) {
  521. var vcode = "";
  522. var spclcd = "";
  523. var spclspec = "";
  524. var gridrowstatus = "";
  525. var existsyn = "N";
  526. model.removeNodeset("/root/hidden/getvcode");
  527. model.makeValue("/root/hidden/getvcode/cond/diagcd" ,diagcd);
  528. model.makeValue("/root/hidden/getvcode/cond/ioflag" ,model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/ioflagcd"));
  529. model.makeValue("/root/hidden/getvcode/cond/insukind" ,model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/insukindcd"));
  530. model.makeValue("/root/hidden/getvcode/cond/suppkind" ,model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/suppkindcd"));
  531. model.makeValue("/root/hidden/getvcode/cond/ordfromdd",model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/ordfromdd"));
  532. model.makeValue("/root/hidden/getvcode/rslt/vcode","");
  533. submit("TRPID20313"); // 상병코드로 특정기호 조회
  534. vcode = model.getValue("/root/hidden/getvcode/rslt/vcode")
  535. /*
  536. //////////////////////////////////////////
  537. // 반환전에 특정내역 입력한다.
  538. //////////////////////////////////////////
  539. if ( vcode != "" ) {
  540. for (var i = 1; i < grd_clsphist.rows; i++) {
  541. spclcd = model.getValue("/root/main/list3/clsp["+ i +"]/spclcd");
  542. spclspec = model.getValue("/root/main/list3/clsp["+ i +"]/spclspec");
  543. gridrowstatus = grd_clsphist.rowstatus(i);
  544. if ( vcode == spclspec && spclcd == 'MT002' && gridrowstatus != 4 ) {
  545. existsyn = "Y";
  546. }
  547. }
  548. if ( existsyn != "Y" ) {
  549. var ans = messageBox( vcode + " 상병입니다.\n\n"
  550. + "MT002 특정내역을 \n\n"
  551. + "입력"
  552. , "S001");
  553. if ( ans == 6 ) { // yes
  554. var clsprow = grd_clsphist.rows - 1; // 특정내역 Grid 가장 마지막 줄에 추가한다.
  555. grd_clsphist.insertRow(clsprow++, true);
  556. model.setValue("/root/main/list3/clsp["+ clsprow +"]/unitflag", "M");
  557. model.setValue("/root/main/list3/clsp["+ clsprow +"]/edilnno", 0);
  558. model.setValue("/root/main/list3/clsp["+ clsprow +"]/snglcalcscorcd", "-");
  559. model.setValue("/root/main/list3/clsp["+ clsprow +"]/spclcd", "MT002");
  560. model.setValue("/root/main/list3/clsp["+ clsprow +"]/cdnm", "특정기호");
  561. model.setValue("/root/main/list3/clsp["+ clsprow +"]/spclspec", vcode);
  562. model.setValue("/root/main/list3/clsp["+ clsprow +"]/spclformat", "X(4)");
  563. model.setValue("/root/main/list3/clsp["+ clsprow +"]/detldesc", "");
  564. model.setValue("/root/main/list3/clsp["+ clsprow +"]/oldedilnno", "");
  565. model.setValue("/root/main/list3/clsp["+ clsprow +"]/clodseqno", "");
  566. // 특정내역 줄번호/특정코드에 따라 sorting 작업
  567. fSortSpclNo();
  568. grd_clsphist.refresh();
  569. }
  570. }
  571. }
  572. //////////////////////////////////////////
  573. */
  574. return vcode;
  575. }
  576. ///////////////////////////////////////////////////////////////////////////
  577. // 팝업 화면 호출
  578. function fLinkPopMenu(trgtWindow, cond, send) {
  579. var trgtManWindow = getChildWindow(trgtWindow);
  580. if (trgtManWindow == null) {
  581. var childCnt = window.children.length;
  582. if (childCnt < 4) {
  583. open(trgtWindow, "2", "10", "10", trgtWindow, cond, send, "", "");
  584. } else {
  585. messageBox("최대 4개의 팝업 화면을 표시할 수 있으니 현재 열려있는 화면을", "I007"); ///최대 4개의 팝업 화면을 표시할 수 있으니 현재 열려있는 화면을 확인하십시오.
  586. }
  587. } else {
  588. activateChild(trgtWindow);
  589. }
  590. }
  591. // 상병코드 조회를 위해 SPPIZ00400_상병코드조회.xrw 를 호출한다.
  592. function fSearchSPPIZ00400() {
  593. model.removeNodeset("/root/hidden/sppiz00400/rslt");
  594. model.makeNode("/root/hidden/sppiz00400/rslt/diagcd");
  595. model.makeNode("/root/hidden/sppiz00400/rslt/diaghngnm");
  596. model.makeNode("/root/hidden/sppiz00400/rslt/diagengnm");
  597. model.makeNode("/root/hidden/sppiz00400/cond");
  598. model.resetInstanceNode("/root/hidden/sppiz00400/cond");
  599. model.makeValue("/root/hidden/sppiz00400/cond/basedd", getCurrentDate()); // (dateHelper.js) 현재날짜 반환
  600. model.makeValue("/root/hidden/sppiz00400/cond/diagcd", model.getValue(grd_cldihist.nodeset + "["+ grd_cldihist.row +"]/diagcd"));
  601. model.makeValue("/root/hidden/sppiz00400/cond/diagnm", "");
  602. model.makeValue("/root/hidden/sppiz00400/cond/selectedrdodiagkind","3"); // 사용자가 직접검색하여 입력 할수 있도록 임의의 값(3)을 넣어줌
  603. modal("SPPIZ00400", "1", "10", "10", "SPPIZ00400", "/root/hidden/sppiz00400/cond", "/root/init", "", ""); // SPPIZ00400_상병코드조회.xrw
  604. }
  605. // [SPPIZ00400_상병코드조회.xrw 에서 호출] 상병코드조회 팝업에서 선택한 상병을 상병 그리드에 반영
  606. function fSetDiagCdNm() {
  607. var row = grd_cldihist.row;
  608. if (row > 0) {
  609. var diagcd = model.getValue("/root/hidden/sppiz00400/rslt/diagcd");
  610. var diaghngnm = model.getValue("/root/hidden/sppiz00400/rslt/diaghngnm");
  611. var diagengnm = model.getValue("/root/hidden/sppiz00400/rslt/diagengnm");
  612. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagcd", diagcd);
  613. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagnm", diaghngnm);
  614. model.setValue(grd_cldihist.nodeset + "["+ row +"]/diagengnm", diagengnm);
  615. model.setValue(grd_cldihist.nodeset + "["+ row +"]/clamdeptcd", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/clamdeptcd"));
  616. model.setValue(grd_cldihist.nodeset + "["+ row +"]/ordfromdd", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/ordfromdd"));
  617. // 해당 상병의 한글상병명과 영문상병명이 Message 용 output 컨트롤에 표시된다.
  618. // model.setValue("/root/hidden/list3/msgspclformat", "상병코드 - "+ diagcd +" / "+ diaghngnm +" / "+ diagengnm);
  619. // 20100308 특정내역 조회 추가
  620. model.setValue(grd_cldihist.nodeset + "["+ row +"]/vcode", fGetDiagVcode(diagcd));
  621. // 20100329 MT002 입력체크
  622. if ( model.getValue(grd_cldihist.nodeset + "["+ row +"]/diagseq") == "1"
  623. && model.getValue(grd_cldihist.nodeset + "["+ row +"]/vcode") != ""
  624. ) {
  625. fSetDiagMT002(model.getValue(grd_cldihist.nodeset + "["+ row +"]/vcode"));
  626. }
  627. //20090918 정승우 행추가
  628. var addval1 = model.getValue(grd_cldihist.nodeset + "["+ row +"]/rowstat");
  629. var addval2 = grd_cldihist.rowstatus(row);
  630. var rowstatus = grd_cldihist.rowstatus(row);
  631. if (rowstatus != 1 && rowstatus != 3) { // 1 : insert, 3 : insert & new
  632. grd_cldihist.rowstatus(row) = 2; // 2 : update
  633. }
  634. // 4. 빈 row에 대한 입력은 행 추가를 발생시킨다. (그외에는 행추가가 일어나지 않는다.)
  635. //20090918 정승우 행추가
  636. if (addval1 == "" && (addval2 == 1 || addval2 == 3)) fDiagGridInsertRow("Y", "N");
  637. }
  638. }
  639. ///////////////////////////////////////////////////////////////////////////
  640. // 상병 및 처방 치식 입력
  641. function fDiagOrderToothInput(flag) {
  642. if (flag == "Diag") {
  643. var row = grd_cldihist.row;
  644. var diagcd = model.getValue(grd_cldihist.nodeset + "["+ row +"]/diagcd");
  645. if (diagcd) {
  646. model.makeValue("/root/hidden/sppiz00600/cond/clamym", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/clamym"));
  647. model.makeValue("/root/hidden/sppiz00600/cond/clamdg", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/clamdg"));
  648. model.makeValue("/root/hidden/sppiz00600/cond/pid", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/pid"));
  649. model.makeValue("/root/hidden/sppiz00600/cond/pidsn", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/pidsn"));
  650. model.makeValue("/root/hidden/sppiz00600/cond/indd", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/indd"));
  651. model.makeValue("/root/hidden/sppiz00600/cond/cretno", model.getValue(grd_diaghistlist.nodeset + "[" + grd_diaghistlist.row + "]/cretno"));
  652. model.makeValue("/root/hidden/sppiz00600/cond/toot", model.getValue(grd_cldihist.nodeset + "[" + row + "]/toot"));
  653. fSetToothPop(row, "1");
  654. model.removeNodeset("/root/hidden/sppiz00600/rslt"); // SPPIZ00600_상병및처방별치식 에서 선택된 결과가 copyNode되는 경로임
  655. modal("SPPIZ00600", "1", "10", "10", "SPPIZ00600", "/root/hidden/sppiz00600/cond", "/root/hidden/cond", "", ""); // SPPIZ00600_상병및처방별치식.xrw
  656. fGetToothPop();
  657. }
  658. }
  659. else if (flag == "Order") {
  660. var row = grd_clodhist.row;
  661. var edilnno = model.getValue("/root/main/list2/clod["+ row +"]/edilnno");
  662. if (edilnno) {
  663. model.setValue("/root/hidden/sppiz00600/cond/clamym", model.getValue("/root/main/item1/clbs/clamym"));
  664. model.setValue("/root/hidden/sppiz00600/cond/clamdg", model.getValue("/root/main/item1/clbs/clamdg"));
  665. model.setValue("/root/hidden/sppiz00600/cond/pid", model.getValue("/root/main/item1/clbs/pid"));
  666. model.setValue("/root/hidden/sppiz00600/cond/pidsn", model.getValue("/root/main/item1/clbs/pidsn"));
  667. model.setValue("/root/hidden/sppiz00600/cond/indd", model.getValue("/root/main/item1/clbs/indd"));
  668. model.setValue("/root/hidden/sppiz00600/cond/cretno", model.getValue("/root/main/item1/clbs/cretno"));
  669. model.setValue("/root/hidden/sppiz00600/cond/toot", model.getValue("/root/main/list2/clod["+ row +"]/toot"));
  670. fSetToothPop(row, "2");
  671. model.removeNodeset("/root/hidden/sppiz00600/rslt"); // SPPIZ00600_상병및처방별치식 에서 선택된 결과가 copyNode되는 경로임
  672. modal("SPPIZ00600", "1", "10", "10", "SPPIZ00600", "/root/hidden/sppiz00600/cond", "/root/hidden/cond", "", ""); // SPPIZ00600_상병및처방별치식.xrw
  673. fGetToothPop();
  674. }
  675. }
  676. }
  677. //대상자에서 치식자동팝업체크시 타는 로직
  678. function fDiagOrderToothInputDiret(flag) {
  679. var trgtManWindow = getChildWindow("SPPIZ00600ML"); // SPPIZ00600_상병및처방별치식.xrw
  680. var row = "1";
  681. if (flag == "Diag") {
  682. //var diagcd = model.getValue("/root/main/list1/cldi["+ row +"]/diagcd");
  683. //if (diagcd) {
  684. model.setValue("/root/hidden/sppiz00600/cond/clamym", model.getValue("/root/main/item1/clbs/clamym"));
  685. model.setValue("/root/hidden/sppiz00600/cond/clamdg", model.getValue("/root/main/item1/clbs/clamdg"));
  686. model.setValue("/root/hidden/sppiz00600/cond/pid", model.getValue("/root/main/item1/clbs/pid"));
  687. model.setValue("/root/hidden/sppiz00600/cond/pidsn", model.getValue("/root/main/item1/clbs/pidsn"));
  688. model.setValue("/root/hidden/sppiz00600/cond/indd", model.getValue("/root/main/item1/clbs/indd"));
  689. model.setValue("/root/hidden/sppiz00600/cond/cretno", model.getValue("/root/main/item1/clbs/cretno"));
  690. model.setValue("/root/hidden/sppiz00600/cond/toot", model.getValue("/root/main/list1/cldi["+ row +"]/toot"));
  691. model.setValue("/root/hidden/sppiz00600/cond/popyn", "SMPID20500");
  692. fSetToothPop(row, "1");
  693. model.removeNodeset("/root/hidden/sppiz00600/rslt"); // SPPIZ00600_상병및처방별치식 에서 선택된 결과가 copyNode되는 경로임
  694. if ( trgtManWindow == null ) {
  695. //open("SPPIZ00600", "1", "10", "10", "SPPIZ00600", "/root/hidden/sppiz00600/cond", "/root/hidden/cond", "", ""); // SPPIZ00600_상병및처방별치식.xrw
  696. //open("SPPIZ00600", "2", "10", "10", "SPPIZ00600", "/root/hidden/sppiz00600/cond", "/root/hidden/cond", "", ""); // SPPIZ00600_상병및처방별치식.xrw
  697. open("SPPIZ00600", "2", "10", "10", "SPPIZ00600ML", "/root/hidden/sppiz00600/cond", "/root/hidden/cond", "", ""); // SPPIZ00600_상병및처방별치식.xrw
  698. } else {
  699. trgtManWindow.model.copyNode("/root/hidden/cond",root.hidden.sppiz00600.cond);
  700. activateChild("SPPIZ00600ML");
  701. trgtManWindow.javascript.fInitialize();
  702. }
  703. //fGetToothPop(); // 모달리스 타입이라..여기선 의미없음
  704. //}
  705. }
  706. }
  707. // 현재 상병, 처방 Grid 상에서 입력상태의 치식을 팝업 화면에 전달하기 위해 리스트 형태로 만든다.
  708. function fSetToothPop(row, flag) {
  709. model.removeNodeset("/root/hidden/sppiz00600/cond/list");
  710. model.makeNode("/root/hidden/sppiz00600/cond/list");
  711. // model.resetInstanceNode("/root/hidden/sppiz00600/cond/list");
  712. // 상병
  713. var cntcldi = getNodesetCount(grd_cldihist.nodeset);
  714. // 처방
  715. // var cntclod = getNodesetCount("/root/main/list2/clod");
  716. // grd_clodhist.rows는 타이틀을 포함하지만 getNodesetCount는 타이틀을 제외한 data 갯수를 반환
  717. var cd = "";
  718. var cdnm = "";
  719. var orddd = "";
  720. var toot = "";
  721. var rowcnt = 1;
  722. // for (i=1; i<cntcldi; i++) {
  723. for (var i = 1; i <= cntcldi; i++) {
  724. cd = model.getValue(grd_cldihist.nodeset + "["+ i + "]/diagcd");
  725. cdnm = model.getValue(grd_cldihist.nodeset + "["+ i + "]/diagnm");
  726. orddd = model.getValue(grd_cldihist.nodeset + "["+ i + "]/ordfromdd");
  727. toot = model.getValue(grd_cldihist.nodeset + "["+ i + "]/toot");
  728. if (toot != "-" && toot != "" && toot != " ") {
  729. var milktoothstr = "ABCDE000";
  730. var subTootStr = "";
  731. for (var inx = 0; inx < 32; inx++) {
  732. var tootnum = toot.substr(inx,1);
  733. if (tootnum == "*") { // 선택된 영구치의 경우 1~8 사이 숫자로 표시한다.
  734. if (inx < 8) {
  735. subTootStr += (8 - inx);
  736. }
  737. else if (inx > 7 && inx < 16) {
  738. subTootStr += (inx - 7);
  739. }
  740. else if (inx > 15 && inx < 24) {
  741. subTootStr += (24 - inx);
  742. } else {
  743. subTootStr += (inx - 23);
  744. }
  745. } else if (tootnum == "#") { // 선택된 유치의 경우 A~E 사이 알파벳으로 표시한다.
  746. if (inx < 8) {
  747. subTootStr += milktoothstr.charAt(7 - inx);
  748. }
  749. else if (inx > 7 && inx < 16) {
  750. subTootStr += milktoothstr.charAt(inx - 8);
  751. }
  752. else if (inx > 15 && inx < 24) {
  753. subTootStr += milktoothstr.charAt(23 - inx);
  754. } else {
  755. subTootStr += milktoothstr.charAt(inx - 24);
  756. }
  757. } else { // if (tootnum == "0") 선택되지 않은 경우 공백으로 처리한다.
  758. subTootStr += " ";
  759. }
  760. }
  761. model.makeNode("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/chos");
  762. //치식 표기를 설정한다.
  763. if (row == i && flag == "1") {
  764. model.setValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/chos", "true");
  765. } else {
  766. model.setValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/chos", "false");
  767. }
  768. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/flag", "상병");
  769. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/cd", cd);
  770. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/cdnm", cdnm);
  771. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/rightupper", subTootStr.substr(0, 8));
  772. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/leftupper", subTootStr.substr(8, 8));
  773. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/rightlower", subTootStr.substr(16, 8));
  774. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/leftlower", subTootStr.substr(24, 8));
  775. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/orddd", orddd);
  776. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/toot", toot);
  777. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/row", i);
  778. rowcnt = rowcnt+1;
  779. } else {
  780. if (row == i && flag == "1") {
  781. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/chos", "true");
  782. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/flag", "상병");
  783. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/cd", cd);
  784. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/cdnm", cdnm);
  785. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/rightupper", "");
  786. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/leftupper", "");
  787. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/rightlower", "");
  788. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/leftlower", "");
  789. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/orddd", orddd);
  790. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/toot", "");
  791. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/row", i);
  792. rowcnt = rowcnt+1;
  793. }
  794. }
  795. }
  796. /*
  797. for (var i = 1; i <= cntclod; i++) {
  798. cd = model.getValue("/root/main/list2/clod["+ i + "]/snglcalcscorcd");
  799. cdnm = model.getValue("/root/main/list2/clod["+ i + "]/hngnm");
  800. orddd = model.getValue("/root/main/list2/clod["+ i + "]/orddd");
  801. toot = model.getValue("/root/main/list2/clod["+ i + "]/toot");
  802. estmcls = model.getValue("/root/main/list2/clod["+ i + "]/estmcls");
  803. if ((toot != "-" && toot != "") || estmcls == "U"){
  804. var milktoothstr = "ABCDE000";
  805. var subTootStr = "";
  806. var tmpStr = "";
  807. for (var inx = 0; inx < 32; inx++) {
  808. var tootnum = toot.substr(inx,1);
  809. if (tootnum == "*") { // 선택된 영구치의 경우 1~8 사이 숫자로 표시한다.
  810. if (inx < 8) {
  811. subTootStr += (8 - inx);
  812. }
  813. else if (inx > 7 && inx < 16) {
  814. subTootStr += (inx - 7);
  815. }
  816. else if (inx > 15 && inx < 24) {
  817. subTootStr += (24 - inx);
  818. } else {
  819. subTootStr += (inx - 23);
  820. }
  821. } else if (tootnum == "#") { // 선택된 유치의 경우 A~E 사이 알파벳으로 표시한다.
  822. if (inx < 8) {
  823. subTootStr += milktoothstr.charAt(7 - inx);
  824. }
  825. else if (inx > 7 && inx < 16) {
  826. subTootStr += milktoothstr.charAt(inx - 8);
  827. }
  828. else if (inx > 15 && inx < 24) {
  829. subTootStr += milktoothstr.charAt(23 - inx);
  830. } else {
  831. subTootStr += milktoothstr.charAt(inx - 24);
  832. }
  833. } else { // if (tootnum == "0") 선택되지 않은 경우 공백으로 처리한다.
  834. subTootStr += " ";
  835. }
  836. }
  837. model.makeNode("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/chos");
  838. //치식 표기를 설정한다.
  839. if (row == i && flag == "2") {
  840. model.setValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/chos", "true");
  841. } else {
  842. model.setValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/chos", "false");
  843. }
  844. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/flag", "처방");
  845. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/cd", cd);
  846. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/cdnm", cdnm);
  847. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/rightupper", subTootStr.substr(0, 8));
  848. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/leftupper", subTootStr.substr(8, 8));
  849. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/rightlower", subTootStr.substr(16, 8));
  850. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/leftlower", subTootStr.substr(24, 8));
  851. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/orddd", orddd);
  852. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/toot", toot);
  853. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/row", i);
  854. rowcnt = rowcnt+1;
  855. } else {
  856. if (row == i && flag == "2") {
  857. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/chos", "true");
  858. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/flag", "처방");
  859. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/cd", cd);
  860. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/cdnm", cdnm);
  861. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/rightupper", "");
  862. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/leftupper", "");
  863. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/rightlower", "");
  864. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/leftlower", "");
  865. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/orddd", orddd);
  866. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/toot", "");
  867. model.makeValue("/root/hidden/sppiz00600/cond/list/toothapplist[" + rowcnt + "]/row", i);
  868. rowcnt = rowcnt+1;
  869. }
  870. }
  871. }
  872. */
  873. }
  874. // SPPIZ00600_상병및처방별치식 선택 결과를 반영한다.
  875. function fGetToothPop() {
  876. var tootSelectcnt = getNodesetCount("/root/hidden/sppiz00600/rslt/list");
  877. var flag = "";
  878. var row = "";
  879. var toot = "";
  880. tootSelectcnt = eval(tootSelectcnt) + 1;
  881. for (var i = 1; i < tootSelectcnt; i++) {
  882. flag = model.getValue("/root/hidden/sppiz00600/rslt/list["+ i +"]/flag");
  883. row = model.getValue("/root/hidden/sppiz00600/rslt/list["+ i +"]/row");
  884. var rlsttoot = model.getValue("/root/hidden/sppiz00600/rslt/list["+ i +"]/toot");
  885. var rlsttoot1 = model.getValue("/root/hidden/sppiz00600/rslt/list["+ i +"]/toot1");
  886. if (rlsttoot == "") {
  887. rlsttoot = "-";
  888. }
  889. if (rlsttoot1 == "") {
  890. rlsttoot1 = "-";
  891. }
  892. if (flag == "1") {
  893. toot = model.getValue(grd_cldihist.nodeset + "["+ row +"]/toot");
  894. model.setValue(grd_cldihist.nodeset + "["+ row +"]/toot", rlsttoot);
  895. model.setValue(grd_cldihist.nodeset + "["+ row +"]/toot1", rlsttoot1);
  896. if (rlsttoot != toot) { // 치식번호가 변경된 경우
  897. var cldistatus = grd_cldihist.rowstatus(row);
  898. if (cldistatus == 0 || cldistatus == 2) { // 0 : new, 2 : update
  899. grd_cldihist.rowstatus(row) = 2; // 2 : update
  900. }
  901. }
  902. } else if (flag == "2") {
  903. toot = model.getValue(grd_cldihist.nodeset + "["+ row +"]/toot");
  904. model.setValue(grd_cldihist.nodeset + "["+ row +"]/toot", rlsttoot);
  905. model.setValue(grd_cldihist.nodeset + "["+ row +"]/toot1", rlsttoot1);
  906. if (rlsttoot != toot) { // 치식번호가 변경된 경우
  907. // 처방의 수정된 row 상태를 표시한다.
  908. }
  909. }
  910. }
  911. }