123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500 |
- /* ---------------------------------------------------------------------
- Care Plan 관리 (SMMRJ00100_CountList관리.xrw - JScript )
- - Version :
- 1) : Ver.1.00.01
- : Create By taebum
- : 2009-11-27 오전 10:05:51
- ---------------------------------------------------------------------- */
- /* --------------------------------------------------*/
- /* type : function */
- /* access : public */
- /* desc : xforms-ready시 수행한다 */
- /* return : */
- /* --------------------------------------------------*/
- function fInit() {
- ipt_reqfromstnddd.value = getNewDate().getAddDate(-2, "D").getDateFormat("YYYYMMDD").substr(0, 8);
- ipt_reqtostnddd.value = getCurrentDate().substr(0, 8);
- fInitMain();
- fGetOpenPatInfo();
- // fSearchPatNm();
- }
- function fInitMain() {
- model.removeNodeSet("/root/main/careplanlists/careplanlist");
- model.removeNodeSet("/root/init/ordlists/ordlist");
- model.removeNodeSet("/root/main/careplanlists/diagengnminfo/diagengnm");
- model.removeNodeSet("/root/main/careplanlists/medirecinfo/medi0000931");
- model.removeNodeSet("/root/main/careplanlists/medirecinfo/medi0001173");
- model.removeNodeSet("/root/main/careplanlists/medirecinfo/medi0000098");
- combo1.refresh();
- ipt_diagengnm.refresh();
- tar_medi0001173.refresh();
- ipt_medi0000931.refresh();
- tar_medi0000098.refresh();
- datagrid01.refresh();
- datagrid02.refresh();
- datagrid03.refresh();
- datagrid04.refresh();
- datagrid05.refresh();
- datagrid99.refresh();
- }
- function fGetOpenPatInfo(){
- var pid = "";
- var orddd = "";
- var cretno = "";
- var hngnm = "";
- var ioflag= "";
-
- if (isPopup() == true) {
- // param 환자정보
- pid = opener.javascript.getParameter("SMMRJ00100_pid");
- orddd = opener.javascript.getParameter("SMMRJ00100_orddd");
- cretno = opener.javascript.getParameter("SMMRJ00100_cretno");
- hngnm = opener.javascript.getParameter("SMMRJ00100_hngnm");
- ioflag = opener.javascript.getParameter("SMMRJ00100_ioflag");
-
- if ( pid == null ) { pid == ""; }
- if ( orddd == null ) { orddd == ""; }
- if ( cretno == null ) { cretno == ""; }
- if ( hngnm == null ) { hngnm == ""; }
- if ( ioflag == null ) { ioflag == ""; }
- if ( pid != "" && orddd !="" && cretno!="" && hngnm != "" && ioflag!= "") {
- model.setValue("/root/send/reqdata/pid", pid);
- model.setValue("/root/send/reqdata/ordtype", ioflag);
- input3.refresh();
- model.setValue("/root/send/pid", pid);
- model.setValue("/root/send/orddd", orddd);
- model.setValue("/root/send/cretno", cretno);
- model.makeValue("/root/init/condition/pid", pid);
- model.makeValue("/root/init/condition/orddd", orddd);
- model.makeValue("/root/init/condition/cretno", cretno);
-
- model.setValue("/root/send/reqdata/pnm", hngnm);
- input4.refresh();
- fSearchOrdList();
- fChangeComboValue("open");
- }
-
- if(pid != "" && hngnm =="" ){
- model.setValue("/root/send/reqdata/pid", pid);
- fSearchPatNm();
- }
-
-
- }
- if ( pid == null || pid == "" ) {
- // 상단 환자정보
- var node = getGlobalVariable("paminfo");
- model.removeNodeset("/root/init/paminfo/list");
- setCSVToNode("/root/init/paminfo", node);
- pid = model.getValue("/root/init/paminfo/list/pid");
- model.makeValue("/root/send/reqdata/pid", pid);
- hngnm = model.getValue("/root/init/paminfo/list/hngnm");
- model.makeValue("/root/send/reqdata/pnm", hngnm);
- ioflag = model.getValue("/root/init/paminfo/list/ioflag");
- if(ioflag == "I"||ioflag == "D"||ioflag == "E"){
- ioflag = "I";
- }
- else if(ioflag == "O"){
- ioflag = "O";
- }
- else{
- ioflag = "ALL";
- }
-
-
- if(ioflag == "I"){
- orddd = model.getValue("/root/init/paminfo/list/indd");
- } else {
- orddd = model.getValue("/root/init/paminfo/list/orddd");
- }
- cretno = model.getValue("/root/init/paminfo/list/cretno");
-
- // orddd = "20060428";
- // cretno = "800339501";
-
- if ( pid == null ) { pid == ""; }
- if ( hngnm == null ) { hngnm == ""; }
- if ( orddd == null ) { orddd == ""; }
- if ( cretno == null ) { cretno == ""; }
- if ( pid != "" && orddd !="" && cretno!="" && hngnm != "") {
-
- model.makeValue("/root/init/condition/pid", pid);
- model.makeValue("/root/init/condition/orddd", orddd);
- model.makeValue("/root/init/condition/cretno", cretno);
- model.setValue("/root/send/reqdata/ordtype", ioflag);
-
- fSearchOrdList();
- fChangeComboValue("new");
- } else {
- model.setFocus("input1")
- }
- }
- }
- /*
- * 구분 콤보 박스 선택
- *
- */
- function fValueChangedCombo(){
- model.makeValue("/root/send/workflag",combo1.value);
- }
- function fSearchPatNm(){
- if(model.getValue("/root/send/reqdata/pid")==""){
- return;
- }else{
- fGetPid("/root/send/reqdata/pid", "/root/send/reqdata/pnm");
- }
- input4.refresh();
- }
- function fSearchOrdList(){
- model.removeNodeset("/root/init/ordlists");
- combo1.refresh();
- fInitMain();
-
- // model.setValue("/root/send/reqdata/ordtype" ,"I");
- if(model.getValue("/root/send/reqdata/pnm")==""){
- return;
- }else{
- submit("TRMRJ00102");
- }
- fChangeComboValue("new");
- }
- /**
- * @desc : 환자등록번호 조회 팝업
- * @
- * @param : refPid - 환자번호 참고 node path
- * refPnm - 환자명 참고 node path
- * @return :
- * @authur : 이은영 2008.03.18
- * @---------------------------------------------------
- */
- function fGetPid(refPid, refPnm)
- {
- model.setValue("/root/send/reqdata/pnm","");
- input4.refresh();
- fInitMain();
- //조회건수가 1건일 경우 팝업창을 바로 닫는다.
- model.makeValue("/root/hidden/tmp/pidpopupinfo/checkfnexam", "1");
- model.makeValue("/root/hidden/tmp/pidpopupinfo/autoflag", "Y");
- model.makeValue("/root/hidden/tmp/pidpopupinfo/pid", model.getValue(refPid));
- if( model.getValue("/root/hidden/tmp/pidpopupinfo/srchcond") == '' ){
- model.makeValue("/root/hidden/tmp/pidpopupinfo/srchcond", '1');
- }
- modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/hidden/tmp/pidpopupinfo", "/root/send");
- model.resetInstanceNode("/root/source");
- //환자번호 copy
- var popupendflag = model.getValue("/root/main/popupendflag");
- if (popupendflag == "ok")
- {
- model.makeValue(refPid, model.getValue("/root/main/patinfo/patinfolist/pid"));
- if (refPnm == null) { refPnm = "" }
- if (refPnm != "") {
- model.makeValue(refPnm, model.getValue("/root/main/patinfo/patinfolist/hngnm"));
- }
- model.refresh();
- fSearchOrdList();
- }
- }
- /**
- * Count List 등록 내역 조회
- *
- */
- function fChangeComboValue(value){
- var i = 0;
- if(value == "open" && model.getValue("/root/init/condition/pid") !="" && model.getValue("/root/init/condition/orddd") != "" && model.getValue("/root/init/condition/cretno") != ""){
- for(i=1;i<=combo1.length; i++ ){
- if(model.getValue("/root/init/ordlists/ordlist["+i+"]/suminfo") == model.getValue("/root/init/condition/pid")+model.getValue("/root/init/condition/orddd")+model.getValue("/root/init/condition/cretno")){
- combo1.select(i-1);
- combo1.refresh();
- model.removenode("/root/init/condition/pid");
- model.removenode("/root/init/condition/orddd");
- model.removenode("/root/init/condition/cretno");
- model.makeValue("/root/init/condition/pid","");
- model.makeValue("/root/init/condition/orddd","");
- model.makeValue("/root/init/condition/cretno","");
- }
- }
- }else{
- if(value =="new"){
- combo1.select(0);
- }
- combo1.refresh();
- model.setValue("/root/send/pid" , model.getValue("/root/init/ordlists/ordlist["+(combo1.focusIndex+1)+"]/pid"));
- model.setValue("/root/send/orddd" , model.getValue("/root/init/ordlists/ordlist["+(combo1.focusIndex+1)+"]/orddd"));
- model.setValue("/root/send/cretno" ,model.getValue("/root/init/ordlists/ordlist["+(combo1.focusIndex+1)+"]/cretno"));
- }
- fSelectCodeList();
- fSetPinfo();
- }
- function fSelectCodeList(){
- // model.makeValue("/root/send/frcd" , model.getValue("/root/hidden/condition/kindcd"));
- // model.makeValue("/root/send/tocd" , model.getValue("/root/init/combolists/kindcombolists/kindcombo["+(combo2.selectedIndex+1)+"]/cd2"));
- if(submit("TRMRJ00101")){
- fColDisableChk(datagrid01);
- fColDisableChk(datagrid02);
- fColDisableChk(datagrid03);
- fColDisableChk(datagrid04);
- fColDisableChk(datagrid05);
- fColDisableChk(datagrid99);
- }
- }
- /**
- * 환자정보(원무키) 기본 세팅
- *
- */
- function fSetPinfo(){
- model.makeValue("/root/init/pinfo/pid" , model.getValue("/root/send/pid"));
- model.makeValue("/root/init/pinfo/orddd" , model.getValue("/root/send/orddd"));
- model.makeValue("/root/init/pinfo/cretno" , model.getValue("/root/send/cretno"));
- model.makeValue("/root/init/pinfo/workflag" , "99");
- }
- /**
- * 그리드 행추가 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fClickRowAddBtn(grid, vWorkflag){
-
- // grid.addRow();
- grid.insertRow(0, 'below');
- var cur_row = grid.row; // 추가된 행 번호 가져오기
- grid.valueMatrix(cur_row, 1) = getCurrentDate().substr(0, 8);
- grid.valueMatrix(cur_row, 2) = getCurrentTime().substr(0, 4);;
- grid.valueMatrix(cur_row, 8) = model.getValue("/root/init/pinfo/instcd");
- grid.valueMatrix(cur_row, 10) = model.getValue("/root/init/pinfo/pid");
- grid.valueMatrix(cur_row, 11) = model.getValue("/root/init/pinfo/orddd");
- grid.valueMatrix(cur_row, 12) = model.getValue("/root/init/pinfo/cretno");
- grid.valueMatrix(cur_row, 13) = vWorkflag;
- }
- /**
- * 삭제 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fClickDeleteBtn(grid, vWorkflag){
- var cur_row = grid.row; // 행 번호 가져오기
- var iStatus = grid.rowstatus(cur_row);
- if (getUserId()!=grid.valueMatrix(cur_row,14)&&grid.valueMatrix(cur_row,14)!=""){
- alert("삭제 권한은 등록한 사용자만 가능합니다...!");
- return;
- }
-
- if (grid.valueMatrix(cur_row,7)!="-"&&grid.valueMatrix(cur_row,14)!=""){
- alert("서식 기록에서 생성된 Care Plan 기록내용은 삭제 처리가 불가능 합니다...!");
- return;
- }
-
- if(cur_row <= 0 || cur_row =="undefined") {
- alert("삭제할 행을 선택하시기 바랍니다...");
- return;
- }
- if (iStatus == 1 || iStatus == 3){ // 새로 삽입된 행이면
- grid.deleteitem(cur_row);
- }else if (iStatus == 4){ // 삭제로 표시된 행이면
- grid.removestatus(cur_row, "delete");
- }else{
- grid.addStatus(cur_row, "delete");
- }
- }
- /*
- * 저장 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fOnClickSaveBtn(grid, vWorkflag){
- if(!checkGridUpdate(grid)){
- alert("저장할 자료가 존재하지 않습니다.");
- return;
- }
- var vTitle = "";
- model.refresh();
- if (vWorkflag=="01"){
- vTitle = "Treatment Plan";
- if(checkGridField(datagrid01,"2▦3")==false){
- alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
- return;
- }
- }
- if(vWorkflag=="02"){
- vTitle = "Discharge Plan";
- if(checkGridField(datagrid02,"2▦3")==false){
- alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
- return;
- }
- }
- if(vWorkflag=="03"){
- vTitle = "Nursing Care Plan";
- if(checkGridField(datagrid03,"2▦3")==false){
- alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
- return;
- }
- }
- if(vWorkflag=="04"){
- vTitle = "Nutrition Management Plan";
- if(checkGridField(datagrid04,"2▦3")==false){
- alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
- return;
- }
- }
- if(vWorkflag=="05"){
- vTitle = "Activity/Rehabilitation Plan";
- if(checkGridField(datagrid05,"2▦3")==false){
- alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
- return;
- }
- }
- if(vWorkflag=="99"){
- vTitle = "Medication Management Plan";
- if(checkGridField(datagrid99,"2▦3")==false){
- alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
- return;
- }
- }
- model.makeValue("/root/send/listdata",grid.getUpdateData());
- if ( submit("TXMRJ00101") ) {
- //datagrid1.clearStatus(); // submit() 성공하면 그리드의 i,u,d 상태 제거
- fSelectCodeList();
- }
- }
- /**
- * @group :
- * @ver : 2006.12.20
- * @by :
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc :
- * @return : bool
- * @---------------------------------------------------
- */
- function checkGridUpdate(grid)
- {
- var iData = grid.getUpdateDataXml("insert");
- var uData = grid.getUpdateDataXml("update");
- var dData = grid.getUpdateDataXml("delete");
- if (iData=="" && uData=="" && dData=="") return false;
- else return true;
- }
- /**
- * @group :
- * @ver : 2006.12.20
- * @by :
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc :
- * @return : bool
- * @---------------------------------------------------
- */
- function checkGridField(grid, field){
- var iStatus;
- //var iData = grid.getUpdateDataXml("insert");
- for (i=grid.fixedRows; i<grid.rows; i++){
- iStatus = grid.rowstatus(i);
- if (iStatus == 1 || iStatus == 3){
- var fieldArr = field.split("▦");
- if(fieldArr.length < 1){
- return false;
- }
- for(var j = 0; j < fieldArr.length; j++){
- if(fieldArr[j] == null || fieldArr[j] == "" || fieldArr[j] == "undefined"){
- continue;
- }
- if(grid.valueMatrix(i,fieldArr[j])=="") return false;
- }
- }
- }
- return true;
- }
- function fColDisableChk(grid){
- var rowSize = grid.rows
- for (i=1;i <rowSize; i++){
- if (getUserId()!= grid.valueMatrix(i,14)||grid.valueMatrix(i,7)!="-"){
- grid.cellAttribute("disabled", i, 1, i, 4) = "true";
- grid.cellstyle("background-color", i,1,i,4) = "#E6E6E6";
- }
- }
- }
- function fOpenPopok(vWorkflag){
- var vPid = model.getValue("/root/init/pinfo/pid");
- var vOrddd = model.getValue("/root/init/pinfo/orddd");
- var vCretno = model.getValue("/root/init/pinfo/cretno");
- var vordtype = model.getValue("/root/send/reqdata/ordtype");
- var vfromdd = model.getValue("/root/send/fromdd");
- var vtodd = model.getValue("/root/send/todd");
- var vdaycheck = model.getValue("/root/send/daycheck");
-
- if (vPid!="" && vOrddd!="" && vCretno!=""){
- setParameter("SPMRJ00100_pid", vPid);
- setParameter("SPMRJ00100_orddd", vOrddd);
- setParameter("SPMRJ00100_cretno", vCretno);
- setParameter("SPMRJ00100_workflag", vWorkflag);
- setParameter("SPMRJ00100_ordtype", vordtype);
- setParameter("SPMRJ00100_fromdd", vfromdd);
- setParameter("SPMRJ00100_todd", vtodd);
- setParameter("SPMRJ00100_daycheck", vdaycheck);
-
- modal("SPMRJ00101");
- fSelectCodeList();
- }else{
- messageBox("수진키 정보가 없습니다.","I003");
- }
- }
|