/** * consent */ var mplus_mobile_consent = function(){ mcare_mobile.call(this); var div = $("
"); var tr = $(""); var th = $(""); var td = $(""); var table = $("
"); var li = $("
  • "); var a = $(""); var span = $(""); var $ulPatientList = $('#ulPatientList'); var self = this; $serviceBaseUrl = contextPath + "/mobile"; $hospitalServiceBaseUrl = contextPath + "/mobile/hospital"; $consentServiceBaseUrl = contextPath + "/mobile/consent"; this.hospital = { //부서리스트 getDeptList : function(request){ var deptList = []; $.ajax ({ url : $hospitalServiceBaseUrl + '/getDeptList.json', type : 'POST', dataType: "json", contentType: "application/json", async: false, data: JSON.stringify(request), success: function(response){ deptList = response.result; } }); return deptList; }, //의사리스트 getDoctorList : function(request){ var doctorList = []; $.ajax ({ url : $hospitalServiceBaseUrl + '/getDoctorList.json', type : 'POST', dataType: "json", contentType: "application/json", async: false, data: JSON.stringify(request), success: function(response){ doctorList = response.result; } }); return doctorList; }, //병동리스트 getWardList : function(){ var wardList = []; $.ajax ({ url : $hospitalServiceBaseUrl + '/getWardList.json', type : 'POST', dataType: "json", contentType: "application/json", async: false, data: JSON.stringify({}), success: function(response){ wardList = response.result; } }); return wardList; }, // 환자정보조회 getPatientInfo : function(request){ var patientInfoList = []; $.ajax ({ url : $hospitalServiceBaseUrl + '/getPatientInfo.json', type : 'POST', dataType: "json", contentType: "application/json", async: false, data: JSON.stringify(request), success: function(response){ if( response.msg != undefined ) { self.alert(response.msg); return; } else { patientInfoList = response.result; } } }); return patientInfoList; } }; this.patient = { //환자리스트 조회 getPatientList : function(type, request, firstYn){ var requestUrl = getPatientListUrl(type); // url이 안넘어왔을 때 (type을 잘못입력) if (requestUrl == undefined) { alert('잘못된 요청입니다.'); return; }; patientList = []; $ulPatientList.empty(); $.ajax ({ url : requestUrl, type : 'POST', dataType: "json", contentType: "application/json", beforeSend: function(){ self.loading("show"); }, data: JSON.stringify(request) }).done(function(response){ self.loading("hide"); result = response.result patientList = result; if(firstYn!='Y'&&(result==undefined||result.length==0)) { self.loading("hide"); self.alert('조회된 데이터가 없습니다.'); return; }; self.patient.setPatientList(type, result, "", ""); }); }, setPatientList : function(type, list, sortKey, sortType, order){ patientList = []; $ulPatientList.empty(); result = sortKey==""? list: self.util.sortObj(list, sortKey, sortType, order); patientList = result; if(type=='I'){ for(var i=0; i 0 && consentItem.roomNo.length > 0) { consentItem.IO_roomNo = consentItem.ward + '/' + consentItem.roomNo; } else { consentItem.IO_roomNo = ""; } // 외래>소화기내과인 경우 시술의,수술의 설정. 2017/1/3 고객요구사항 if(patientInfo.iovisitType == 'O' && patientInfo.iodeptCd == '2010300000') { consentItem.IO_OPdr = patientInfo.iomaindrNm; } consent.push(consentItem); } return consent; }, // 앱으로 넘겨줄 동의서 리스트 파라메터 만들기 - 신규 기준 makeNewConsentParam: function(patientInfo, consentList, userName) { // 유효성 검사 추가하기 var consent = []; //ocrTagYn체크해서 넣어주기 for( var i = 0; i < consentList.length; i++ ) { var ocrtag = ""; //if(consentList[i].printOnly=="N"){ //전부 N일테니 조건따위 필요하지않아!!*/ ocrtag = this.getOcrTag().text; //} var consentItem = { newConsent : true, hospitalCretno: patientInfo.iocretNo, ward: patientInfo.ioward==null? "":patientInfo.ioward, roomNo: patientInfo.ioroomNo==null? "": patientInfo.ioroomNo, IO_ocr_cd: ocrtag, outDate: patientInfo.iodschdd==null?"":patientInfo.iodschdd, mainDrId: patientInfo.iomaindrId==null?"":patientInfo.iomaindrId, guid: consentList[i].formGuid, IO_formname: consentList[i].formName, IO_INPUTNM: userName, formCd: consentList[i].formCd, formRid: consentList[i].formRid, IO_Pt_ID: patientInfo.ioptID==null? "": patientInfo.ioptID, IO_sex_age_y_m: patientInfo.iosexAgeYM==null? "": patientInfo.iosexAgeYM, IO_Pt_name: patientInfo.ioptName==null? "": patientInfo.ioptName, IO_JuminNo: patientInfo.iojuminNo==null? "": patientInfo.iojuminNo, IO_PT_birthday: patientInfo.iojuminNo==null? "": patientInfo.iojuminNo.split('-')[0], IO_roomNo: patientInfo.ioroomNo==null? "": patientInfo.ioroomNo, IO_ADdate: patientInfo.ioaddate==null? "": moment(patientInfo.ioaddate).format('YYYY/MM/DD'), IO_Dept: patientInfo.iodeptNm==null? "": patientInfo.iodeptNm, IO_DeptCd: patientInfo.iodeptCd==null? "": patientInfo.iodeptCd, IO_OPdept: patientInfo.ioopdeptNm==null? "": patientInfo.ioopdeptNm, IO_OPdr: patientInfo.ioopdrNm==null? "": patientInfo.ioopdrNm, IO_Dx: patientInfo.iodxNm==null? "": patientInfo.iodxNm, IO_bp: patientInfo.iobp==null? "": patientInfo.iobp, IO_dm: patientInfo.iodm==null? "": patientInfo.iodm, IO_heart: patientInfo.ioheart==null? "": patientInfo.ioheart, IO_kidney: patientInfo.iokidney==null? "": patientInfo.iokidney, IO_respiration: patientInfo.iorespiration==null? "": patientInfo.iorespiration, IO_hx: patientInfo.iohx==null? "": patientInfo.iohx, IO_allergy: patientInfo.ioallergy==null? "": patientInfo.ioallergy, IO_drug: patientInfo.iodrug==null? "": patientInfo.iodrug, IO_smoking: patientInfo.iosmoking==null? "": patientInfo.iosmoking, IO_idio: patientInfo.ioidio==null? "": patientInfo.ioidio, IO_nacrotics: patientInfo.ionacrotics==null? "": patientInfo.ionacrotics, IO_airway: patientInfo.ioairway==null? "": patientInfo.ioairway, IO_hemorrhage: patientInfo.iohemorrhage==null? "": patientInfo.iohemorrhage, IO_status_etc: patientInfo.iostatusEtc==null? "": patientInfo.iostatusEtc } if(consentItem.ward.length > 0 && consentItem.roomNo.length > 0) { consentItem.IO_roomNo = consentItem.ward + '/' + consentItem.roomNo; } else { consentItem.IO_roomNo = ""; } // 외래>소화기내과인 경우 시술의,수술의 설정. 2017/1/3 고객요구사항 if(patientInfo.iovisitType == 'O' && patientInfo.iodeptCd == '2010300000') { consentItem.IO_OPdr = patientInfo.iomaindrNm; } consent.push(consentItem); } return consent; }, // 앱으로 넘겨줄 global 파라메터 만들기 makeGlobalParam: function(patientInfo, signDoctorId) { // 유효성 검사 추가하기 if(patientInfo == undefined) return; // 현재 일시 계산 var currentTime = new Date(); var timeText = dateTimeFormat(currentTime); var param = {userid : signDoctorId}; var result = this.getSignImage(param); var signImage = ''; if(result != undefined) { if(result.signImage != null && result.signImage != '') { signImage = result.signImage; } } var global = { IO_device: "M", visitType: patientInfo.iovisitType, IO_signdate: timeText, IO_signtime: timeText, IO_printtime: timeText, IO_maindr: patientInfo.iomaindrNm==null? "": patientInfo.iomaindrNm, IO_SIGNIMG: signImage } // 응급일 경우 ioerdrNm에 실제 주치의가 들어오기때문에 이걸로 변경해줌. if( patientInfo.ioerdrNm != null) { global.IO_maindr = patientInfo.ioerdrNm; } return global; }, // 의사 서명 이미지 정보 조회 getSignImage : function(request){ var signImage; $.ajax ({ url : $hospitalServiceBaseUrl + '/getSignImage.json', type : 'POST', dataType: "json", contentType: "application/json", async: false, data: JSON.stringify(request), success: function(response){ signImage = response.result; } }); return signImage; } }; // 환자리스트 URL 리턴 // 입원: I, 외래: O, 응급: E, 수술: OP, 검색: SR function getPatientListUrl(type) { switch (type) { case 'I' : return $serviceBaseUrl + '/in/getInPatList.json'; case 'O' : return $serviceBaseUrl + '/out/getOutPatList.json'; case 'E' : return $serviceBaseUrl + '/er/getErPatList.json'; case 'OP' : return $serviceBaseUrl + '/op/getOpPatList.json'; case 'SR' : return $serviceBaseUrl + '/search/getSrPatList.json'; default: return; } } function dateTimeFormat(date) { try{ var yyyy = date.getFullYear().toString(), mm = (date.getMonth()+1).toString(), dd = date.getDate().toString(), hh = date.getHours().toString(), mi = date.getMinutes().toString(), ss = date.getSeconds().toString(), text = yyyy + "-" + (mm[1]?mm:"0"+mm[0]) + "-" + (dd[1]?dd:"0"+dd[0]) + " " + (hh[1]?hh:"0"+hh[0]) + ":" + (mi[1]?mi:"0"+mi[0]) + ":" + (ss[1]?ss:"0"+ss[0]) ; return text; } catch(e) { self.log(e, "mcare_util_simpleDateFormat" ); } } }; //환자 나이정보 리턴 function editAgeToIdNum(idNum){ var sex = ''; var ageYm = ''; var age = ''; //성별과 나이 분리 if(idNum.indexOf('/')>0){ sex = idNum.split('/')[0]; ageYm = idNum.split('/')[1]; }else{ ageYm = idNum; }; //나이 가공 if(ageYm.indexOf('y')>0){ age = ageYm.split('y')[0]; }else if(ageYm.indexOf('m')>0||ageYm.indexOf('d')>0){ age = 0; }else{ age = ageYm; }; return sex + '/' + age; };