SMMNE03800.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. /*
  2. 응급실 CPCR 기록지 기준자료 관리(SMMNE03800.xfm - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. */
  6. var prcpNodeCPCR = "/root/main/cpcrbasecode/mediation/mediationlist";
  7. var prcpNode = "/root/prcp/prcplist";
  8. var prcpSubCntNode = "/root/main/prcp/prcplist";
  9. var prcpSubNode = "/root/main/prcp";
  10. var prcpnmCol = 2;
  11. var ChgBeforeData = "";
  12. var ChgBeforeDeflt = "";
  13. /**
  14. * @group :
  15. * @ver : 2007.07.21
  16. * @by : 양천덕
  17. * @---------------------------------------------------
  18. * @type : function
  19. * @access : public
  20. * @desc : 기준자료별 상태 변환
  21. * @param :
  22. * @return :
  23. * @---------------------------------------------------
  24. */
  25. function fStatChnge(chgPath, chgGridID, chgRow, chgCol ){
  26. if( chgRow == "0"){
  27. return;
  28. } else {
  29. // 상태 필드 더블클릭 시 이벤트 처리
  30. if(chgCol == chgGridID.colRef("stat")){
  31. // 행추가 제외, 상태구분 공백 제외(신규건은 제외)
  32. if(model.getValue(chgPath + "["+chgRow+"]/statflag") != "I" && model.getValue(chgPath + "["+chgRow+"]/statflag") != ""){
  33. // 유효여부가 Y이며 상태가 공백이면 삭제 처리
  34. if(model.getValue(chgPath + "["+chgRow+"]/valiyn") == "Y"
  35. && model.getValue(chgPath + "["+chgRow+"]/stat") == ""
  36. && model.getValue(chgPath + "["+chgRow+"]/statflag") == "S" ){
  37. model.setValue(chgPath + "["+chgRow+"]/statflag","D");
  38. model.setValue(chgPath + "["+chgRow+"]/valiyn","N");
  39. model.setValue(chgPath + "["+chgRow+"]/stat","삭제");
  40. return;
  41. // 유효여부가 N이며 상태구분이 조회이면 재등록 처리
  42. } else if (model.getValue(chgPath + "["+chgRow+"]/valiyn") == "N"
  43. && model.getValue(chgPath + "["+chgRow+"]/statflag") == "S") {
  44. model.setValue(chgPath + "["+chgRow+"]/statflag","D");
  45. model.setValue(chgPath + "["+chgRow+"]/valiyn","Y" );
  46. model.setValue(chgPath + "["+chgRow+"]/stat","재등록");
  47. return;
  48. // 유효여부가 Y이며 상태가 재등록이면 이전값으로 변경
  49. } else if (model.getValue(chgPath + "["+chgRow+"]/valiyn") == "Y"
  50. && model.getValue(chgPath + "["+chgRow+"]/stat") == "재등록") {
  51. model.setValue(chgPath + "["+chgRow+"]/statflag","S");
  52. model.setValue(chgPath + "["+chgRow+"]/valiyn","N" );
  53. model.setValue(chgPath + "["+chgRow+"]/stat","삭제");
  54. return;
  55. // 유효여부가 Y이며 상태구분이 삭제이면 삭제처리
  56. } else if (model.getValue(chgPath + "["+chgRow+"]/valiyn") == "Y"
  57. && model.getValue(chgPath + "["+chgRow+"]/statflag") == "D") {
  58. model.setValue(chgPath + "["+chgRow+"]/statflag","U");
  59. model.setValue(chgPath + "["+chgRow+"]/valiyn","N" );
  60. model.setValue(chgPath + "["+chgRow+"]/stat","삭제");
  61. return;
  62. } else if (model.getValue(chgPath + "["+chgRow+"]/statflag") == "U" ){
  63. messageBox("수정 데이터입니다. 저장 후 변경하십시요", "E");
  64. return;
  65. // 예외 처리 수정으로 변경
  66. } else {
  67. model.setValue(chgPath + "["+chgRow+"]/statflag","U");
  68. model.setValue(chgPath + "["+chgRow+"]/valiyn","Y");
  69. model.setValue(chgPath + "["+chgRow+"]/stat","");
  70. return;
  71. }
  72. }
  73. //변경필드가 DEFLT 일때 처리
  74. } else if (chgCol == chgGridID.colRef("default") && model.getValue(chgPath + "["+chgRow+"]/valiyn") == "Y" ) {
  75. // default 필드 데이터 변경
  76. if( model.getValue(chgPath + "["+chgRow+"]/default") == "Y" ){
  77. model.setValue(chgPath + "["+chgRow+"]/default","N");
  78. } else {
  79. model.setValue(chgPath + "["+chgRow+"]/default","Y");
  80. }
  81. // update 상태 변경
  82. if(model.getValue(chgPath + "["+chgRow+"]/statflag") != "I"){
  83. model.setValue(chgPath + "["+chgRow+"]/statflag","U");
  84. model.setValue(chgPath + "["+chgRow+"]/stat","수정");
  85. }
  86. } else {
  87. return;
  88. }
  89. }
  90. }
  91. /**
  92. * @group :
  93. * @ver : 2007.07.21
  94. * @by : 양천덕
  95. * @---------------------------------------------------
  96. * @type : function
  97. * @access : public
  98. * @desc : 항목별 기준자료 저장
  99. * @param :
  100. * @return :
  101. * @---------------------------------------------------
  102. */
  103. function fBaseCodeSave(pPath, pRows, pRow, pFlag){
  104. if(model.getValue("/root/main/cond/deptcd") == ""){
  105. messageBox("부서를", "C002");
  106. return;
  107. }
  108. var cSaveData = "S" ;
  109. if( pRows == "1" ){
  110. messageBox("저장할 데이터가", "I004");
  111. return;
  112. } else {
  113. for( i = 0 ; i < pRows ; i ++){
  114. if(model.getValue(pPath + "["+i+"]/statflag") != "S"){
  115. cSaveData = "C" ;
  116. }
  117. }
  118. if(pFlag == "grd_proclist" && cSaveData == "S"){
  119. messageBox("저장/변경 할 "+"PROCEDURE"+" 데이터가", "I004");
  120. return;
  121. } else if(pFlag == "grd_prcplist" && cSaveData == "S" ){
  122. messageBox("저장/변경 할 "+"MEDIATION"+" 데이터가", "I004");
  123. return;
  124. } else if(pFlag == "grd_testlist" && cSaveData == "S" ) {
  125. messageBox("저장/변경 할 "+"검사"+" 데이터가", "I004");
  126. return;
  127. }
  128. }
  129. for(i = 1 ; i < pRows ; i ++ ){
  130. var InsData = "";
  131. cnt = 0;
  132. if( model.getValue(pPath + "["+i+"]/statflag") == "I" ||
  133. model.getValue(pPath + "["+i+"]/statflag") == "U" ){
  134. InsData = model.getValue(pPath + "["+i+"]/recitem");
  135. for(j =1 ; j< pRows ; j++){
  136. if(model.getValue(pPath + "["+j+"]/recitem") == InsData && i != j){
  137. cnt++;
  138. }
  139. }
  140. }
  141. if(cnt>0){
  142. messageBox(InsData+"는 등록되어 있습니다.","I");
  143. // model.setValue(pPath + "["+pRow+"]/stat", "");
  144. // model.setValue(pPath + "["+pRow+"]/recitem", "");
  145. // model.setValue(pPath + "["+pRow+"]/default", "");
  146. // model.setValue(pPath + "["+pRow+"]/seq", "");
  147. // model.setValue(pPath + "["+pRow+"]/valiyn", "");
  148. // model.setValue(pPath + "["+pRow+"]/statflag", "");
  149. // model.setValue(pPath + "["+pRow+"]/recitemflag", "");
  150. // model.refresh();
  151. return;
  152. }
  153. }
  154. if(model.getValue("/root/main/cond/deptcd") != "" && cSaveData == "C") {
  155. fSrcOptionData();
  156. if(pFlag == "grd_proclist"){
  157. model.makeValue("/root/send/datalist", grd_proclist.getUpdateDataAll("i"));
  158. }else if(pFlag == "grd_prcplist"){
  159. model.makeValue("/root/send/datalist", grd_prcplist.getUpdateDataAll("i"));
  160. }else{
  161. model.makeValue("/root/send/datalist", grd_testlist.getUpdateDataAll("i"));
  162. }
  163. if(submit("TXMNE03801") == true){
  164. if(pFlag == "grd_proclist"){
  165. model.copynode("/root/main/cpcrbasecode/procedure","/root/cpcrbasecode/procedure");
  166. grd_proclist.refresh();
  167. } else if(pFlag == "grd_prcplist"){
  168. model.copynode("/root/main/cpcrbasecode/mediation","/root/cpcrbasecode/mediation");
  169. grd_prcplist.refresh();
  170. }else{
  171. model.copynode("/root/main/cpcrbasecode/test","/root/cpcrbasecode/test");
  172. grd_testlist.refresh();
  173. }
  174. model.removenode("/root/cpcrbasecode");
  175. }
  176. }
  177. }
  178. /**
  179. * @group :
  180. * @ver : 2007.07.21
  181. * @by : 양천덕
  182. * @---------------------------------------------------
  183. * @type : function
  184. * @access : public
  185. * @desc : 항목별 기준자료 조회 조건 값 설정
  186. * @param :
  187. * @return :
  188. * @---------------------------------------------------
  189. */
  190. function fSrcOptionData(){
  191. model.removenode("/root/send/cond");
  192. model.makeValue("/root/send/cond", "deptcd▦srcflag▩"
  193. + model.getValue("/root/main/cond/deptcd") +"▦"
  194. + model.getValue("/root/main/cond/srcflag")+"▩");
  195. }
  196. /**
  197. * @group :
  198. * @ver : 2007.07.21
  199. * @by : 양천덕
  200. * @---------------------------------------------------
  201. * @type : function
  202. * @access : public
  203. * @desc : 항목별 기준자료 조회 조건 값 설정
  204. * @param :
  205. * @return :
  206. * @---------------------------------------------------
  207. */
  208. function fSrcData(){
  209. fSrcOptionData();
  210. submit("TRMNE03801");
  211. }
  212. /**
  213. * @group :
  214. * @ver : 2007.07.21
  215. * @by : 양천덕
  216. * @---------------------------------------------------
  217. * @type : function
  218. * @access : public
  219. * @desc : 추가 행 기본 값 셋팅
  220. * @param :
  221. * @return :
  222. * @---------------------------------------------------
  223. */
  224. function fAddRow(addPath, addRow, addSubCode){
  225. if(model.getValue(addPath+"["+addRow+"]/recitem") == ""){
  226. model.setValue(addPath+"["+addRow+"]/stat", "");
  227. model.setValue(addPath+"["+addRow+"]/statflag", "");
  228. model.setValue(addPath+"["+addRow+"]/default", "");
  229. model.setValue(addPath+"["+addRow+"]/seq", "");
  230. model.setValue(addPath+"["+addRow+"]/valiyn", "");
  231. model.setValue(addPath+"["+addRow+"]/recitemflag", "");
  232. }
  233. if(model.getValue(addPath+"["+addRow+"]/statflag") == ""){
  234. model.setValue(addPath+"["+addRow+"]/stat", "미등록");
  235. model.setValue(addPath+"["+addRow+"]/statflag", "I");
  236. model.setValue(addPath+"["+addRow+"]/default", "Y");
  237. model.setValue(addPath+"["+addRow+"]/seq", addRow);
  238. model.setValue(addPath+"["+addRow+"]/valiyn", "Y");
  239. model.setValue(addPath+"["+addRow+"]/recitemflag", addSubCode);
  240. } else if (model.getValue(addPath+"["+addRow+"]/statflag") == "S" && model.getValue(addPath+"["+addRow+"]/stat")== "") {
  241. if(ChgBeforeData != model.getValue(addPath+"["+addRow+"]/recitem") ){
  242. model.setValue(addPath+"["+addRow+"]/statflag", "U");
  243. model.setValue(addPath+"["+addRow+"]/stat", "수정");
  244. model.refresh();
  245. }else{
  246. return;
  247. }
  248. } else if (model.getValue(addPath+"["+addRow+"]/statflag") == "S" && model.getValue(addPath+"["+addRow+"]/valiyn")== "N") {
  249. return;
  250. }
  251. }
  252. /**
  253. * @group :
  254. * @ver : 2007.07.21
  255. * @by : 양천덕
  256. - 2008.07.21 수정 : 성미연 (처방명 검색기능 추가)
  257. * @---------------------------------------------------
  258. * @type : function
  259. * @access : public
  260. * @desc : MEDIATION 처방검색
  261. * @param :
  262. * @return :
  263. * @---------------------------------------------------
  264. */
  265. function fPrcpSrch(srchflag) {
  266. var curRow = 0;
  267. if(event.keyCode == "13") {
  268. if ( model.getValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/prcpflag") == "2" &&
  269. model.getValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/drugmastspec") =="Y" ){
  270. return;
  271. }
  272. if(srchflag == "cd"){
  273. var prcpnm = model.getValue ( prcpNodeCPCR + "[" + grd_prcplist.row+ "]/recitem" );
  274. var mthdnm = "getPrcpCdOldSrchInfo";
  275. }else if(srchflag == "nm"){
  276. var prcpnm = model.getValue ( prcpNodeCPCR + "[" + grd_prcplist.row+ "]/recitemnm" );
  277. var mthdnm = "getPrcpNmSrchInfo";
  278. }
  279. var isHangul = fIsHangul (prcpnm);
  280. //한글일때는 1글자만 넣어도 검색가능
  281. if ( isNull(prcpnm)) {
  282. model.alert ( "검색어를 입력해 주십시오." );
  283. model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/stat", "");
  284. model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/statflag", "");
  285. model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/default", "");
  286. model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/seq", "");
  287. model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/valiyn", "");
  288. model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/recitemflag", "");
  289. grd_prcplist.refresh();
  290. return;
  291. } else if ( isHangul == "E" ){
  292. //영문,숫자일때는 3글자 넣어야 검색가능
  293. if ( prcpnm.length < 2 ){
  294. model.alert ( "2글자 이상 입력해 주십시오." );
  295. return;
  296. }
  297. } else if ( isHangul == "H" ) {
  298. if ( prcpnm.length < 2 ){
  299. model.alert ( "한글은 2글자 이상 입력해 주십시오." );
  300. return;
  301. }
  302. }
  303. if (prcpnm.charAt ( 0 ) == "/"){
  304. if ( prcpnm.length == 1 ){
  305. model.alert( "검색할 수술명이 없습니다." );
  306. return;
  307. }
  308. var curRow = grd_prcplist.row;
  309. var srchRow = grd_prcplist.rows -1;
  310. var xpt = window.screenleft + 180;
  311. var ypt = window.screenTop + 80;
  312. modal ( "SPMMO05100", 1, xpt, ypt );
  313. } else {
  314. fPrcpSrchCom ( prcpnm, getCurrentDate(), "", "TRMMO00100", "-", "false", mthdnm, isHangul);
  315. //fPrcpSrchCom ( prcpnm, prcpdd, insukind, trnm, ioflag, refreshFlag, mthdnm, isHangul )
  316. var srchLength = model.instances(0).selectNodes( "/root/prcpsrch/prcplist" ).length;
  317. var curRow = grd_prcplist.row;
  318. var nextRow = grd_prcplist.row + 1;
  319. if( srchLength > 1) {
  320. import1.visible = true;
  321. } else if( srchLength == 1) {
  322. srchRow = addPrcpDetl ( "import" , "/root/prcpsrch/prcplist" , "/root/main/prcp" , 1 , grd_prcplist.row, "00" );
  323. if (srchRow !=0 ) {
  324. focusMain ( srchRow );
  325. }
  326. } else {
  327. model.alert ( "검색된 내용이 없습니다." );
  328. grd_prcplist.editCell();
  329. grd_prcplist.dispatch("onentercell");
  330. }
  331. model.refresh();
  332. }
  333. }
  334. }
  335. /**
  336. * @desc : 데이터 한글인지 영문인지 구분해주는 함수
  337. * @param : pData: 한글여부를 비교할 데이터
  338. * @return : E: 영문, H: 한글
  339. * @authur : 마정민 2007. 5. 30
  340. * @---------------------------------------------------
  341. */
  342. function fIsHangul(pData) {
  343. var sBit = pData.charAt(0);
  344. if (escape(sBit).length <= 4) return "E";
  345. return "H";
  346. }
  347. /**
  348. * @desc : 처방검색
  349. * @param : prcpnm: 검색할 처방명
  350. : prcpdd: 처방일자
  351. : insukind: 보험유형
  352. : trnm: 트랜젝션 네임
  353. : ioflag: 외래, 입원, 응급 구분
  354. : refreshFlag: refresh 여부
  355. : mthdnm 명
  356. * @return : void
  357. * @authur : 마정민 2007. 6. 21
  358. * @---------------------------------------------------
  359. */
  360. function fPrcpSrchCom ( prcpnm, prcpdd, insukind, trnm, ioflag, refreshFlag, mthdnm, isHangul ) {
  361. /*
  362. if ( isNull(trnm)) {
  363. trnm = "TRMMO00100";
  364. }
  365. if ( isNull(ioflag)) {
  366. ioflag = "-";
  367. }
  368. if ( isNull(refreshFlag)) {
  369. refreshFlag = false;
  370. }
  371. */
  372. //mthdnm = "getPrcpCdOldSrchInfo";
  373. //getPrcpCdSrchInfo
  374. //getOldPrcpCdChngInfo
  375. //getPrcpCdOldSrchInfo
  376. model.setValue ( "/root/send/cond1", prcpnm ); //처방명, 수가코드
  377. model.setValue ( "/root/send/cond2", ioflag ); //외래, 입원, 응급 구분
  378. model.setValue ( "/root/send/cond3", prcpdd ); //처방일
  379. model.setValue ( "/root/send/cond4", insukind ); //환자보험유형
  380. if ( !isNull( isHangul)) {
  381. model.setValue ( "/root/send/cond5", isHangul ); //한영구분
  382. }
  383. model.setValue ( "/root/send/cond6", "2" ); //1 : CONTAINS검색, 2 : LIKE검색
  384. model.setValue ( "/root/send/cond99", mthdnm ); //검색구분
  385. if ( refreshFlag == false ) {
  386. submit (trnm, false );
  387. } else {
  388. submit( trnm );
  389. }
  390. }
  391. /**
  392. * @desc : 검색된 내용중 내릴 처방을 선택하여 전송한다.( double click )
  393. * @param : objFlag - child or else
  394. : strSrc - source node
  395. : strDest - 목적지 node; child일때는 opener.root.main.prcp, 아니면 "/root/main/prcp" 이다
  396. : sendRow - 검색된 내용중 메인으로 보내고자 하는 row
  397. : srchRow - 메인에 들어간 자리. 검색로우(srchRow) 바로 전이다.
  398. : prcpInptFlag - - 처방입력구분 00 처방검색, 01 전회처방, 02 약속처방, 03 약속수술.. M0034
  399. : groupSrc - 옵션: group처방 검색할 경우 node
  400. : direcSrc - 옵션: group 지시처방 검색할 경우 node
  401. : prcpInptFlag - 처방입력구분 00 처방검색, 01 전회처방, 02 약속처방, 03 약속수술.. M0034
  402. * @return : srchRow 에러시 0
  403. * @authur : 마정민 2007. 4. 12
  404. * @---------------------------------------------------
  405. */
  406. function addPrcpDetl ( objFlag, strSrc, strDest, sendRow, srchRow, prcpInptFlag, grupSrc, direcSrc ) {
  407. var prcpClsCd = model.getValue( strSrc + "[" + sendRow + "]/prcpclscd" );
  408. var prcpKindCd = model.getValue( strSrc + "[" + sendRow + "]/prcpkindcd" );
  409. var drugmthdspccd = model.getValue( strSrc + "[" + sendRow + "]/drugmthdspccd" );
  410. var prcpnm = model.getValue( strSrc + "[" + sendRow + "]/prcpnm" );
  411. if ( objFlag == "child" ) usge = opener.model.getValue ( "/root/usge" );
  412. else usge = model.getValue ( "/root/usge" );
  413. if (!fPrmsSaveCheck ( usge, prcpKindCd, prcpnm )) {
  414. return 0;
  415. }
  416. if ( prcpInptFlag == "01" ) { //전회처방
  417. if ( model.getValue ( strSrc + "[" + sendRow + "]/prcphistcd" ) == "E" ) {
  418. model.alert ( "반납처방은 처방복사가 안됩니다." );
  419. return 0;
  420. }
  421. }
  422. //그룹코드 M을 찾아낸다. 처방검색일때만 풀린다.
  423. if ( model.getValue( strSrc + "[" + sendRow + "]/grupsnglflag" ) == "M" && prcpInptFlag == "00" ) {
  424. var grupCond1 = model.getValue( strSrc + "[" + sendRow + "]/prcpcd" );
  425. var grupCond3 = "";
  426. var grupCond4 = "";
  427. if ( objFlag == "child" ) {
  428. grupCond3 = opener.model.getValue ( "/root/init/prcpdd" );
  429. grupCond4 = opener.model.getValue ( "/root/paminfo/list/insukind");
  430. } else {
  431. grupCond3 = model.getValue ( "/root/init/prcpdd" );
  432. grupCond4 = model.getValue ( "/root/paminfo/list/insukind");
  433. }
  434. prcpGroupSrch ( grupCond1, grupCond3, grupCond4 );
  435. if ( objFlag == "child" ) {
  436. var destNode = opener.model.instances(0).selectSingleNode( strDest ) // or opener.root.main.prcp 이런식으로
  437. } else {
  438. var destNode = strDest;
  439. }
  440. if ( grupSrc == null ) grupSrc = "/root/prcpgroup/prcplist";
  441. var srcNodeList = model.instances(0).selectNodes( grupSrc );
  442. for (var i=1; i<srcNodeList.length+1; i++) {
  443. if (addPrcpSetValue ( objFlag, grupSrc, i, prcpInptFlag )) {
  444. model.duplicate( destNode, grupSrc +"[" + i + "]", "*[" + srchRow + "]");
  445. srchRow ++;
  446. }
  447. }
  448. // } else if ( model.getValue( strSrc + "[" + sendRow + "]/grupsnglflag" ) == "J" && prcpInptFlag == "00" ) { //그룹지시처방 J을 찾아낸다. 처방검색일때만 풀린다.
  449. } else if ( model.getValue( strSrc + "[" + sendRow + "]/grupsnglflag" ) == "J" ) { //그룹지시처방 J을 찾아낸다.
  450. //조회조건
  451. var direcCond1 = model.getValue( strSrc + "[" + sendRow + "]/srchcondcnts" );
  452. var direcCond5 = model.getValue( strSrc + "[" + sendRow + "]/prcpcd" );
  453. var direcCond3 = "";
  454. var direcCond4 = "";
  455. if ( objFlag == "child" ) {
  456. direcCond3 = opener.model.getValue ( "/root/init/prcpdd" );
  457. direcCond4 = opener.model.getValue ( "/root/paminfo/list/insukind");
  458. } else {
  459. direcCond3 = model.getValue ( "/root/init/prcpdd" );
  460. direcCond4 = model.getValue ( "/root/paminfo/list/insukind");
  461. }
  462. prcpDirecSrch ( direcCond1, direcCond3, direcCond4, direcCond5 );
  463. if ( direcSrc == null ) direcSrc = "/root/prcpdirec/prcplist";
  464. var srcNodeList = model.instances(0).selectNodes( direcSrc );
  465. if ( srcNodeList.length != 0 ){ //그룹지시처방 J는 종속하는 수가 코드가 있을 때문 추가.
  466. if ( objFlag == "child" ) {
  467. var destNode = opener.model.instances(0).selectSingleNode( strDest ) // or opener.root.main.prcp 이런식으로
  468. } else {
  469. var destNode = strDest;
  470. }
  471. if (!addPrcpSetValue ( objFlag, strSrc, sendRow, prcpInptFlag )) {
  472. return 0;
  473. }
  474. model.duplicate( destNode, strSrc + "[" + sendRow + "]", "*[" + srchRow + "]");
  475. srchRow ++;
  476. for (var k=1; k <= srcNodeList.length; k++) {
  477. if ( objFlag == "child" ) {
  478. var destNode = opener.model.instances(0).selectSingleNode( strDest ) // or opener.root.main.prcp 이런식으로
  479. } else {
  480. var destNode = strDest;
  481. }
  482. if (addPrcpSetValue ( objFlag, direcSrc, k, prcpInptFlag )) {
  483. model.duplicate( destNode, direcSrc + "[" + k + "]", "*[" + srchRow + "]");
  484. srchRow ++;
  485. }
  486. }
  487. }
  488. } else { //그룹코드 M, J 가 아닐 경우
  489. if ( objFlag == "child" ) {
  490. var destNode = opener.model.instances(0).selectSingleNode( strDest ) // or opener.root.main.prcp 이런식으로
  491. if (!addPrcpSetValue ( objFlag, strSrc, sendRow, prcpInptFlag )) {
  492. return 0;
  493. }
  494. model.duplicate( destNode, strSrc + "[" + sendRow + "]", "*[" + srchRow + "]");
  495. //처방, 약속처방구분
  496. if ( usge == "prcp" ) {
  497. if ( prcpClsCd == "H2" || prcpClsCd == "C4" ) { //수술, angio 는 선택시 자동 팝업이다
  498. opener.javascript.fPrcpDetl( srchRow );
  499. } else if ( prcpClsCd == "D2" ) { //병리검체 팝업
  500. opener.javascript.fReqfrm ( srchRow );
  501. } else if ( prcpClsCd == "B2" || prcpClsCd == "B4" || prcpClsCd == "B6" ) { //진단검체 팝업
  502. if ( drugmthdspccd == "999" ) { //검체코드가 999일때 띄운다.
  503. opener.javascript.fGetSpc ( srchRow );
  504. }
  505. }
  506. }
  507. } else {
  508. var destNode = strDest;
  509. if (!addPrcpSetValue ( objFlag, strSrc, sendRow, prcpInptFlag )) {
  510. return 0;
  511. }
  512. model.duplicate( destNode, strSrc + "[" + sendRow + "]", "*[" + srchRow + "]");
  513. //처방, 약속처방구분
  514. if ( usge == "prcp" ) {
  515. if ( prcpClsCd == "H2" || prcpClsCd == "C4" ) { //수술, angio 는 선택시 자동 팝업이다
  516. fPrcpDetl( srchRow );
  517. } else if ( prcpClsCd == "D2" ) { //병리검체 팝업
  518. fReqfrm ( srchRow );
  519. } else if ( prcpClsCd == "B2" || prcpClsCd == "B4" || prcpClsCd == "B6" ) { //진단검체 팝업
  520. if ( drugmthdspccd == "999" ) { //검체코드가 999일때 띄운다.
  521. fGetSpc ( srchRow );
  522. }
  523. }
  524. }
  525. }
  526. srchRow ++;
  527. }
  528. return srchRow; //검색 row 값을 넘겨준다.
  529. alert(srchRow);
  530. }
  531. /**
  532. * @desc : 포커스를 메인으로 한다.
  533. * @param : curRow => 메인의 검색 row
  534. : flag => child
  535. : prcpNmClearFlag => 검색명을 클리어 시킬건지 여부
  536. * @return : void
  537. * @authur : 마정민 2007. 4. 12
  538. * @---------------------------------------------------
  539. */
  540. function focusMain( curRow, flag, prcpNmClearFlag ) {
  541. if ( flag == "child" ) {
  542. if ( prcpNmClearFlag != "N" ) {
  543. opener.model.setValue( "/root/main/prcp/prcplist[" + curRow + "]/prcpnm", "");
  544. }
  545. opener.grd_prcplist.refresh();
  546. opener.model.recalculate();
  547. opener.model.setfocus( "grd_prcplist" );
  548. opener.grd_prcplist.row = curRow;
  549. opener.grd_prcplist.col = prcpnmCol;
  550. opener.grd_prcplist.dispatch("onentercell");
  551. } else {
  552. model.removeNodeset( "/root/prcpsrch/prcplist");
  553. model.removeNodeset( "/root/prcpgroup/prcplist");
  554. model.removeNodeset( "/root/prcpdirec/prcplist");
  555. import1.visible = false;
  556. if ( prcpNmClearFlag != "N" ) {
  557. model.setValue( prcpNodeCPCR +"[" + grd_prcplist.row + "]/recitem", ""); //검색그리드를 클리어 시킨다.
  558. //model.setValue( "/root/main/prcp/prcplist[" + curRow + "]/prcpnm", ""); //검색그리드를 클리어 시킨다.
  559. }
  560. // alert ( getNodesetCount(prcpSubCntNode) );
  561. if(getNodesetCount(prcpSubCntNode) == 2) {
  562. model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/stat", "미등록");
  563. model.setValue("/root/main/cpcrbasecode/mediation/mediationlist[" + grd_prcplist.row + "]/recitem", model.getValue("/root/main/prcp/prcplist["+ 1 +"]/prcpcd"));
  564. model.setValue("/root/main/cpcrbasecode/mediation/mediationlist[" + grd_prcplist.row + "]/recitemnm", model.getValue("/root/main/prcp/prcplist["+ 1 +"]/prcpnm"));
  565. model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/statflag", "I");
  566. model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/default", "Y");
  567. model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/seq", grd_prcplist.row);
  568. model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/valiyn", "Y");
  569. model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/recitemflag", "M");
  570. } else {
  571. for(i = 1 ; i < getNodesetCount(prcpSubCntNode) ; i++){
  572. if(i != 1){
  573. grd_prcplist.addRow();
  574. }
  575. var j = grd_prcplist.row;
  576. model.setValue(prcpNodeCPCR + "[" + j + "]/stat", "미등록");
  577. model.setValue(prcpNodeCPCR + "[" + j + "]/recitem", model.getValue("/root/main/prcp/prcplist["+ i +"]/prcpcd"));
  578. model.setValue(prcpNodeCPCR + "[" + j + "]/recitemnm", model.getValue("/root/main/prcp/prcplist["+ i +"]/prcpnm"));
  579. model.setValue(prcpNodeCPCR + "[" + j + "]/statflag", "I");
  580. model.setValue(prcpNodeCPCR + "[" + j + "]/default", "Y");
  581. model.setValue(prcpNodeCPCR + "[" + j + "]/seq", grd_prcplist.row);
  582. model.setValue(prcpNodeCPCR + "[" + j + "]/valiyn", "Y");
  583. model.setValue(prcpNodeCPCR + "[" + j + "]/recitemflag", "M");
  584. }
  585. }
  586. model.removenode(prcpSubNode);
  587. grd_prcplist.refresh();
  588. model.recalculate();
  589. model.setfocus( "grd_prcplist" );
  590. //grd_prcplist.row = ;
  591. grd_prcplist.col = prcpnmCol;
  592. grd_prcplist.dispatch("onentercell");
  593. }
  594. }
  595. /**
  596. * @desc : check 된 Source Node의 값을 목적지에 Append Node 한다.(처방검색)
  597. * @param : objFlag - child or else
  598. : strSrc - 출발지 Node
  599. : strDest - 목적지 Node
  600. : multiFlag - 복수 add 여부
  601. : checkNM - check로 사용할 instance명
  602. : checkFlag - check시 Value
  603. : grdObj - 더블클릭시 값을 넘기는 그리드 명
  604. : prcpNmClearFlag - 검색 row에 검색명 클리어 여부
  605. : prcpInptFlag - 처방입력구분 00 처방검색, 01 전회처방, 02 약속처방, 03 약속수술.. M0034
  606. : ex) addPrcp ( "child", "/root/prcpsrch/prcplist", "/root/main/prcp", "N", "status", "I", grd_prcpsrchlist, "N");
  607. * @return : void
  608. * @authur : 마정민 2007. 3. 12
  609. * @---------------------------------------------------
  610. */
  611. function addPrcp ( objFlag, strSrc, strDest, multiFlag, checkNM, checkFlag, grdObj, prcpNmClearFlag, prcpInptFlag ) {
  612. model.makeNode("/root/main/prcp/prcplist")
  613. model.copyNode("/root/main/prcp/prcplist", prcpNode);
  614. //목적지를 변수로 받고 싶었으나 iviewer에서 문제가 있어 목적지는 프레그를 구분자로 박아 넣음.
  615. var srchRow = 0;
  616. var srcNodeList = model.instances(0).selectNodes(strSrc); //or instance1.selectNodes(strSrc)
  617. //검색Row 찾기
  618. if ( objFlag == "child") {
  619. var destNodeList = opener.model.instances(0).selectNodes( strDest + "/prcplist" ); //dest Node에서 prcplist는 약속으로 하자.
  620. for ( i = destNodeList.length; i>0; i-- ){
  621. opener.model.getValue ( strDest + "/prcplist[" + i + "]" ) == "S";
  622. srchRow = i;
  623. break;
  624. }
  625. } else {
  626. var destNodeList = model.instances(0).selectNodes( strDest + "/prcplist" );
  627. for ( i = destNodeList.length; i >0; i-- ){
  628. model.getValue ( strDest + "prcplist[" + i + "]" ) == "S";
  629. srchRow = i;
  630. break;
  631. }
  632. }
  633. if ( multiFlag == "Y" ){
  634. for( var i = 1; i <= srcNodeList.length; i++ ) {
  635. if ( model.getValue( strSrc + "[" + i + "]/" + checkNM) == checkFlag ) {
  636. srchRow = addPrcpDetl ( objFlag , strSrc , strDest , i , srchRow, prcpInptFlag );
  637. }
  638. }
  639. } else { //더블클릭으로 넘길때
  640. srchRow = addPrcpDetl ( objFlag , strSrc , strDest , grdObj.row , srchRow, prcpInptFlag );
  641. }
  642. if ( srchRow != 0 ) {
  643. focusMain ( srchRow, objFlag, prcpNmClearFlag );
  644. }
  645. }
  646. /**
  647. * @desc : 약속처방에 등록 가능한지 check
  648. * @param : usge: 저장화면
  649. : prcpkindcd: 처방분류
  650. : prcpnm: 처방명
  651. * @return : true, false
  652. * @authur : 마정민 2007. 6. 22
  653. * @---------------------------------------------------
  654. */
  655. function fPrmsSaveCheck ( usge, prcpkindcd, prcpnm ) {
  656. //약속처방, 지시처방에서는 HSCT 처방을 등록할 수 없다.
  657. if ( prcpkindcd == "04" && usge == "prms" ) {
  658. model.alert ( "약속처방에는 [" + prcpnm +"] HSCT 처방을 등록하실 수 없습니다." )
  659. return false;
  660. } else if ( prcpkindcd == "04" && usge == "direc" ) {
  661. model.alert ( "지시처방에는 [" + prcpnm +"] HSCT 처방을 등록하실 수 없습니다." )
  662. return false;
  663. }
  664. return true;
  665. }
  666. /**
  667. * @desc : 처방main에 넘기기 전에 기본값을 setting한다.
  668. * @param : objFlag => child or ...
  669. : strSrc => setting할 source node
  670. : sendRow => setting할 row
  671. : prcpInptFlag - - 처방입력구분 00 처방검색, 01 전회처방, 02 약속처방, 03 약속수술.. M0034
  672. * @return : true, false
  673. * @authur : 마정민 2007. 4. 12
  674. * @---------------------------------------------------
  675. */
  676. function addPrcpSetValue ( objFlag, strSrc , sendRow, prcpInptFlag ) {
  677. // OrgPrcpQty // 실제 처방수량
  678. var prcpdd = ""; //처방일
  679. var prcpkindcd = ""; //처방종류변수
  680. var pamInfoNode = "/root/paminfo/list";
  681. var pid = ""; //환자번호
  682. var indd = ""; //진료일자
  683. var cretno = ""; //생성번호
  684. var orddeptcd = ""; //담당부서
  685. var orddrid = ""; //담당교수
  686. var prcpgenrflag = ""; //외래입원구분
  687. var prcpclscd = model.getValue ( strSrc + "[" + sendRow + "]/prcpclscd" );
  688. var choiordflag = "";
  689. if ( isNull(prcpInptFlag)) prcpInptFlag = model.getValue ( strSrc + "[" + sendRow + "]/prcpinptflag" );
  690. model.setValue ( strSrc + "[" + sendRow + "]/status", "I" );
  691. // model.setValue ( strSrc + "[" + sendRow + "]/rgstridnm", getUserName()); //등록자명
  692. model.setValue ( strSrc + "[" + sendRow + "]/prcpinptflag", prcpInptFlag ); //처방입력구분
  693. // model.setValue ( strSrc + "[" + sendRow + "]/prcpstatcd", "000" ); //처방상태코드:처방
  694. model.setValue ( strSrc + "[" + sendRow + "]/prcphistcd", "O" ); //처방이력코드:O
  695. model.setValue ( strSrc + "[" + sendRow + "]/prcpauthflag", "0" ); //처방권한구분:0
  696. model.setValue ( strSrc + "[" + sendRow + "]/prcpsignflag", "2" ); //처방이력구분:2
  697. // var issdept = model.getValue ("/root/init/issdept");
  698. var issdept = getUserInfo( "dutplcecd" );
  699. // if ( isNull(issdept)) {
  700. //issdept = getUserInfo( "posdeptcd" );
  701. // }
  702. model.setValue ( strSrc + "[" + sendRow + "]/issdeptcd", issdept );
  703. if ( objFlag == "child" ){
  704. //수술예약번호 setting
  705. if( !isNull (opener.model.getValue ( "/root/operation/list/oprsrvno"))){
  706. model.setValue ( strSrc + "[" + sendRow + "]/oprsrvno", opener.model.getValue ( "/root/operation/list/oprsrvno"));
  707. } else {
  708. model.setValue ( strSrc + "[" + sendRow + "]/oprsrvno", "0" );
  709. }
  710. //품절약 체크
  711. if ( prcpclscd == "A2" || prcpclscd == "A4" || prcpclscd == "A6" ) {
  712. var drugmastspec = model.getValue ( strSrc + "[" + sendRow + "]/drugmastspec") + "^";
  713. if ( getArrayData (drugmastspec, 0, 10, "^", "|" ) == "Y" ) {
  714. opener.javascript.fAltDrug ( sendRow, "1", strSrc );
  715. return false;
  716. }
  717. }
  718. var srcNodeList = opener.model.instances(0).selectNodes( "/root/paminfo" );
  719. prcpgenrflag = opener.model.getValue ( "/root/patflag/list/prcpgenrflag" );
  720. pid = opener.model.getValue ( pamInfoNode + "/pid" );
  721. if ( prcpgenrflag == "O" ) {
  722. indd = opener.model.getValue ( pamInfoNode + "/orddd" );
  723. orddrid = opener.model.getValue ( pamInfoNode + "/orddrid" );
  724. } else {
  725. indd = opener.model.getValue ( pamInfoNode + "/indd" );
  726. orddrid = opener.model.getValue ( pamInfoNode + "/medispclid" );
  727. }
  728. cretno = opener.model.getValue ( pamInfoNode + "/cretno" );
  729. orddeptcd = opener.model.getValue ( pamInfoNode + "/orddeptcd" );
  730. prcpdd = opener.model.getValue ( "/root/init/prcpdd" ); //처방일
  731. prcpkindcd = opener.model.getValue ("/root/init/prcpkindcd"); //처방종류(정규,추가...) /root/init/prcpkindcd 는 약속
  732. choiordflag = opener.model.getValue ( pamInfoNode + "/specordyn" ); //선택진료여부
  733. if ( choiordflag != "Y" ) {
  734. choiordflag = "N";
  735. }
  736. } else {
  737. //수술예약번호 setting
  738. if( !isNull (model.getValue ( "/root/operation/list/oprsrvno"))){
  739. model.setValue ( strSrc + "[" + sendRow + "]/oprsrvno", model.getValue ( "/root/operation/list/oprsrvno"));
  740. } else {
  741. model.setValue ( strSrc + "[" + sendRow + "]/oprsrvno", "0" );
  742. }
  743. //품절약 체크
  744. if ( prcpclscd == "A2" || prcpclscd == "A4" || prcpclscd == "A6" ) {
  745. var drugmastspec = model.getValue ( strSrc + "[" + sendRow + "]/drugmastspec") + "^";
  746. if ( getArrayData (drugmastspec, 0, 10, "^", "|" ) == "Y" ) {
  747. fAltDrug ( sendRow, "1", strSrc );
  748. return false;
  749. }
  750. }
  751. var srcNodeList = model.instances(0).selectNodes( "/root/paminfo" );
  752. prcpgenrflag = model.getValue ( "/root/patflag/list/prcpgenrflag" );
  753. pid = model.getValue ( pamInfoNode + "/pid" );
  754. if ( prcpgenrflag == "O" ) {
  755. indd = model.getValue ( pamInfoNode + "/orddd" );
  756. orddrid = model.getValue ( pamInfoNode + "/orddrid" );
  757. } else {
  758. indd = model.getValue ( pamInfoNode + "/indd" );
  759. orddrid = model.getValue ( pamInfoNode + "/medispclid" );
  760. }
  761. cretno = model.getValue ( pamInfoNode + "/cretno" );
  762. orddeptcd = model.getValue ( pamInfoNode + "/orddeptcd" );
  763. prcpdd = model.getValue ( "/root/init/prcpdd" ); //처방일
  764. prcpkindcd = model.getValue ("/root/init/prcpkindcd"); //처방종류(정규,추가...)
  765. choiordflag = model.getValue ( pamInfoNode + "/specordyn" ); //선택진료여부
  766. if ( choiordflag != "Y" ) {
  767. choiordflag = "N";
  768. }
  769. }
  770. model.setValue ( strSrc + "[" + sendRow + "]/prcphopedd",prcpdd); //처방희망일자
  771. if ( prcpclscd == "F2" && prcpgenrflag == "O") {
  772. model.setValue ( strSrc + "[" + sendRow + "]/etcprcpresncd", prcpdd ); //재활마감일
  773. } else if ( prcpclscd == "04" ) {
  774. model.setValue ( strSrc + "[" + sendRow + "]/hscttempprcpflag", "Y" ); //HSCT
  775. }
  776. model.setValue ( strSrc + "[" + sendRow + "]/prcpgenrflag", prcpgenrflag); //처방발생구분
  777. model.setValue ( strSrc + "[" + sendRow + "]/prcpkindcd", prcpkindcd ); //처방종류
  778. model.setValue ( strSrc + "[" + sendRow + "]/pampkspec", pid + "|" + indd + "|" + cretno + "|" + orddeptcd + "|" + orddrid ); //pampkspec : 등록번호|진료일자|생성번호|진료과|담당의 // 원무PK내역
  779. model.setValue ( strSrc + "[" + sendRow + "]/prcppkspec", prcpdd + "|0|0|" + getUserInfo("dutplceinstcd")); //처방키: 처방일자|처방번호|처방이력번호|기관코드
  780. model.setValue ( strSrc + "[" + sendRow + "]/choiordflag", choiordflag );
  781. if ( prcpgenrflag == "I" ) {
  782. model.setValue ( strSrc + "[" + sendRow + "]/hosinhosoutflag", "I" );
  783. model.setValue ( strSrc + "[" + sendRow + "]/hosinprcpresncd", "00" );
  784. }
  785. model.setValue ( strSrc + "[" + sendRow + "]/tempcol3", "" );
  786. return true;
  787. }
  788. /**
  789. * @desc : split을 이용한 배열값 가져오기
  790. * @param : pData: split이 포함된 원본데이터
  791. : pRow: row값
  792. : pCol: col값
  793. : pRowSep: row구분자
  794. : pColSep: col구분자
  795. * @return : arrCol[pCol]
  796. * @authur : 마정민 2007. 5. 9
  797. * @---------------------------------------------------
  798. */
  799. function getArrayData (pData, pRow, pCol, pRowSep, pColSep ) {
  800. var arrRow = pData.split(pRowSep);
  801. if(arrRow.length <= pRow) return "";
  802. var arrCol = arrRow[pRow].split(pColSep);
  803. if(arrCol.length <= pCol) return "";
  804. return arrCol[pCol];
  805. }
  806. /**
  807. * @group :
  808. * @ver : 2007. 5. 9
  809. * @by : 양천덕
  810. * @---------------------------------------------------
  811. * @type : function
  812. * @access : public
  813. * @desc : item명 수정 제한
  814. * @param : pPath: 선택한 그리드 row의 경로
  815. : pRow: row값
  816. : pCol: col값
  817. : pType: grid 구분
  818. * @return : arrCol[pCol]
  819. * @---------------------------------------------------
  820. */
  821. function fStopChnge(pPath, pGridID, pRow, pCol, pType){
  822. if(pType == "X"){ //MEDIATION
  823. if(pCol == pGridID.colRef("recitem")){
  824. if(model.getValue(pPath+ "["+ pRow + "]/statflag") != "" &&
  825. model.getValue(pPath+ "["+ pRow + "]/statflag") != "I"){
  826. messageBox("처방코드는 수정할 수 없습니다.", "E");
  827. event.preventDefault();
  828. return;
  829. }
  830. }else if(pCol == pGridID.colRef("recitemnm")){
  831. if(model.getValue(pPath+ "["+ pRow + "]/statflag") != "" &&
  832. model.getValue(pPath+ "["+ pRow + "]/statflag") != "I"){
  833. messageBox("처방명은 수정할 수 없습니다.", "E");
  834. event.preventDefault();
  835. return;
  836. }
  837. }
  838. }else{ //PROCEDURE, 검사
  839. if(pCol == pGridID.colRef("recitem")){
  840. if(model.getValue(pPath + "["+ pRow + "]/stat" ) == "재등록" ){
  841. messageBox("재등록 후 수정할 수 있습니다.", "E");
  842. event.preventDefault();
  843. return;
  844. }else if ( model.getValue(pPath + "["+ pRow + "]/stat" ) == "삭제" ){
  845. messageBox("삭제된 데이터는 수정할 수 없습니다.", "E");
  846. event.preventDefault();
  847. return;
  848. }else{
  849. ChgBeforeData = "";
  850. ChgBeforeDeflt = "";
  851. ChgBeforeData = model.getValue(pPath + "["+ pRow + "]/recitem" );
  852. }
  853. }
  854. }
  855. }