123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606 |
- /*
-
- 권역외상센터 당직 전문의 스케줄 관리(SMMNE05700.xfm - JScript )
- - Version :
- 1) : Ver.1.00.01
- - Create : 2012.08.01
- */
- //당직스케줄 그리드의 수정상태값
- var isEdited = 'N';
- //화면초기화
- function fInit(){
-
- /*var instcd = getUserInfo("dutplceinstcd");
- if (instcd == "031") {
- caption3.value = "* 위 당직 전문의는 환자 및 보호자의 요청이 아닌 응급실 근무의사의 의학적 판단에 따른 요청으로 직접진료 여부가 결정됩니다.";
- } else {
- caption3.value = "* 칠곡경북대학교병원은 특정질환 전문병원으로서 응급실에 내원하는 환자분의 증상(진단) 또는 병원의 의료인력과 시설에 따라 필요시 진료가 가능한 상급의료기관으로 전원할 수 있음을 양해해 주시기 바랍니다.";
- }*/
-
- var curym = getCurrentDate().substring(0, 6);
- var worktitle = curym.substring(0, 4) + '년 ' + curym.substring(4, 6) + '월 전문의 당직리스트 (권역외상센터)';
- cpt_worktitle.text = worktitle;
- model.makeValue("/root/cond/srchym", curym);
- model.refresh();
-
- model.removenode("/root/send");
- model.makeValue("/root/send/srchym", curym);
- model.makeValue("/root/send/gbn", model.getValue("/root/cond/gbn"));
-
- // 당직 기준 진료과 가져오기
- submit("TRMNE05401");
- // var gbn = model.getValue("/root/cond/gbn");
- // if (gbn == "O") {
- // grd_workerlistDN.visible = false;
- // grd_workerlistOC.visible = true;
- // } else {
- // grd_workerlistDN.visible = true;
- // grd_workerlistOC.visible = false;
- // }
- grd_workerlistDN.visible = true;
- grd_workerlistOC.visible = false;
-
- // 외상당직 superuser 여부
- model.makeValue("/root/send/userid", getUserInfo("userid"));
- model.makeValue("/root/send/dutplcecd", getUserInfo("dutplcecd"));
- model.makeValue("/root/send/workdd", getCurrentDate());
- submit("TRMNE05805");
-
- //model.setValue("/root/main/userinfo/superuser", "Y");
-
- var sSuperUser = model.getValue("/root/main/userinfo/superuser");
- if (sSuperUser == "Y") {
- btn_cnfm.disabled = false;
- } else {
- btn_cnfm.disabled = true;
- }
- }
- //당직대상자리스트를 조회한다
- function fGetWorkScheduleList(orddeptcd, callopt){
-
- var srchym = model.getValue("/root/cond/srchym");
- var gbn = model.getValue("/root/cond/gbn");
-
- var worktitle = srchym.substring(0, 4) + '년 ' + srchym.substring(4, 6) + '월 전문의 당직리스트 (권역외상센터)';
- cpt_worktitle.text = worktitle;
- cpt_worktitle.refresh();
- if(orddeptcd == null || orddeptcd == ''){
- orddept = cmb_orddeptcd.value;
- }
-
- model.removenode("/root/send");
- model.makeValue("/root/send/srchym", srchym);
- model.makeValue("/root/send/gbn", gbn);
- model.makeValue("/root/send/orddeptcd", orddeptcd);
- model.makeValue("/root/send/monthcnt", getDayCountForMonth(srchym.substring(0, 4), srchym.substring(4, 6)));//조회년월의 마지막일
-
- var rslt = "";
-
- // if (gbn == "O") {
- // rslt = submit("TRMNE05403");
- // grd_temp = grd_workerlistOC;
- // } else {
- // rslt = submit("TRMNE05701");
- // grd_temp = grd_workerlistDN;
- // }
- rslt = submit("TRMNE05702");
- grd_temp = grd_workerlistDN;
-
- if( rslt ){
- //글로벌변수 초기화
- isEdited = 'N';
- //당직대상자의 선택제거
- if(callopt != "save") {
- grd_drlist.row = 0;
- }
-
- //당직리스트의 선택제거
- grd_temp.row = 0;
-
- //당직리스트색깔 초기화
- for(var i = 2; i <= grd_temp.rows; i++){
- grd_temp.cellstyle("background-color", i, 0, i, 6) = '#ffffff';
- grd_temp.cellStyle("background-image", i, 0, i, 6) = '';
- }
- }
- }
- //그리드가 변경상태인지 조회한다.
- function isScheduleRefresh(isClose){
- var gbn = model.getValue("/root/cond/gbn");
- // if (gbn == "O") {
- // grd_temp = grd_workerlistOC;
- // } else {
- // grd_temp = grd_workerlistDN;
- // }
- grd_temp = grd_workerlistDN;
-
- var drStr;
- for(var i = 1 ; i < grd_temp.rows; i++){
- if(instance1.selectSingleNode("/root/orgscheinfo/workinfo/workerinfolist[" + i + "]") != null){
- if(instance1.selectSingleNode("/root/orgscheinfo/workinfo/workerinfolist[" + i + "]").xml
- != instance1.selectSingleNode("/root/main/workerinfo/workerinfolist[" + i + "]").xml){
- isEdited = 'Y';
- drStr += model.getValue('/root/main/workerinfo/workerinfolist[' + i + ']/workdd') + '일자 변경';
- break;
- }
- }
- }
- if(isEdited == 'Y'){
- //20090703 dhkim 창을 닫을때와 새로 조회할때의 메세지를 다르게 구성 Q003(계속진행하시겠습니까?)
- if(isClose){
- var saveYn = messageBox('수정하신 스케줄을 저장하지 않고 창을 닫으시겠습니까?', 'Q');//Q: 6:예, 7:아니오.
- } else{
- var saveYn = messageBox('수정하신 스케줄을 저장하지 않고 새로운 내역을', 'Q005');//Q005:조회하시겠습니까? 6:예, 7:아니오.
- }
- if(saveYn == 6){
- return 'Y';
- } else{
- return 'N';
- }
- }
- }
- function fGetDrInfo(orddeptcd) {
- if(orddeptcd == null || orddeptcd == ""){
- messageBox("선택된 진료과가 없습니다.", "E999");
- }
-
- model.removenode('/root/send');
- model.makeValue('/root/send/drinfo/orddeptcd', orddeptcd);
- model.makeValue('/root/send/drinfo/srchym', model.getValue('/root/cond/srchym'));
- model.makeValue('/root/send/drinfo/gbn', model.getValue('/root/cond/gbn'));
-
- if(!submit("TRMNE05402")){
- messageBox("진료과별 당직대상자 조회를 실패하였습니다.", "E999");
- return false;
- }
- }
- /**
- * @desc : 이전 년버튼 클릭시 - 전년도+월로 세팅
- * @
- * @param :
- * @return :
- * @author : dhkim 20090610
- * @---------------------------------------------------
- */
- function fClkBfYear(srchym){
-
- var yyear = srchym.substring(0, 4);
- var mmont = srchym.substring(4, 6);
-
- yyear--;
-
- srchym = yyear + mmont;
-
- model.setValue('/root/cond/srchym', srchym);
- model.refresh();
- }
- /**
- * @desc : 다음 년버튼 클릭시 - 다음년도+월로 세팅
- * @
- * @param :
- * @return :
- * @author : dhkim 20090610
- * @---------------------------------------------------
- */
- function fClkAfYear(srchym){
-
- var yyear = srchym.substring(0, 4);
- var mmont = srchym.substring(4, 6);
-
- yyear++;
-
- srchym = yyear + mmont;
-
- model.setValue('/root/cond/srchym', srchym);
- model.refresh();
- }
- /**
- * @desc : 이전 달버튼 클릭시 - 년도+전월 세팅
- * @
- * @param :
- * @return :
- * @author : dhkim 20090610
- * @---------------------------------------------------
- */
- function fClkBfMonth(srchym){
- var yyear = srchym.substring(0, 4);
- var mmont = srchym.substring(4, 6);
-
- mmont = mmont.toDate('MM').getAddDate(-1, "M").getDateFormat('MM');
- if(mmont == '12'){
- yyear--;
- }
- srchym = yyear + mmont;
-
- model.setValue('/root/cond/srchym', srchym);
- model.refresh();
- }
- /**
- * @desc : 다음 달버튼 클릭시 - 년도+다음월 세팅
- * @
- * @param :
- * @return :
- * @author : dhkim 20090610
- * @---------------------------------------------------
- */
- function fClkAfMonth(srchym){
- var yyear = srchym.substring(0, 4);
- var mmont = srchym.substring(4, 6);
- mmont = mmont.toDate('MM').getAddDate(+1, "M").getDateFormat('MM');
- if(mmont == '01'){
- yyear++;
- }
- srchym = yyear + mmont;
-
- model.setValue('/root/cond/srchym', srchym);
- model.refresh();
- }
- //셀색상을 선택색으로 변경되지 않도록 원래색상으로 유지한다
- function fSetCellColor(clickRow, clickCol, clickColNm){
-
- // var gbn = model.getValue("/root/cond/gbn");
- // if ( gbn == "O" ) {
- // grd_temp = grd_workerlistOC;
- // } else {
- // grd_temp = grd_workerlistDN;
- // }
- grd_temp = grd_workerlistDN;
-
- var curColor = grd_temp.cellstyle("background-color", clickRow, clickCol, clickRow, clickCol);
- grd_temp.cellstyle("background-color", clickRow, clickCol, clickRow, clickCol) = curColor;
-
- }
- /**
- * @group :
- * @ver : 2009.06.11
- * @by : dhkim
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 당직대상자 마우스 오른쪽메뉴 mouse down
- * @param :
- * @return :
- * @---------------------------------------------------
- */
- function fMouseDownGridRow(){
-
- // var gbn = model.getValue("/root/cond/gbn");
- // if ( gbn == "O" ) {
- // grd_temp = grd_workerlistOC;
- // } else {
- // grd_temp = grd_workerlistDN;
- // }
- grd_temp = grd_workerlistDN;
-
- var rows = grd_temp.rows;
- var row = grd_temp.mouseRow-1;
- var col = grd_temp.mouseCol;
- if(row + 1 <= rows && rows > 2 && row > 0){
- if(event.button == 3){
- window.setPopupMenu(true, "/root/init/menu/item", "name", "func", false);
- }
- }else{
- window.setPopupMenu(false);
- }
- }
- function fSetWorkDr(setFlag, grd_temp){
- //선택된 당직대상자정보(id, nm)
- var drid = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/drid');
- var drnm = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/drnm');
- var orddeptcd = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/orddeptcd');
- var nzone = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/nzone');
- var hpno = model.getValue('/root/main/drinfo/drinfolist[' + grd_drlist.row + ']/hpno');
- var gbn = model.getValue('/root/cond/gbn');
-
- //현재날짜+시간(yyyymmddhhss)
- var currentDD = getCurrentDateTime().replace(" ", "").substring(0, 12);
-
- var errYn = 'N'; //과거일자 선택여부
- var cells = grd_temp.selectedCells; //선택된 쎌의 배열
- var sRow, sCol, sColNm; //선택된 쎌의 row, col 값, 선택된 col의 필드명
- var selDD; //선택된일자
- var confirm_d = "", confirm_n = "";
- var sSuperUser = model.getValue("/root/main/userinfo/superuser");
-
- for(var i = 0; i < cells.length; i++){
- sRowI = cells.item(i).row - 1;
- sRow = cells.item(i).row;
- sCol = cells.item(i).col;
- sColNm = grd_temp.colAttribute(sCol, "ref");
-
- selDD = model.getValue('/root/main/workerinfo/workerinfolist[' + sRowI + ']/workdd');
- confirm_d = model.getValue('/root/main/workerinfo/workerinfolist[' + sRowI + ']/confirm_d');
- confirm_n = model.getValue('/root/main/workerinfo/workerinfolist[' + sRowI + ']/confirm_n');
-
- if (((sColNm == "drnm_d" && confirm_d == "Y") || (sColNm == "drnm_n" && confirm_n == "Y")) && sSuperUser != "Y") {
- messageBox('최종저장된 자료는 수정할 수 없습니다.\r\n권역외상센터 담당자에게 연락바랍니다.', 'E999');
- return false;
- }
-
- //현재일자보다 이전일자의 스케줄을 변경하지 못하게 blocking한다.
- // if(selectedDD < currentDD){
- // errYn = 'Y';
- // }else{
- if(sCol != 0){//일자셀 선택의 경우는 변경하지 않음
-
-
- //의사추가의경우
- if(setFlag == 'ADD'){
- //점검로직 추가
- if (fCheckValid(selDD, "T", "-", sColNm, drid)) {
- //선택된 쎌에 의사이름 쎄팅
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/gbn', gbn);
- if (sColNm == "drnm_d") {
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drnm_d', drnm);
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drid_d', drid);
- } else if (sColNm == "drnm_n") {
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drnm_n', drnm);
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drid_n', drid);
- }
-
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/orddeptcd', orddeptcd);
-
- grd_temp.rowStatus(sRow) = "2";
-
- //선택된 쎌 색상 변경
- grd_temp.cellStyle('background-color', sRow, sCol) = "#F4A6EE";
- //지우개 이미지 삭제
- grd_temp.cellStyle("background-image", sRow, sCol) = '';
- }
- }
-
- //의사삭제의경우
- else{
-
- //셀에 데이터가 세팅되어 있는경우만 삭제되게
- var drnm = model.getValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/' + sColNm);
- if(drnm != ''){
-
- //선택된 쎌에 의사이름 쎄팅
- //model.setValue('/root/main/workerinfo/workerinfolist['+ sRow + ']/' + sColNm, '');
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRowI + ']/drid' + sColNm.substring(4), '-');
-
- //선택된 쎌에 삭제 이미지 세팅
- //grd_workerlist.cellStyle("background-image", 1, 1) = '../../../emr/ercareweb/img/icon_close.gif';
- grd_temp.cellStyle("background-image", sRow, sCol) = '../../../com/commonweb/images/icon_eraser.gif';
- grd_temp.cellStyle("background-position", sRow, sCol) = 'center';
-
- //배경색을 흰색으로 초기화
- grd_temp.cellStyle('background-color', sRow, sCol) = "#ffffff";
-
- }
-
- // }
-
- }
- }
- }
-
- //과거일자만 빼고 나머지 일자는 변경가능하도록 한다
- if(errYn == 'Y'){
- messageBox('과거일자의 스케줄은 변경하실 수 없습니다.', 'E999');
- return false;
- }
-
- }
- function fSaveWorkDr(param){
-
- model.removeNodeset("/root/send");
-
- var orddeptcd = model.getValue("/root/main/workerinfo/workerinfolist[1]/orddeptcd");
- var drid = "";
- var gbn = model.getValue("/root/cond/gbn");
- var duty = "";
- var confirmyn = "N";
-
-
- // if (gbn == "O") {
- // grd_temp = grd_workerlistOC;
- // } else {
- // grd_temp = grd_workerlistDN;
- // }
- grd_temp = grd_workerlistDN;
-
- sHeader = "gbn▦workdd▦duty▦drid▦orddeptcd▦confirmyn▩";
- sData = "";
-
- for(i = grd_temp.fixedRows; i < grd_temp.rows; i++) {
- // if (gbn == "O") {
- // duty = 'A';
- // drid = grd_temp.ValueMatrix(i, grd_temp.colRef("drid"));
- // } else {
- // duty = 'D';
- // drid = grd_temp.ValueMatrix(i, grd_temp.colRef("drid_d"));
- // }
- duty = 'D';
- drid = grd_temp.ValueMatrix(i, grd_temp.colRef("drid_d"));
- if (drid == null || drid == "") {
- drid = '-';
- }
-
- if (param == "cnfm") {
- confirmyn = "Y";
- } else {
- confirmyn = grd_temp.ValueMatrix(i, grd_temp.colRef("confirm_d"));
- }
-
- sData += grd_temp.ValueMatrix(i, grd_temp.colRef("gbn")) + "▦"
- + grd_temp.ValueMatrix(i, grd_temp.colRef("workdd")) + "▦"
- + duty + "▦"
- + drid + "▦"
- + grd_temp.ValueMatrix(i, grd_temp.colRef("orddeptcd")) + "▦"
- + confirmyn + "▩" ;
- }
-
- confirmyn = "N";
- //if (gbn != "O") { // OnCall 스케줄일 때는 제외
- for(i = grd_temp.fixedRows; i < grd_temp.rows; i++) {
- duty = 'N';
- drid = grd_temp.ValueMatrix(i, grd_temp.colRef("drid_n"));
- if (drid == null || drid == "") {
- drid = '-';
- }
-
- if (param == "cnfm") {
- confirmyn = "Y";
- } else {
- confirmyn = grd_temp.ValueMatrix(i, grd_temp.colRef("confirm_n"));
- }
-
- sData += grd_temp.ValueMatrix(i, grd_temp.colRef("gbn")) + "▦"
- + grd_temp.ValueMatrix(i, grd_temp.colRef("workdd")) + "▦"
- + duty + "▦"
- + drid + "▦"
- + grd_temp.ValueMatrix(i, grd_temp.colRef("orddeptcd"))+ "▦"
- + confirmyn + "▩" ;
- }
- //}
-
- model.makeValue("/root/send/workerlist", sHeader + sData);
-
- if(submit("TXMNE05401")){
- //당직리스트색깔 초기화
- for(var i = 2; i <= grd_temp.rows; i++){
- grd_temp.cellstyle("background-color", i, 0, i, 6) = '#ffffff';
- grd_temp.cellStyle("background-image", i, 0, i, 6) = '';
- }
-
- //fGetWorkScheduleList(orddeptcd);//당직자리스트를 조회한다
- btn_search.dispatch('DOMActivate');
- }
- }
- function fDelWorkDr(workdd, orddeptcd, duty) {
-
- model.makeValue("/root/send/deldata/workdd", workdd);
- model.makeValue("/root/send/deldata/orddeptcd", orddeptcd);
- model.makeValue("/root/send/deldata/gbn", model.getValue("/root/cond/gbn"));
- model.makeValue("/root/send/deldata/duty", duty);
-
- if(submit("TXMNE05402")){
- btn_search.dispatch('DOMActivate');
- }
- }
- function fCheckValid(selDD, selGbn, selPlc, sColNm, drid) {
-
- // 시작/종료일시 기준자료 조회
- model.removenodeset("/root/send/basicinfo");
- model.makeValue("/root/send/basicinfo/workdd", selDD);
- model.makeValue("/root/send/basicinfo/hugbn", 'N');
- model.makeValue("/root/send/basicinfo/cdgrupid", 'P16');
- if (sColNm == "drnm_d") {
- model.makeValue("/root/send/basicinfo/duty", 'D');
- } else {
- model.makeValue("/root/send/basicinfo/duty", 'N');
- }
-
- submit("TRMNE05404");
-
- var fromtm = model.getValue("/root/init/basicinfo/stime");
- var totm = model.getValue("/root/init/basicinfo/etime");
-
- // 휴진내역이 있는지 점검
- var selDuty = sColNm.substr(5, 1).toUpperCase();
- var fromdt, todt;
-
- model.removenodeset("/root/send/validinfo");
- model.makeValue("/root/send/validinfo/workdd", selDD);
- model.makeValue("/root/send/validinfo/gbn", selGbn);
- model.makeValue("/root/send/validinfo/placecd", selPlc);
- model.makeValue("/root/send/validinfo/duty", selDuty);
- model.makeValue("/root/send/validinfo/drid", drid);
-
- model.makeValue("/root/send/validinfo/fromtm", fromtm);
- model.makeValue("/root/send/validinfo/totm", totm);
-
- submit("TRMNE09002");
-
- var sValidYn = model.getValue("/root/temp/validinfo/validyn");
- var sScheYn = model.getValue("/root/temp/validinfo/scheyn");
- var sHoliYn = model.getValue("/root/temp/validinfo/holiyn");
-
- if (sValidYn == "N") {
- if (sScheYn == "Y" && sHoliYn == "N") {
- messageBox("같은 일자에 등록된 당직 정보가 있습니다.", "E999");
- }
-
- if (sScheYn == "N" && sHoliYn == "Y") {
- messageBox("해당 일자에 등록된 휴진 정보가 있습니다.", "E999");
- }
-
- if (sScheYn == "Y" && sHoliYn == "Y") {
- messageBox("같은 일자에 등록된 당직정보와 해당 일자에 등록된 휴진 정보가 있습니다.", "E999");
- }
-
- return false;
- }
-
- return true;
- }
- /**
- * @group :
- * @ver : 2016.08.30
- * @by : 엄영만
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc : 근무정보 설정
- * @param : sActGubun 처리구분(I:입력, D:삭제)
- * @param : sGbn 당직구분(M0762)
- * @param : sWorkDd 근무일자
- * @param : sDuty 근무타입(D:주간, N:야간)
- * @param : sDeptcd 근무의사 부서
- * @param : sDrid 근무의사 사번
- * @return :
- * @---------------------------------------------------
- */
- function fSetWorkInfo(sActGubun, sGbn, sWorkDd, sDuty, sOrdDeptcd, sDrid, sConfirmYn) {
-
- model.removenode("/root/send");
- model.makeValue("/root/send/actgubun", sActGubun);
- model.makeValue("/root/send/gbn", sGbn);
- model.makeValue("/root/send/workdd", sWorkDd);
- model.makeValue("/root/send/duty", sDuty);
- model.makeValue("/root/send/orddeptcd", sOrdDeptcd);
- model.makeValue("/root/send/drid", sDrid);
- model.makeValue("/root/send/fromtm", sWorkDd);
- model.makeValue("/root/send/totm", sWorkDd);
- model.makeValue("/root/send/confirmyn", sConfirmYn);
-
- if(submit("TXMNE05403")){
- fGetWorkScheduleList(sOrdDeptcd, "save");
- } else {
- messageBox("당직의 저장에 실패 하였습니다..", "E999");
- }
- }
|