123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431 |
- /*
-
- 응급실 당직 전문의 (on-call) 스케줄관리(SMMNE05100.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", 'E');
-
- // 당직 기준 진료과 가져오기
- submit("TRMNE05401");
- }
- //당직대상자리스트를 조회한다
- function fGetWorkScheduleList(orddeptcd){
-
- var srchym = model.getValue("/root/cond/srchym");
- 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", 'E');
- model.makeValue('/root/send/orddeptcd', orddeptcd);
- model.makeValue('/root/send/monthcnt', getDayCountForMonth(srchym.substring(0, 4), srchym.substring(4, 6)));//조회년월의 마지막일
-
- if(submit("TRMNE05403")){
-
- //글로벌변수 초기화
- isEdited = 'N';
-
- //당직대상자의 선택제거
- grd_drlist.row = 0;
- //당직리스트의 선택제거
- grd_workerlist.row = 0;
-
- //당직리스트색깔 초기화
- for(var i = 1; i <= grd_workerlist.rows; i++){
- grd_workerlist.cellstyle("background-color", i, 0, i, 6) = '#ffffff';
- grd_workerlist.cellStyle("background-image", i, 0, i, 6) = '';
- }
- }
- }
- //그리드가 변경상태인지 조회한다.
- function isScheduleRefresh(isClose){
- var drStr;
- for(var i = 1; i < grd_workerlist.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', 'E');
-
- 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 curColor = grd_workerlist.cellstyle("background-color", clickRow, clickCol, clickRow, clickCol);
- grd_workerlist.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 rows = grd_workerlist.rows;
- var row = grd_workerlist.mouseRow-1;
- var col = grd_workerlist.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){
- //선택된 당직대상자정보(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');
-
- //현재날짜+시간(yyyymmddhhss)
- var currentDD = getCurrentDateTime().replace(" ", "").substring(0, 12);
-
- var errYn = 'N'; //과거일자 선택여부
- var cells = grd_workerlist.selectedCells; //선택된 쎌의 배열
- var sRow, sCol, sColNm; //선택된 쎌의 row, col 값, 선택된 col의 필드명
- var selectedDD; //선택된일자
-
- for(var i = 0; i < cells.length; i++){
- sRow = cells.item(i).row;
- sCol = cells.item(i).col;
- sColNm = grd_workerlist.colAttribute(sCol, "ref");
-
- selectedDD = model.getValue('/root/main/workerinfo/workerinfolist[' + sRow + ']/workdd');
-
- //현재일자보다 이전일자의 스케줄을 변경하지 못하게 blocking한다.
- // if(selectedDD < currentDD){
- // errYn = 'Y';
- // }else{
- if(sCol != 0){//일자셀 선택의 경우는 변경하지 않음
-
-
- //의사추가의경우
- if(setFlag == 'ADD'){
- //점검로직 추가
- if (fCheckValid(selectedDD, "E", "-", sColNm, drid)) {
- //선택된 쎌에 의사이름 쎄팅
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRow + ']/drnm', drnm);
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRow + ']/drid', drid);
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRow + ']/nzone', nzone);
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRow + ']/hpno', hpno);
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRow + ']/orddeptcd', orddeptcd);
-
- grd_workerlist.rowStatus(sRow) = "2";
-
- //선택된 쎌 색상 변경
- grd_workerlist.cellStyle('background-color', sRow, sCol) = "#F4A6EE";
- //지우개 이미지 삭제
- grd_workerlist.cellStyle("background-image", sRow, sCol) = '';
- }
- }
-
- //의사삭제의경우
- else{
-
- //셀에 데이터가 세팅되어 있는경우만 삭제되게
- var drnm = model.getValue('/root/main/workerinfo/workerinfolist['+ sRow + ']/' + sColNm);
- if(drnm != ''){
-
- //선택된 쎌에 의사이름 쎄팅
- //model.setValue('/root/main/workerinfo/workerinfolist['+ sRow + ']/' + sColNm, '');
- model.setValue('/root/main/workerinfo/workerinfolist['+ sRow + ']/drid' + sColNm.substring(4), '-');
-
- //선택된 쎌에 삭제 이미지 세팅
- //grd_workerlist.cellStyle("background-image", 1, 1) = '../../../emr/ercareweb/img/icon_close.gif';
- grd_workerlist.cellStyle("background-image", sRow, sCol) = '../../../com/commonweb/images/icon_eraser.gif';
- grd_workerlist.cellStyle("background-position", sRow, sCol) = 'center';
-
- //배경색을 흰색으로 초기화
- grd_workerlist.cellStyle('background-color', sRow, sCol) = "#ffffff";
-
- }
-
- // }
-
- }
- }
- }
-
- //과거일자만 빼고 나머지 일자는 변경가능하도록 한다
- if(errYn == 'Y'){
- messageBox('과거일자의 스케줄은 변경하실 수 없습니다.', 'E999');
- return false;
- }
-
- }
- function fSaveWorkDr(){
- model.removeNodeset("/root/send");
-
- var orddeptcd = model.getValue("/root/main/workerinfo/workerinfolist[1]/orddeptcd");
- var srchym = model.getValue("/root/cond/srchym");
- var gbn = 'E';
-
- sHeader = "gbn▦workdd▦duty▦drid▦orddeptcd▩";
- sData = "";
-
- for(i = grd_workerlist.fixedRows; i < grd_workerlist.rows; i++) {
- //if(grd_workerlist.rowStatus(i) == "2") {
- sData += "E▦"
- + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("workdd")) + "▦"
- + "A▦"
- + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("drid")) + "▦"
- + grd_workerlist.ValueMatrix(i, grd_workerlist.colRef("orddeptcd")) + "▩"
- //}
- }
-
- model.makeValue("/root/send/workerlist", sHeader + sData);
-
- model.makeValue("/root/send/saveinfo/orddeptcd", orddeptcd);
- model.makeValue("/root/send/saveinfo/srchym", srchym);
- model.makeValue("/root/send/saveinfo/gbn", gbn);
- model.makeValue("/root/send/saveinfo/monthcnt", getDayCountForMonth(srchym.substring(0, 4), srchym.substring(4, 6)));//조회년월의 마지막일
-
- if(submit("TXMNE05401")){
- //당직리스트색깔 초기화
- for(var i = 1; i <= grd_workerlist.rows; i++){
- grd_workerlist.cellstyle("background-color", i, 0, i, 6) = '#ffffff';
- grd_workerlist.cellStyle("background-image", i, 0, i, 6) = '';
- }
-
- //fGetWorkScheduleList(orddeptcd);//당직자리스트를 조회한다
- }
- }
- function fDelWorkDr(workdd, orddeptcd) {
-
- model.makeValue("/root/send/deldata/workdd", workdd);
- model.makeValue("/root/send/deldata/orddeptcd", orddeptcd);
- model.makeValue("/root/send/deldata/gbn", "E");
- model.makeValue("/root/send/deldata/duty", "A");
-
- if(submit("TXMNE05402")){
- fGetWorkScheduleList(orddeptcd);//당직자리스트를 조회한다
- }
- }
- 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", 'Y');
- model.makeValue("/root/send/basicinfo/duty", 'A');
- model.makeValue("/root/send/basicinfo/cdgrupid", 'P15');
- 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;
- }
|