123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966 |
- /*
-
- 응급실 CPCR 기록지 기준자료 관리(SMMNE03800.xfm - JScript )
- - Version :
- 1) : Ver.1.00.01
- */
- var prcpNodeCPCR = "/root/main/cpcrbasecode/mediation/mediationlist";
- var prcpNode = "/root/prcp/prcplist";
- var prcpSubCntNode = "/root/main/prcp/prcplist";
- var prcpSubNode = "/root/main/prcp";
- var prcpnmCol = 2;
- var ChgBeforeData = "";
- var ChgBeforeDeflt = "";
- /**
- * @group :
- * @ver : 2007.07.21
- * @by : 양천덕
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 기준자료별 상태 변환
- * @param :
- * @return :
- * @---------------------------------------------------
- */
- function fStatChnge(chgPath, chgGridID, chgRow, chgCol ){
- if( chgRow == "0"){
- return;
- } else {
- // 상태 필드 더블클릭 시 이벤트 처리
- if(chgCol == chgGridID.colRef("stat")){
- // 행추가 제외, 상태구분 공백 제외(신규건은 제외)
- if(model.getValue(chgPath + "["+chgRow+"]/statflag") != "I" && model.getValue(chgPath + "["+chgRow+"]/statflag") != ""){
- // 유효여부가 Y이며 상태가 공백이면 삭제 처리
- if(model.getValue(chgPath + "["+chgRow+"]/valiyn") == "Y"
- && model.getValue(chgPath + "["+chgRow+"]/stat") == ""
- && model.getValue(chgPath + "["+chgRow+"]/statflag") == "S" ){
- model.setValue(chgPath + "["+chgRow+"]/statflag","D");
- model.setValue(chgPath + "["+chgRow+"]/valiyn","N");
- model.setValue(chgPath + "["+chgRow+"]/stat","삭제");
- return;
- // 유효여부가 N이며 상태구분이 조회이면 재등록 처리
- } else if (model.getValue(chgPath + "["+chgRow+"]/valiyn") == "N"
- && model.getValue(chgPath + "["+chgRow+"]/statflag") == "S") {
- model.setValue(chgPath + "["+chgRow+"]/statflag","D");
- model.setValue(chgPath + "["+chgRow+"]/valiyn","Y" );
- model.setValue(chgPath + "["+chgRow+"]/stat","재등록");
- return;
- // 유효여부가 Y이며 상태가 재등록이면 이전값으로 변경
- } else if (model.getValue(chgPath + "["+chgRow+"]/valiyn") == "Y"
- && model.getValue(chgPath + "["+chgRow+"]/stat") == "재등록") {
- model.setValue(chgPath + "["+chgRow+"]/statflag","S");
- model.setValue(chgPath + "["+chgRow+"]/valiyn","N" );
- model.setValue(chgPath + "["+chgRow+"]/stat","삭제");
- return;
- // 유효여부가 Y이며 상태구분이 삭제이면 삭제처리
- } else if (model.getValue(chgPath + "["+chgRow+"]/valiyn") == "Y"
- && model.getValue(chgPath + "["+chgRow+"]/statflag") == "D") {
- model.setValue(chgPath + "["+chgRow+"]/statflag","U");
- model.setValue(chgPath + "["+chgRow+"]/valiyn","N" );
- model.setValue(chgPath + "["+chgRow+"]/stat","삭제");
- return;
- } else if (model.getValue(chgPath + "["+chgRow+"]/statflag") == "U" ){
- messageBox("수정 데이터입니다. 저장 후 변경하십시요", "E");
- return;
- // 예외 처리 수정으로 변경
- } else {
- model.setValue(chgPath + "["+chgRow+"]/statflag","U");
- model.setValue(chgPath + "["+chgRow+"]/valiyn","Y");
- model.setValue(chgPath + "["+chgRow+"]/stat","");
- return;
- }
- }
- //변경필드가 DEFLT 일때 처리
- } else if (chgCol == chgGridID.colRef("default") && model.getValue(chgPath + "["+chgRow+"]/valiyn") == "Y" ) {
- // default 필드 데이터 변경
- if( model.getValue(chgPath + "["+chgRow+"]/default") == "Y" ){
- model.setValue(chgPath + "["+chgRow+"]/default","N");
- } else {
- model.setValue(chgPath + "["+chgRow+"]/default","Y");
- }
-
- // update 상태 변경
- if(model.getValue(chgPath + "["+chgRow+"]/statflag") != "I"){
- model.setValue(chgPath + "["+chgRow+"]/statflag","U");
- model.setValue(chgPath + "["+chgRow+"]/stat","수정");
- }
- } else {
- return;
- }
- }
- }
- /**
- * @group :
- * @ver : 2007.07.21
- * @by : 양천덕
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 항목별 기준자료 저장
- * @param :
- * @return :
- * @---------------------------------------------------
- */
- function fBaseCodeSave(pPath, pRows, pRow, pFlag){
- if(model.getValue("/root/main/cond/deptcd") == ""){
- messageBox("부서를", "C002");
- return;
- }
-
- var cSaveData = "S" ;
-
- if( pRows == "1" ){
- messageBox("저장할 데이터가", "I004");
- return;
- } else {
- for( i = 0 ; i < pRows ; i ++){
- if(model.getValue(pPath + "["+i+"]/statflag") != "S"){
- cSaveData = "C" ;
- }
- }
- if(pFlag == "grd_proclist" && cSaveData == "S"){
- messageBox("저장/변경 할 "+"PROCEDURE"+" 데이터가", "I004");
- return;
- } else if(pFlag == "grd_prcplist" && cSaveData == "S" ){
- messageBox("저장/변경 할 "+"MEDIATION"+" 데이터가", "I004");
- return;
- } else if(pFlag == "grd_testlist" && cSaveData == "S" ) {
- messageBox("저장/변경 할 "+"검사"+" 데이터가", "I004");
- return;
- }
- }
-
- for(i = 1 ; i < pRows ; i ++ ){
- var InsData = "";
- cnt = 0;
- if( model.getValue(pPath + "["+i+"]/statflag") == "I" ||
- model.getValue(pPath + "["+i+"]/statflag") == "U" ){
- InsData = model.getValue(pPath + "["+i+"]/recitem");
-
- for(j =1 ; j< pRows ; j++){
-
- if(model.getValue(pPath + "["+j+"]/recitem") == InsData && i != j){
- cnt++;
- }
- }
- }
- if(cnt>0){
- messageBox(InsData+"는 등록되어 있습니다.","I");
- // model.setValue(pPath + "["+pRow+"]/stat", "");
- // model.setValue(pPath + "["+pRow+"]/recitem", "");
- // model.setValue(pPath + "["+pRow+"]/default", "");
- // model.setValue(pPath + "["+pRow+"]/seq", "");
- // model.setValue(pPath + "["+pRow+"]/valiyn", "");
- // model.setValue(pPath + "["+pRow+"]/statflag", "");
- // model.setValue(pPath + "["+pRow+"]/recitemflag", "");
- // model.refresh();
- return;
- }
- }
-
- if(model.getValue("/root/main/cond/deptcd") != "" && cSaveData == "C") {
- fSrcOptionData();
-
- if(pFlag == "grd_proclist"){
- model.makeValue("/root/send/datalist", grd_proclist.getUpdateDataAll("i"));
- }else if(pFlag == "grd_prcplist"){
- model.makeValue("/root/send/datalist", grd_prcplist.getUpdateDataAll("i"));
- }else{
- model.makeValue("/root/send/datalist", grd_testlist.getUpdateDataAll("i"));
- }
-
- if(submit("TXMNE03801") == true){
- if(pFlag == "grd_proclist"){
- model.copynode("/root/main/cpcrbasecode/procedure","/root/cpcrbasecode/procedure");
- grd_proclist.refresh();
- } else if(pFlag == "grd_prcplist"){
- model.copynode("/root/main/cpcrbasecode/mediation","/root/cpcrbasecode/mediation");
- grd_prcplist.refresh();
- }else{
- model.copynode("/root/main/cpcrbasecode/test","/root/cpcrbasecode/test");
- grd_testlist.refresh();
- }
- model.removenode("/root/cpcrbasecode");
- }
- }
- }
- /**
- * @group :
- * @ver : 2007.07.21
- * @by : 양천덕
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 항목별 기준자료 조회 조건 값 설정
- * @param :
- * @return :
- * @---------------------------------------------------
- */
- function fSrcOptionData(){
- model.removenode("/root/send/cond");
- model.makeValue("/root/send/cond", "deptcd▦srcflag▩"
- + model.getValue("/root/main/cond/deptcd") +"▦"
- + model.getValue("/root/main/cond/srcflag")+"▩");
- }
- /**
- * @group :
- * @ver : 2007.07.21
- * @by : 양천덕
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 항목별 기준자료 조회 조건 값 설정
- * @param :
- * @return :
- * @---------------------------------------------------
- */
- function fSrcData(){
- fSrcOptionData();
- submit("TRMNE03801");
- }
- /**
- * @group :
- * @ver : 2007.07.21
- * @by : 양천덕
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 추가 행 기본 값 셋팅
- * @param :
- * @return :
- * @---------------------------------------------------
- */
- function fAddRow(addPath, addRow, addSubCode){
- if(model.getValue(addPath+"["+addRow+"]/recitem") == ""){
- model.setValue(addPath+"["+addRow+"]/stat", "");
- model.setValue(addPath+"["+addRow+"]/statflag", "");
- model.setValue(addPath+"["+addRow+"]/default", "");
- model.setValue(addPath+"["+addRow+"]/seq", "");
- model.setValue(addPath+"["+addRow+"]/valiyn", "");
- model.setValue(addPath+"["+addRow+"]/recitemflag", "");
- }
-
- if(model.getValue(addPath+"["+addRow+"]/statflag") == ""){
- model.setValue(addPath+"["+addRow+"]/stat", "미등록");
- model.setValue(addPath+"["+addRow+"]/statflag", "I");
- model.setValue(addPath+"["+addRow+"]/default", "Y");
- model.setValue(addPath+"["+addRow+"]/seq", addRow);
- model.setValue(addPath+"["+addRow+"]/valiyn", "Y");
- model.setValue(addPath+"["+addRow+"]/recitemflag", addSubCode);
- } else if (model.getValue(addPath+"["+addRow+"]/statflag") == "S" && model.getValue(addPath+"["+addRow+"]/stat")== "") {
- if(ChgBeforeData != model.getValue(addPath+"["+addRow+"]/recitem") ){
- model.setValue(addPath+"["+addRow+"]/statflag", "U");
- model.setValue(addPath+"["+addRow+"]/stat", "수정");
- model.refresh();
- }else{
- return;
- }
- } else if (model.getValue(addPath+"["+addRow+"]/statflag") == "S" && model.getValue(addPath+"["+addRow+"]/valiyn")== "N") {
- return;
- }
- }
-
- /**
- * @group :
- * @ver : 2007.07.21
- * @by : 양천덕
- - 2008.07.21 수정 : 성미연 (처방명 검색기능 추가)
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : MEDIATION 처방검색
- * @param :
- * @return :
- * @---------------------------------------------------
- */
- function fPrcpSrch(srchflag) {
- var curRow = 0;
-
- if(event.keyCode == "13") {
- if ( model.getValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/prcpflag") == "2" &&
- model.getValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/drugmastspec") =="Y" ){
- return;
- }
-
- if(srchflag == "cd"){
- var prcpnm = model.getValue ( prcpNodeCPCR + "[" + grd_prcplist.row+ "]/recitem" );
- var mthdnm = "getPrcpCdOldSrchInfo";
-
- }else if(srchflag == "nm"){
- var prcpnm = model.getValue ( prcpNodeCPCR + "[" + grd_prcplist.row+ "]/recitemnm" );
- var mthdnm = "getPrcpNmSrchInfo";
- }
- var isHangul = fIsHangul (prcpnm);
- //한글일때는 1글자만 넣어도 검색가능
- if ( isNull(prcpnm)) {
- model.alert ( "검색어를 입력해 주십시오." );
-
- model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/stat", "");
- model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/statflag", "");
- model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/default", "");
- model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/seq", "");
- model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/valiyn", "");
- model.setValue(prcpNodeCPCR+"["+grd_prcplist.row+"]/recitemflag", "");
- grd_prcplist.refresh();
- return;
-
- } else if ( isHangul == "E" ){
- //영문,숫자일때는 3글자 넣어야 검색가능
- if ( prcpnm.length < 2 ){
- model.alert ( "2글자 이상 입력해 주십시오." );
- return;
- }
-
- } else if ( isHangul == "H" ) {
- if ( prcpnm.length < 2 ){
- model.alert ( "한글은 2글자 이상 입력해 주십시오." );
- return;
- }
- }
- if (prcpnm.charAt ( 0 ) == "/"){
-
- if ( prcpnm.length == 1 ){
- model.alert( "검색할 수술명이 없습니다." );
- return;
- }
-
- var curRow = grd_prcplist.row;
- var srchRow = grd_prcplist.rows -1;
- var xpt = window.screenleft + 180;
- var ypt = window.screenTop + 80;
- modal ( "SPMMO05100", 1, xpt, ypt );
- } else {
- fPrcpSrchCom ( prcpnm, getCurrentDate(), "", "TRMMO00100", "-", "false", mthdnm, isHangul);
- //fPrcpSrchCom ( prcpnm, prcpdd, insukind, trnm, ioflag, refreshFlag, mthdnm, isHangul )
-
- var srchLength = model.instances(0).selectNodes( "/root/prcpsrch/prcplist" ).length;
- var curRow = grd_prcplist.row;
- var nextRow = grd_prcplist.row + 1;
- if( srchLength > 1) {
- import1.visible = true;
- } else if( srchLength == 1) {
- srchRow = addPrcpDetl ( "import" , "/root/prcpsrch/prcplist" , "/root/main/prcp" , 1 , grd_prcplist.row, "00" );
- if (srchRow !=0 ) {
- focusMain ( srchRow );
- }
- } else {
- model.alert ( "검색된 내용이 없습니다." );
- grd_prcplist.editCell();
- grd_prcplist.dispatch("onentercell");
- }
- model.refresh();
- }
- }
- }
-
- /**
- * @desc : 데이터 한글인지 영문인지 구분해주는 함수
- * @param : pData: 한글여부를 비교할 데이터
- * @return : E: 영문, H: 한글
- * @authur : 마정민 2007. 5. 30
- * @---------------------------------------------------
- */
- function fIsHangul(pData) {
- var sBit = pData.charAt(0);
- if (escape(sBit).length <= 4) return "E";
- return "H";
- }
-
- /**
- * @desc : 처방검색
- * @param : prcpnm: 검색할 처방명
- : prcpdd: 처방일자
- : insukind: 보험유형
- : trnm: 트랜젝션 네임
- : ioflag: 외래, 입원, 응급 구분
- : refreshFlag: refresh 여부
- : mthdnm 명
- * @return : void
- * @authur : 마정민 2007. 6. 21
- * @---------------------------------------------------
- */
- function fPrcpSrchCom ( prcpnm, prcpdd, insukind, trnm, ioflag, refreshFlag, mthdnm, isHangul ) {
- /*
- if ( isNull(trnm)) {
- trnm = "TRMMO00100";
- }
- if ( isNull(ioflag)) {
- ioflag = "-";
- }
- if ( isNull(refreshFlag)) {
- refreshFlag = false;
- }
- */
- //mthdnm = "getPrcpCdOldSrchInfo";
- //getPrcpCdSrchInfo
- //getOldPrcpCdChngInfo
- //getPrcpCdOldSrchInfo
-
- model.setValue ( "/root/send/cond1", prcpnm ); //처방명, 수가코드
- model.setValue ( "/root/send/cond2", ioflag ); //외래, 입원, 응급 구분
- model.setValue ( "/root/send/cond3", prcpdd ); //처방일
- model.setValue ( "/root/send/cond4", insukind ); //환자보험유형
- if ( !isNull( isHangul)) {
- model.setValue ( "/root/send/cond5", isHangul ); //한영구분
- }
- model.setValue ( "/root/send/cond6", "2" ); //1 : CONTAINS검색, 2 : LIKE검색
- model.setValue ( "/root/send/cond99", mthdnm ); //검색구분
-
- if ( refreshFlag == false ) {
- submit (trnm, false );
- } else {
- submit( trnm );
- }
- }
- /**
- * @desc : 검색된 내용중 내릴 처방을 선택하여 전송한다.( double click )
- * @param : objFlag - child or else
- : strSrc - source node
- : strDest - 목적지 node; child일때는 opener.root.main.prcp, 아니면 "/root/main/prcp" 이다
- : sendRow - 검색된 내용중 메인으로 보내고자 하는 row
- : srchRow - 메인에 들어간 자리. 검색로우(srchRow) 바로 전이다.
- : prcpInptFlag - - 처방입력구분 00 처방검색, 01 전회처방, 02 약속처방, 03 약속수술.. M0034
- : groupSrc - 옵션: group처방 검색할 경우 node
- : direcSrc - 옵션: group 지시처방 검색할 경우 node
- : prcpInptFlag - 처방입력구분 00 처방검색, 01 전회처방, 02 약속처방, 03 약속수술.. M0034
- * @return : srchRow 에러시 0
- * @authur : 마정민 2007. 4. 12
- * @---------------------------------------------------
- */
- function addPrcpDetl ( objFlag, strSrc, strDest, sendRow, srchRow, prcpInptFlag, grupSrc, direcSrc ) {
- var prcpClsCd = model.getValue( strSrc + "[" + sendRow + "]/prcpclscd" );
- var prcpKindCd = model.getValue( strSrc + "[" + sendRow + "]/prcpkindcd" );
- var drugmthdspccd = model.getValue( strSrc + "[" + sendRow + "]/drugmthdspccd" );
- var prcpnm = model.getValue( strSrc + "[" + sendRow + "]/prcpnm" );
- if ( objFlag == "child" ) usge = opener.model.getValue ( "/root/usge" );
- else usge = model.getValue ( "/root/usge" );
-
- if (!fPrmsSaveCheck ( usge, prcpKindCd, prcpnm )) {
- return 0;
- }
- if ( prcpInptFlag == "01" ) { //전회처방
- if ( model.getValue ( strSrc + "[" + sendRow + "]/prcphistcd" ) == "E" ) {
- model.alert ( "반납처방은 처방복사가 안됩니다." );
- return 0;
- }
- }
- //그룹코드 M을 찾아낸다. 처방검색일때만 풀린다.
- if ( model.getValue( strSrc + "[" + sendRow + "]/grupsnglflag" ) == "M" && prcpInptFlag == "00" ) {
- var grupCond1 = model.getValue( strSrc + "[" + sendRow + "]/prcpcd" );
- var grupCond3 = "";
- var grupCond4 = "";
- if ( objFlag == "child" ) {
- grupCond3 = opener.model.getValue ( "/root/init/prcpdd" );
- grupCond4 = opener.model.getValue ( "/root/paminfo/list/insukind");
- } else {
- grupCond3 = model.getValue ( "/root/init/prcpdd" );
- grupCond4 = model.getValue ( "/root/paminfo/list/insukind");
- }
- prcpGroupSrch ( grupCond1, grupCond3, grupCond4 );
- if ( objFlag == "child" ) {
- var destNode = opener.model.instances(0).selectSingleNode( strDest ) // or opener.root.main.prcp 이런식으로
- } else {
- var destNode = strDest;
- }
- if ( grupSrc == null ) grupSrc = "/root/prcpgroup/prcplist";
- var srcNodeList = model.instances(0).selectNodes( grupSrc );
- for (var i=1; i<srcNodeList.length+1; i++) {
- if (addPrcpSetValue ( objFlag, grupSrc, i, prcpInptFlag )) {
- model.duplicate( destNode, grupSrc +"[" + i + "]", "*[" + srchRow + "]");
- srchRow ++;
- }
- }
- // } else if ( model.getValue( strSrc + "[" + sendRow + "]/grupsnglflag" ) == "J" && prcpInptFlag == "00" ) { //그룹지시처방 J을 찾아낸다. 처방검색일때만 풀린다.
- } else if ( model.getValue( strSrc + "[" + sendRow + "]/grupsnglflag" ) == "J" ) { //그룹지시처방 J을 찾아낸다.
- //조회조건
- var direcCond1 = model.getValue( strSrc + "[" + sendRow + "]/srchcondcnts" );
- var direcCond5 = model.getValue( strSrc + "[" + sendRow + "]/prcpcd" );
- var direcCond3 = "";
- var direcCond4 = "";
- if ( objFlag == "child" ) {
- direcCond3 = opener.model.getValue ( "/root/init/prcpdd" );
- direcCond4 = opener.model.getValue ( "/root/paminfo/list/insukind");
- } else {
- direcCond3 = model.getValue ( "/root/init/prcpdd" );
- direcCond4 = model.getValue ( "/root/paminfo/list/insukind");
- }
- prcpDirecSrch ( direcCond1, direcCond3, direcCond4, direcCond5 );
- if ( direcSrc == null ) direcSrc = "/root/prcpdirec/prcplist";
- var srcNodeList = model.instances(0).selectNodes( direcSrc );
- if ( srcNodeList.length != 0 ){ //그룹지시처방 J는 종속하는 수가 코드가 있을 때문 추가.
- if ( objFlag == "child" ) {
- var destNode = opener.model.instances(0).selectSingleNode( strDest ) // or opener.root.main.prcp 이런식으로
- } else {
- var destNode = strDest;
- }
- if (!addPrcpSetValue ( objFlag, strSrc, sendRow, prcpInptFlag )) {
- return 0;
- }
-
- model.duplicate( destNode, strSrc + "[" + sendRow + "]", "*[" + srchRow + "]");
- srchRow ++;
-
- for (var k=1; k <= srcNodeList.length; k++) {
- if ( objFlag == "child" ) {
- var destNode = opener.model.instances(0).selectSingleNode( strDest ) // or opener.root.main.prcp 이런식으로
- } else {
- var destNode = strDest;
- }
- if (addPrcpSetValue ( objFlag, direcSrc, k, prcpInptFlag )) {
- model.duplicate( destNode, direcSrc + "[" + k + "]", "*[" + srchRow + "]");
- srchRow ++;
- }
- }
- }
- } else { //그룹코드 M, J 가 아닐 경우
- if ( objFlag == "child" ) {
- var destNode = opener.model.instances(0).selectSingleNode( strDest ) // or opener.root.main.prcp 이런식으로
- if (!addPrcpSetValue ( objFlag, strSrc, sendRow, prcpInptFlag )) {
- return 0;
- }
-
- model.duplicate( destNode, strSrc + "[" + sendRow + "]", "*[" + srchRow + "]");
-
- //처방, 약속처방구분
- if ( usge == "prcp" ) {
- if ( prcpClsCd == "H2" || prcpClsCd == "C4" ) { //수술, angio 는 선택시 자동 팝업이다
- opener.javascript.fPrcpDetl( srchRow );
- } else if ( prcpClsCd == "D2" ) { //병리검체 팝업
- opener.javascript.fReqfrm ( srchRow );
- } else if ( prcpClsCd == "B2" || prcpClsCd == "B4" || prcpClsCd == "B6" ) { //진단검체 팝업
- if ( drugmthdspccd == "999" ) { //검체코드가 999일때 띄운다.
- opener.javascript.fGetSpc ( srchRow );
- }
- }
- }
- } else {
- var destNode = strDest;
- if (!addPrcpSetValue ( objFlag, strSrc, sendRow, prcpInptFlag )) {
- return 0;
- }
- model.duplicate( destNode, strSrc + "[" + sendRow + "]", "*[" + srchRow + "]");
- //처방, 약속처방구분
- if ( usge == "prcp" ) {
- if ( prcpClsCd == "H2" || prcpClsCd == "C4" ) { //수술, angio 는 선택시 자동 팝업이다
- fPrcpDetl( srchRow );
- } else if ( prcpClsCd == "D2" ) { //병리검체 팝업
- fReqfrm ( srchRow );
- } else if ( prcpClsCd == "B2" || prcpClsCd == "B4" || prcpClsCd == "B6" ) { //진단검체 팝업
- if ( drugmthdspccd == "999" ) { //검체코드가 999일때 띄운다.
- fGetSpc ( srchRow );
- }
- }
- }
- }
- srchRow ++;
- }
- return srchRow; //검색 row 값을 넘겨준다.
- alert(srchRow);
- }
- /**
- * @desc : 포커스를 메인으로 한다.
- * @param : curRow => 메인의 검색 row
- : flag => child
- : prcpNmClearFlag => 검색명을 클리어 시킬건지 여부
- * @return : void
- * @authur : 마정민 2007. 4. 12
- * @---------------------------------------------------
- */
- function focusMain( curRow, flag, prcpNmClearFlag ) {
- if ( flag == "child" ) {
- if ( prcpNmClearFlag != "N" ) {
- opener.model.setValue( "/root/main/prcp/prcplist[" + curRow + "]/prcpnm", "");
- }
- opener.grd_prcplist.refresh();
- opener.model.recalculate();
- opener.model.setfocus( "grd_prcplist" );
- opener.grd_prcplist.row = curRow;
- opener.grd_prcplist.col = prcpnmCol;
- opener.grd_prcplist.dispatch("onentercell");
-
- } else {
- model.removeNodeset( "/root/prcpsrch/prcplist");
- model.removeNodeset( "/root/prcpgroup/prcplist");
- model.removeNodeset( "/root/prcpdirec/prcplist");
- import1.visible = false;
- if ( prcpNmClearFlag != "N" ) {
- model.setValue( prcpNodeCPCR +"[" + grd_prcplist.row + "]/recitem", ""); //검색그리드를 클리어 시킨다.
- //model.setValue( "/root/main/prcp/prcplist[" + curRow + "]/prcpnm", ""); //검색그리드를 클리어 시킨다.
- }
- // alert ( getNodesetCount(prcpSubCntNode) );
- if(getNodesetCount(prcpSubCntNode) == 2) {
- model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/stat", "미등록");
- model.setValue("/root/main/cpcrbasecode/mediation/mediationlist[" + grd_prcplist.row + "]/recitem", model.getValue("/root/main/prcp/prcplist["+ 1 +"]/prcpcd"));
- model.setValue("/root/main/cpcrbasecode/mediation/mediationlist[" + grd_prcplist.row + "]/recitemnm", model.getValue("/root/main/prcp/prcplist["+ 1 +"]/prcpnm"));
- model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/statflag", "I");
- model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/default", "Y");
- model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/seq", grd_prcplist.row);
- model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/valiyn", "Y");
- model.setValue(prcpNodeCPCR + "[" + grd_prcplist.row + "]/recitemflag", "M");
- } else {
- for(i = 1 ; i < getNodesetCount(prcpSubCntNode) ; i++){
- if(i != 1){
- grd_prcplist.addRow();
- }
- var j = grd_prcplist.row;
- model.setValue(prcpNodeCPCR + "[" + j + "]/stat", "미등록");
- model.setValue(prcpNodeCPCR + "[" + j + "]/recitem", model.getValue("/root/main/prcp/prcplist["+ i +"]/prcpcd"));
- model.setValue(prcpNodeCPCR + "[" + j + "]/recitemnm", model.getValue("/root/main/prcp/prcplist["+ i +"]/prcpnm"));
- model.setValue(prcpNodeCPCR + "[" + j + "]/statflag", "I");
- model.setValue(prcpNodeCPCR + "[" + j + "]/default", "Y");
- model.setValue(prcpNodeCPCR + "[" + j + "]/seq", grd_prcplist.row);
- model.setValue(prcpNodeCPCR + "[" + j + "]/valiyn", "Y");
- model.setValue(prcpNodeCPCR + "[" + j + "]/recitemflag", "M");
- }
- }
-
- model.removenode(prcpSubNode);
-
- grd_prcplist.refresh();
- model.recalculate();
- model.setfocus( "grd_prcplist" );
- //grd_prcplist.row = ;
- grd_prcplist.col = prcpnmCol;
- grd_prcplist.dispatch("onentercell");
-
- }
- }
- /**
- * @desc : check 된 Source Node의 값을 목적지에 Append Node 한다.(처방검색)
- * @param : objFlag - child or else
- : strSrc - 출발지 Node
- : strDest - 목적지 Node
- : multiFlag - 복수 add 여부
- : checkNM - check로 사용할 instance명
- : checkFlag - check시 Value
- : grdObj - 더블클릭시 값을 넘기는 그리드 명
- : prcpNmClearFlag - 검색 row에 검색명 클리어 여부
- : prcpInptFlag - 처방입력구분 00 처방검색, 01 전회처방, 02 약속처방, 03 약속수술.. M0034
- : ex) addPrcp ( "child", "/root/prcpsrch/prcplist", "/root/main/prcp", "N", "status", "I", grd_prcpsrchlist, "N");
- * @return : void
- * @authur : 마정민 2007. 3. 12
- * @---------------------------------------------------
- */
- function addPrcp ( objFlag, strSrc, strDest, multiFlag, checkNM, checkFlag, grdObj, prcpNmClearFlag, prcpInptFlag ) {
- model.makeNode("/root/main/prcp/prcplist")
- model.copyNode("/root/main/prcp/prcplist", prcpNode);
-
- //목적지를 변수로 받고 싶었으나 iviewer에서 문제가 있어 목적지는 프레그를 구분자로 박아 넣음.
- var srchRow = 0;
- var srcNodeList = model.instances(0).selectNodes(strSrc); //or instance1.selectNodes(strSrc)
-
- //검색Row 찾기
- if ( objFlag == "child") {
- var destNodeList = opener.model.instances(0).selectNodes( strDest + "/prcplist" ); //dest Node에서 prcplist는 약속으로 하자.
- for ( i = destNodeList.length; i>0; i-- ){
- opener.model.getValue ( strDest + "/prcplist[" + i + "]" ) == "S";
- srchRow = i;
- break;
- }
- } else {
- var destNodeList = model.instances(0).selectNodes( strDest + "/prcplist" );
- for ( i = destNodeList.length; i >0; i-- ){
- model.getValue ( strDest + "prcplist[" + i + "]" ) == "S";
- srchRow = i;
- break;
- }
- }
- if ( multiFlag == "Y" ){
- for( var i = 1; i <= srcNodeList.length; i++ ) {
- if ( model.getValue( strSrc + "[" + i + "]/" + checkNM) == checkFlag ) {
- srchRow = addPrcpDetl ( objFlag , strSrc , strDest , i , srchRow, prcpInptFlag );
- }
- }
- } else { //더블클릭으로 넘길때
- srchRow = addPrcpDetl ( objFlag , strSrc , strDest , grdObj.row , srchRow, prcpInptFlag );
- }
- if ( srchRow != 0 ) {
- focusMain ( srchRow, objFlag, prcpNmClearFlag );
- }
- }
- /**
- * @desc : 약속처방에 등록 가능한지 check
- * @param : usge: 저장화면
- : prcpkindcd: 처방분류
- : prcpnm: 처방명
- * @return : true, false
- * @authur : 마정민 2007. 6. 22
- * @---------------------------------------------------
- */
- function fPrmsSaveCheck ( usge, prcpkindcd, prcpnm ) {
- //약속처방, 지시처방에서는 HSCT 처방을 등록할 수 없다.
- if ( prcpkindcd == "04" && usge == "prms" ) {
- model.alert ( "약속처방에는 [" + prcpnm +"] HSCT 처방을 등록하실 수 없습니다." )
- return false;
- } else if ( prcpkindcd == "04" && usge == "direc" ) {
- model.alert ( "지시처방에는 [" + prcpnm +"] HSCT 처방을 등록하실 수 없습니다." )
- return false;
- }
- return true;
- }
- /**
- * @desc : 처방main에 넘기기 전에 기본값을 setting한다.
- * @param : objFlag => child or ...
- : strSrc => setting할 source node
- : sendRow => setting할 row
- : prcpInptFlag - - 처방입력구분 00 처방검색, 01 전회처방, 02 약속처방, 03 약속수술.. M0034
- * @return : true, false
- * @authur : 마정민 2007. 4. 12
- * @---------------------------------------------------
- */
- function addPrcpSetValue ( objFlag, strSrc , sendRow, prcpInptFlag ) {
- // OrgPrcpQty // 실제 처방수량
- var prcpdd = ""; //처방일
- var prcpkindcd = ""; //처방종류변수
- var pamInfoNode = "/root/paminfo/list";
- var pid = ""; //환자번호
- var indd = ""; //진료일자
- var cretno = ""; //생성번호
- var orddeptcd = ""; //담당부서
- var orddrid = ""; //담당교수
- var prcpgenrflag = ""; //외래입원구분
- var prcpclscd = model.getValue ( strSrc + "[" + sendRow + "]/prcpclscd" );
- var choiordflag = "";
-
- if ( isNull(prcpInptFlag)) prcpInptFlag = model.getValue ( strSrc + "[" + sendRow + "]/prcpinptflag" );
- model.setValue ( strSrc + "[" + sendRow + "]/status", "I" );
- // model.setValue ( strSrc + "[" + sendRow + "]/rgstridnm", getUserName()); //등록자명
- model.setValue ( strSrc + "[" + sendRow + "]/prcpinptflag", prcpInptFlag ); //처방입력구분
- // model.setValue ( strSrc + "[" + sendRow + "]/prcpstatcd", "000" ); //처방상태코드:처방
- model.setValue ( strSrc + "[" + sendRow + "]/prcphistcd", "O" ); //처방이력코드:O
- model.setValue ( strSrc + "[" + sendRow + "]/prcpauthflag", "0" ); //처방권한구분:0
- model.setValue ( strSrc + "[" + sendRow + "]/prcpsignflag", "2" ); //처방이력구분:2
- // var issdept = model.getValue ("/root/init/issdept");
- var issdept = getUserInfo( "dutplcecd" );
- // if ( isNull(issdept)) {
- //issdept = getUserInfo( "posdeptcd" );
- // }
- model.setValue ( strSrc + "[" + sendRow + "]/issdeptcd", issdept );
- if ( objFlag == "child" ){
- //수술예약번호 setting
- if( !isNull (opener.model.getValue ( "/root/operation/list/oprsrvno"))){
- model.setValue ( strSrc + "[" + sendRow + "]/oprsrvno", opener.model.getValue ( "/root/operation/list/oprsrvno"));
- } else {
- model.setValue ( strSrc + "[" + sendRow + "]/oprsrvno", "0" );
- }
- //품절약 체크
- if ( prcpclscd == "A2" || prcpclscd == "A4" || prcpclscd == "A6" ) {
- var drugmastspec = model.getValue ( strSrc + "[" + sendRow + "]/drugmastspec") + "^";
- if ( getArrayData (drugmastspec, 0, 10, "^", "|" ) == "Y" ) {
- opener.javascript.fAltDrug ( sendRow, "1", strSrc );
- return false;
- }
- }
- var srcNodeList = opener.model.instances(0).selectNodes( "/root/paminfo" );
- prcpgenrflag = opener.model.getValue ( "/root/patflag/list/prcpgenrflag" );
- pid = opener.model.getValue ( pamInfoNode + "/pid" );
- if ( prcpgenrflag == "O" ) {
- indd = opener.model.getValue ( pamInfoNode + "/orddd" );
- orddrid = opener.model.getValue ( pamInfoNode + "/orddrid" );
- } else {
- indd = opener.model.getValue ( pamInfoNode + "/indd" );
- orddrid = opener.model.getValue ( pamInfoNode + "/medispclid" );
- }
- cretno = opener.model.getValue ( pamInfoNode + "/cretno" );
- orddeptcd = opener.model.getValue ( pamInfoNode + "/orddeptcd" );
- prcpdd = opener.model.getValue ( "/root/init/prcpdd" ); //처방일
- prcpkindcd = opener.model.getValue ("/root/init/prcpkindcd"); //처방종류(정규,추가...) /root/init/prcpkindcd 는 약속
- choiordflag = opener.model.getValue ( pamInfoNode + "/specordyn" ); //선택진료여부
- if ( choiordflag != "Y" ) {
- choiordflag = "N";
- }
- } else {
- //수술예약번호 setting
- if( !isNull (model.getValue ( "/root/operation/list/oprsrvno"))){
- model.setValue ( strSrc + "[" + sendRow + "]/oprsrvno", model.getValue ( "/root/operation/list/oprsrvno"));
- } else {
- model.setValue ( strSrc + "[" + sendRow + "]/oprsrvno", "0" );
- }
- //품절약 체크
- if ( prcpclscd == "A2" || prcpclscd == "A4" || prcpclscd == "A6" ) {
- var drugmastspec = model.getValue ( strSrc + "[" + sendRow + "]/drugmastspec") + "^";
- if ( getArrayData (drugmastspec, 0, 10, "^", "|" ) == "Y" ) {
- fAltDrug ( sendRow, "1", strSrc );
- return false;
- }
- }
- var srcNodeList = model.instances(0).selectNodes( "/root/paminfo" );
-
- prcpgenrflag = model.getValue ( "/root/patflag/list/prcpgenrflag" );
- pid = model.getValue ( pamInfoNode + "/pid" );
-
- if ( prcpgenrflag == "O" ) {
- indd = model.getValue ( pamInfoNode + "/orddd" );
- orddrid = model.getValue ( pamInfoNode + "/orddrid" );
- } else {
- indd = model.getValue ( pamInfoNode + "/indd" );
- orddrid = model.getValue ( pamInfoNode + "/medispclid" );
- }
- cretno = model.getValue ( pamInfoNode + "/cretno" );
- orddeptcd = model.getValue ( pamInfoNode + "/orddeptcd" );
- prcpdd = model.getValue ( "/root/init/prcpdd" ); //처방일
- prcpkindcd = model.getValue ("/root/init/prcpkindcd"); //처방종류(정규,추가...)
- choiordflag = model.getValue ( pamInfoNode + "/specordyn" ); //선택진료여부
- if ( choiordflag != "Y" ) {
- choiordflag = "N";
- }
- }
- model.setValue ( strSrc + "[" + sendRow + "]/prcphopedd",prcpdd); //처방희망일자
- if ( prcpclscd == "F2" && prcpgenrflag == "O") {
- model.setValue ( strSrc + "[" + sendRow + "]/etcprcpresncd", prcpdd ); //재활마감일
- } else if ( prcpclscd == "04" ) {
- model.setValue ( strSrc + "[" + sendRow + "]/hscttempprcpflag", "Y" ); //HSCT
- }
- model.setValue ( strSrc + "[" + sendRow + "]/prcpgenrflag", prcpgenrflag); //처방발생구분
- model.setValue ( strSrc + "[" + sendRow + "]/prcpkindcd", prcpkindcd ); //처방종류
- model.setValue ( strSrc + "[" + sendRow + "]/pampkspec", pid + "|" + indd + "|" + cretno + "|" + orddeptcd + "|" + orddrid ); //pampkspec : 등록번호|진료일자|생성번호|진료과|담당의 // 원무PK내역
- model.setValue ( strSrc + "[" + sendRow + "]/prcppkspec", prcpdd + "|0|0|" + getUserInfo("dutplceinstcd")); //처방키: 처방일자|처방번호|처방이력번호|기관코드
- model.setValue ( strSrc + "[" + sendRow + "]/choiordflag", choiordflag );
- if ( prcpgenrflag == "I" ) {
- model.setValue ( strSrc + "[" + sendRow + "]/hosinhosoutflag", "I" );
- model.setValue ( strSrc + "[" + sendRow + "]/hosinprcpresncd", "00" );
- }
- model.setValue ( strSrc + "[" + sendRow + "]/tempcol3", "" );
- return true;
- }
- /**
- * @desc : split을 이용한 배열값 가져오기
- * @param : pData: split이 포함된 원본데이터
- : pRow: row값
- : pCol: col값
- : pRowSep: row구분자
- : pColSep: col구분자
- * @return : arrCol[pCol]
- * @authur : 마정민 2007. 5. 9
- * @---------------------------------------------------
- */
- function getArrayData (pData, pRow, pCol, pRowSep, pColSep ) {
- var arrRow = pData.split(pRowSep);
-
- if(arrRow.length <= pRow) return "";
- var arrCol = arrRow[pRow].split(pColSep);
- if(arrCol.length <= pCol) return "";
- return arrCol[pCol];
- }
- /**
- * @group :
- * @ver : 2007. 5. 9
- * @by : 양천덕
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : item명 수정 제한
- * @param : pPath: 선택한 그리드 row의 경로
- : pRow: row값
- : pCol: col값
- : pType: grid 구분
- * @return : arrCol[pCol]
- * @---------------------------------------------------
- */
- function fStopChnge(pPath, pGridID, pRow, pCol, pType){
- if(pType == "X"){ //MEDIATION
- if(pCol == pGridID.colRef("recitem")){
- if(model.getValue(pPath+ "["+ pRow + "]/statflag") != "" &&
- model.getValue(pPath+ "["+ pRow + "]/statflag") != "I"){
- messageBox("처방코드는 수정할 수 없습니다.", "E");
- event.preventDefault();
- return;
- }
- }else if(pCol == pGridID.colRef("recitemnm")){
- if(model.getValue(pPath+ "["+ pRow + "]/statflag") != "" &&
- model.getValue(pPath+ "["+ pRow + "]/statflag") != "I"){
- messageBox("처방명은 수정할 수 없습니다.", "E");
- event.preventDefault();
- return;
- }
- }
-
- }else{ //PROCEDURE, 검사
- if(pCol == pGridID.colRef("recitem")){
- if(model.getValue(pPath + "["+ pRow + "]/stat" ) == "재등록" ){
- messageBox("재등록 후 수정할 수 있습니다.", "E");
- event.preventDefault();
- return;
- }else if ( model.getValue(pPath + "["+ pRow + "]/stat" ) == "삭제" ){
- messageBox("삭제된 데이터는 수정할 수 없습니다.", "E");
- event.preventDefault();
- return;
- }else{
- ChgBeforeData = "";
- ChgBeforeDeflt = "";
- ChgBeforeData = model.getValue(pPath + "["+ pRow + "]/recitem" );
- }
- }
- }
- }
|