/**
* mplus_common
*/
var mplus_common = function(){
mplus_mobile.call(this);
var self = this;
// ajax 설정
$.ajaxSetup({
timeout: 30000,
error: function(XHR, textStatus, errorThrown ) { //XMLHttpRequest, textStatus(timeout, error, notmodified, parseerror...), errorThrown
//==== old code : 삭제 예정 { ====
//function(x, t, m) { //XMLHttpRequest, textStatus(timeout, error, notmodified, parseerror...), errorThrown
//if(t==="timeout") {
// self.alert(self.getI18n("error500"));
// self.loading("hide");
//} else {
// self.loading("hide");
// self.alert(t);
//}
//==== old code : 삭제 예정 } ====
self.loading( "hide");
if( XHR.status == 0){
self.alert( "You are offline!!
Please Check Your Network.");
}else if( XHR.status == 404){
self.alert("Requested URL not found.
[HTTP 404 ERROR]");
}else if( XHR.status == 409){
self.alertDuplicationLogin( "다른 기기에서 같은 ID로 로그인 했습니다.");
}else if( XHR.status == 500){
self.alert( "Internel Server Error.
[HTTP 500 ERROR]");
}else if( textStatus == "parsererror"){
self.alert( "Error. Parsing JSON Request failed.");
}else if(textStatus == "timeout"){
self.alert( "Request Time out.");
}else {
self.alert( "Unknow Error. " + XHR.responseText);
}
console.log( "code:" + XHR.status + "\n" + "message:" + XHR.responseText + "\n"+"error:" + errorThrown);
},
dataFilter: function(result){
if(result!=""){
resultJson = JSON.parse(result);
if(resultJson.msg==self.getI18n("unauthenticated")){
self.common.initLocalStorage();
location.href = contextPath + "/logout.page";
return null;
};
};
return result;
}
});
$serviceBaseUrl = contextPath + "/mobile";
this.init = function(){
addEvent();
movePageEvent();
};
var addEvent = function(){
//로그아웃
$("#btnLogout").on("click", function(){
logout();
});
//로그아웃2
// $("#btnLogout2").on("click", function(){
// logout();
// });
};
//화면이동 공통이벤트
var movePageEvent = function(){
// //설정창 오픈
// $('#btnMoveSetting').on('click', function(){
// /*location.href = contextPath + '/mobile/setting/setting.page';*/
// var deptList = JSON.parse(localStorage.user).departmentList;
// var div = $('
');
// $('#settingDeptList').empty();
// for(var i=0; i').clone().attr('name', 'settingDeptRadio').attr('type', 'radio').attr('id', 'settingDeptRadio'+i).attr('value', deptList[i].departmentCd).attr('deptName', deptList[i].departmentNm)
// ).append(
// $('').clone().attr('for', 'settingDeptRadio'+i).text(deptList[i].departmentNm)
// );
// $('#settingDeptList').append(radioOption);
// };
//
// $('#settingModal').modal("show");
// $('input:radio[name=settingDeptRadio]:input[value=' + localStorage.selectedDeptCd + ']').attr("checked", true);
//
// $('#settingModal .modal-body #settingDeptList').css({'max-height': $(window).height()-180,
// 'overflow-y': 'auto'});
//
// $('#settingModal').modal('show');
// });
// //진료과 설정 저장
// $('#btnSaveSettingModal').unbind();
// $('#btnSaveSettingModal').on('click', function(){
// if(localStorage.getItem('selectedDeptCd')!= $('input[name=settingDeptRadio]:checked').val()){
// localStorage.setItem('selectedDeptCd', $('[name=settingDeptRadio]:checked').val());
// localStorage.setItem('selectedDeptNm', $('[name=settingDeptRadio]:checked')[0].attributes.deptName.value);
// $('#panelUserDept').text($('[name=settingDeptRadio]:checked')[0].attributes.deptName.value);
// $('.slt-my-department').val($('[name=settingDeptRadio]:checked').val());
// if($('.slt-my-department').val()==null) $('.slt-my-department').val($(".slt-my-department option:first").val());
// $('.slt-my-department').trigger('change');
// };
//
// $('#settingModal').modal('hide');
//
// });
//
// //환자상세정보화면이동
// $('[name=btnMoveDetail]').on('click', function(){
// /*location.href = contextPath + '/mobile/patient/clinicInfo.page?page=info';*/
// $('#patientPopup .popup-content:not(#popContentConsultDetail).in').removeClass('in');
// $('#patientPopup #popContentPatientInfo').addClass('in');
// $('#newPopupFooter2').css('display', 'block');
// $('#patientPopup').css({'height': '-webkit-calc(100% - 40px)',
// 'height': '-moz-calc(100% - 40px)',
// 'height': 'calc(100% - 40px)',
// 'bottom': '0px',
// 'display': 'block'});
// var mplusPatient = new mplus_mobile_patient();
// mplusPatient.detailInit();
// });
// //처방화면이동
// $('[name=btnMovePrescription]').on('click', function(){
// /*location.href = contextPath + '/mobile/patient/clinicInfo.page?page=prescription';*/
// $('#patientPopup .popup-content:not(#popContentConsultDetail).in').removeClass('in');
// $('#patientPopup #popContentPrescription').addClass('in');
// $('#newPopupFooter2').css('display', 'block');
// $('#patientPopup').css({'height': '-webkit-calc(100% - 40px)',
// 'height': '-moz-calc(100% - 40px)',
// 'height': 'calc(100% - 40px)',
// 'bottom': '0px',
// 'display': 'block'});
// var mplusPatient = new mplus_mobile_patient();
// mplusPatient.prescriptionInit();
// });
//
// //검사화면이동
// $('[name=btnMoveExamine]').on('click', function(){
// $('#patientPopup .popup-content:not(#popContentConsultDetail).in').removeClass('in');
// $('#patientPopup #popContentExamine').addClass('in');
// $('#newPopupFooter2').css('display', 'block');
// $('#patientPopup').css({'height': '-webkit-calc(100% - 40px)',
// 'height': '-moz-calc(100% - 40px)',
// 'height': 'calc(100% - 40px)',
// 'bottom': '0px',
// 'display': 'block'});
// var mplusPatient = new mplus_mobile_patient();
// mplusPatient.examineInit();
// });
};
var logout = function(){
self.confirm("로그아웃 하시겠습니까?", function(callback){
if(callback){
//자동로그인 기능 제거
localStorage.setItem("defaultisAuto", "");
self.common.initLocalStorage();
location.href = contextPath + "/logout.page";
console.log("contextPath -- > " + contextPath);
};
});
};
this.dateCalc = function(fromDate, toDate){
var fromArray = fromDate.split("-");
var toArray = toDate.split("-");
var calFromDate = new Date(fromArray[0], Number(fromArray[1])-1, fromArray[2]);
var calToDate = new Date(toArray[0], Number(toArray[1])-1, toArray[2]);
var betweenDate = (calToDate.getTime() - calFromDate.getTime())/1000/60/60/24;
return betweenDate;
};
this.rotateScreen = function(orientation){
var jsonmsg = {
"type" : "command",
"functionType" : "rotateScreen",
"value" : {
"orientation" : orientation,
"callbackFn":"window.activeObj.init"
}
};
self.toNative(jsonmsg);
};
/* APP배포 --------------------------------------------------------------------- */
this.deployment = {
//다운로드 이력 로그 전송
inputDownloadLog : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/deployment/inputDownloadLog.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
}
};
// 20190405 iOS 캡쳐 방지 로그 전송
this.inputLoginLog = function(){
//디바이스 정보 호출 후 로그 등록
var msg = {
type : "command",
functionType : "getDeviceInfo",
value : {
callbackFn : "window.activeObj.getDeviceInfoCallBack2"
}
};
self.toNative( msg );
};
// 디바이스 정보 전송 추출 callback 처리
this.getDeviceInfoCallBack2 = function(returnCode){
var results = new Object();
if( typeof returnCode === "string" ){
results = self.util.parseJson( returnCode );
} else {
results = returnCode;
}
if( results.success != undefined && results.success == "true" ) {
console.log("getDeviceInfo : success");
console.log( results.result);
gDeviceId = results.result.deviceId;
gAppKind = results.result.appKind;
gAppVersion = results.result.appVersion;
gPhoneKind = results.result.phoneKind;
} else {
console.log("getDeviceInfo : failed");
self.alert( "getDeviceInfo() APP function 호출 오류 " );
}
// 20190125 shinsunwoo device id 추출을 실패한 경우 uuid() 스크립트 값을 적용
if( gDeviceId == "NONE")
gDeviceId = uuid();
console.log("캡쳐로그방지 로그전송" +
"\n gLoginUserId : " + gLoginUserId +
"\n gLoginUserNm : " + gLoginUserNm +
"\n gDeviceId : " + gDeviceId +
"\n gAppVersion : " + gAppVersion +
"\n gAppKind : " + gAppKind +
"\n gPhoneKind : " + gPhoneKind +
"\n gClientIp : " + gClientIp
);
var param = {
userId : (gLoginUserId === undefined) ? "-" : gLoginUserId,
userNm : (gLoginUserNm === undefined) ? "-" : gLoginUserNm,
deviceId: (gDeviceId === undefined) ? "-" : gDeviceId,
appVersion: (gAppVersion === undefined) ? "-" : gAppVersion,
appKind: (gAppKind === undefined) ? "-" : gAppKind,
phoneKind: (gPhoneKind === undefined) ? "-" : gPhoneKind,
userIp: gClientIp,
currentDt : moment( new Date()).format("YYYYMMDDHHmmss"),
successYn : "N",
failMsg : "화면캡쳐",
logFlag : "C"
};
$.ajax ({
url : $serviceBaseUrl + "/login/inputLoginLog.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
//callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
};
/* 로그인 --------------------------------------------------------------------- */
this.login = {
//로그인 접속 로그 전송
inputLoginLog : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/login/inputLoginLog.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
}
};
/* 병원관리 --------------------------------------------------------------------- */
this.hospital = {
};
/* 일정관리 --------------------------------------------------------------------- */
this.schedule = {
//검사실 부서 리스트 조회 - 의사, 간호사
getSchExamDeptList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/schedule/getSchExamDeptList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//진료과 부서 리스트 조회 - 의사, 간호사, 인턴
getShcDeptList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/schedule/getShcDeptList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//병동 부서 리스트 조회 - 의사, 간호사
getShcWardList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/schedule/getShcWardList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//당직 일정 조회 - 의사, 간호사
getOnDutyWeekSch : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/schedule/getOnDutyWeekSch.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//개인 상세 당직 일정 조회 - 의사, 간호사
getOnDutyMonthSch : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/schedule/getOnDutyMonthSch.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//외래 진료 일정 조회
getWorkSch : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/schedule/getWorkSch.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//의료진 정보 조회
getDoctorInfo : function(param, callback, type){
$.ajax ({
url : $serviceBaseUrl + "/schedule/getDoctorInfo.json",
type : "POST",
async: false,
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result, type);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
}
};
/* 진료 --------------------------------------------------------------------- */
this.medical = {
/* 진료-서비스 --------------------------------------------------------------------- */
//과거 입원 이력 조회
getInHistoryList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getInHistoryList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//과거 외래 진료 이력 조회
getOutHistoryList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOutHistoryList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//과거 수술 이력 조회
getOpHistoryList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOpHistoryList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//진료 기록 조회
getMediRecord : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getMediRecord.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//입원일자 이력 리스트 조회
getInDateList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getInDateList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//외래 진료일자 이력 리스트 조회
getOutDateList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOutDateList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//처방 분류 리스트 조회- 입원, 외래
getPrescriptionClsList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getPrescriptionClsList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//처방 상태 리스트 조회- 입원, 외래
getPrescriptionStatList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getPrescriptionStatList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//처방 내역 조회 - 입원, 외래, 협진
getPrescription : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getPrescription.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//복약정보 조회
getDrugInfo : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getDrugInfo.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//복약정보 조회
getDrugDetail : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getDrugDetail.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//검사결과 접수부서 리스트 조회
getExamReceiptDeptList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getExamReceiptDeptList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//검사결과 리스트 조회
getExamList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getExamList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//검사결과 상세 조회 - 검체검사
getExamRsltTy1 : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getExamRsltTy1.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//검사결과 상세 조회 - 판독결과
getExamRsltTy2 : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getExamRsltTy2.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//수술 이력 목록 조회
getOpDetailHistoryList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOpDetailHistoryList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//수술 상세 조회
getOperationDetail : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOperationDetail.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//시술 이력 목록 조회
getTrDetailHistoryList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getTrDetailHistoryList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//시술 상세 조회
getTreatmentDetail : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getTreatmentDetail.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//협진 이력 목록 조회
getCoDetailHistoryList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getCoDetailHistoryList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//협진 상세 조회
getCollaborationDetail : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getCollaborationDetail.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//진료 기록 목록 조회
getMediRecordList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getMediRecordList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//진료기록서식코드조회
getMediRecordFormList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getMediRecordFormList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//진료 기록 상세 조회
getMediRecordDetail : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getMediRecordDetail.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//진료 기록 내용 상세 조회
getMediRecordContentDetail : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getMediRecordContentDetail.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//임상관찰 조회
getVitalList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getVitalList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//임상관찰 IO합계 조회
getVitalListSum : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getVitalListSum.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//임상관찰 IO합계 조회
getVitalListSum2 : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getVitalListSum2.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//투약실시 내역 조회
getMedicationList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getMedicationList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//임상관찰 등록
inputVital : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/inputVital.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자의 마지막 임상관찰 조회
getVitalByLast : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getVitalByLast.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환부이미지 전송
inputWoundImg : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/inputWoundImg.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
/* 진료-환자검색 --------------------------------------------------------------------- */
//사용자의 진료과 리스트 조회 - 입원, 외래, 응급, 수술, 시술, 협진
getDeptList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getDeptList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//진료과의 진료의 리스트 조회 - 입원, 외래, 수술, 시술, 협진
getDoctorListByDept : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getDoctorListByDept.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//사용자의 병동 리스트 조회
getWardList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getWardList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//병동의 병실 리스트 조회
getRoomListByWard : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getRoomListByWard.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//입원환자 검색
getInPatientList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getInPatientList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//외래 진료 상태 리스트 조회
getOutTreatStatList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOutTreatStatList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//외래환자 검색
getOutPatientList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOutPatientList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//응급환자 상태 리스트 조회
getEmTreatStatList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getEmTreatStatList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//응급환자 검색
getEmPatientList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getEmPatientList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//수술실 리스트 조회
getOperationCntrList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOperationCntrList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//수술실의 수술방 리스트 조회
getOperationRoomList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOperationRoomList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//수술 진행 상태 리스트 조회
getOperationStatList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOperationStatList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//수술환자 검색
getOpPatientList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getOpPatientList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//시술실 리스트 조회
getTreatmentCntrList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getTreatmentCntrList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//시술 진행 상태 리스트 조회
getTreatmentStatList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getTreatmentStatList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//시술환자 검색
getTrPatientList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getTrPatientList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//협진환자 검색
getCoPatientList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getCoPatientList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//바코드환자 검색
getBarPatientList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getBarPatientList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//QR코드 환자 검색
getQrPatientList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getQrPatientList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//NFC 환자 검색
getNfcPatientList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getNfcPatientList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
/* 진료-환자정보 --------------------------------------------------------------------- */
//환자정보(or 진료서비스) 접근 권한 체크
checkAccessRights : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/checkAccessRights.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자정보 조회
getPatientInfo : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getPatientInfo.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자용 notice 조회
getPatientNotice : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/medical/getPatientNotice.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
}
};
this.safety = {
//환자안전관리 투약리스트
getInjectionList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getInjectionList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자안전관리 투약실시
inputInjection : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputInjection.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//환자안전관리 IVF 처리
getInfusionList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getInfusionList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자안전관리 IVF 실시
inputStartInfusion: function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputStartInfusion.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//환자안전관리 IVF 종료
inputEndInfusion : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputEndInfusion.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자안전관리 체혈 리스트
getSpecimenList : function(param, checkYn, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getSpecimenList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(checkYn, response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자안전관리 체혈 실시
actSpecimen : function(param){
var result = "";
$.ajax ({
url : $serviceBaseUrl + "/safety/actSpecimen.json",
type : "POST",
contentType: "application/json",
async: false,
data: JSON.stringify(param),
success: function(response){
// if(response.result!=undefined){
// callback(response.result);
// }else{
// self.alert(response.msg);
// }
// var returnCd = "";
// if (response.result == undefined) {
// returnCd = "0001";
// } else {
// returnCd = response.result[0].returnCd;
// }
//
// callback(returnCd, size, key);
if (response.result == undefined) {
result = "failed";
} else if (response.result.length == 0) {
result = "failed";
} else {
if (response.result[0].returnCd == "0000") {
result = "success";
} else {
result = "failed";
}
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
},
error: function (XHR, textStatus, errorThrown) {
self.loading("hide");
result = "failed";
}
});
return result;
} ,
//환자안전관리 혈액신청 리스트
getBloodRequestList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getBloodRequestList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자안전관리 혈액신청
inputBloodRequest: function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputBloodRequest.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//환자안전관리 혈액 수령 리스트
getBloodReceiveList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getBloodReceiveList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자안전관리 혈액 수령
inputBloodReceive: function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputBloodReceive.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
// Mcare-Fatima 수혈 혈액정보 요청
getBloodCheckList : function(param, isSecondTrial, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getBloodCheckList.json",
async : false,
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(isSecondTrial, response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
// Mcare-Fatima 수혈 혈액 상세정보 요청
getBloodDetailInfo : function(param, index, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getBloodDetailInfo.json",
type : "POST",
async : false,
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(index, response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
},
error: function (XHR, textStatus, errorThrown) {
self.alert("정보 조회에 실패하였습니다.");
self.loading("hide");
}
});
},
//환자안전관리 수혈확인
inputBloodCheck: function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputBloodCheck.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
} ,
//환자안전관리 혈액반납 리스트
getBloodCancelList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getBloodCancelList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
//환자안전관리 혈액 반납
inputBloodCancel: function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputBloodCancel.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
getAtcPrescriptionList: function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getAtcPrescriptionList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
// callback(response.result);
callback(response.result);
}else{
// failCallback(param);
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
// 환자안전관리 투약 처방 리스트
getPrescriptionList: function(param, checkYn, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getPrescriptionList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(checkYn, response.result);
}else{
// failCallback(param);
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
/**
* 대구파티마병원 NFC 태그 시 사용자 정보 호출
* @param {Object} param 전송될 파라미터
* @param {function} callback
*/
getNfcDoctorId: function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getNfcDoctorId.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
// 환자안전관리 환자 정보 공통
getPocPatientInfo: function(param, patientId, isSecondTrial, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getPocPatientInfo.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result, patientId, isSecondTrial);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
},
error: function (XHR, textStatus, errorThrown) {
self.alert("정보 조회에 실패하였습니다.");
self.loading("hide");
}
});
},
// 환자안전관리 투약 실시
actMedication: function(param){
var result = "";
$.ajax ({
url : $serviceBaseUrl + "/safety/actMedication.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
async: false,
success: function(response){
// console.log("response -- > " + JSON.stringify(response));
// if(response.result!=undefined){
// callback(response.result);
// }else{
// self.alert(response.msg);
// }
// var returnCd = "";
// if (response.result.length == 0) {
// result = "failed";
// } else if (response.result == undefined) {
// returnCd = "0001";
// } else {
// returnCd = response.result[0].returnCd;
// }
//
// callback(returnCd, size, key);
if (response.result == undefined) {
result = "failed";
} else if (response.result.length == 0) {
result = "failed";
} else {
if (response.result[0].returnCd == "0000") {
result = "success";
} else {
result = "failed";
}
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
},
error: function (XHR, textStatus, errorThrown) {
// self.alert("Error");
self.loading("hide");
result = "failed";
}
});
return result;
},
// 수혈 1단계 저장
inputCheckupId : function(param, callback, selectItem){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputCheckupId.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
// if(response.result!=undefined){
// callback(response.result);
// }else{
// self.alert(response.msg);
// }
var returnCd = "";
if (response.result == undefined) {
returnCd = "0001";
} else {
returnCd = response.result[0].returnCd;
}
callback(returnCd, selectItem);
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
// 수혈 2~4단계 저장
inputBloodHealthCheck : function(param, item, callback, stepName){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputBloodHealthCheck.json",
type : "POST",
contentType: "application/json",
async: false,
data: JSON.stringify(param),
success: function(response){
console.log("response -- > " + JSON.stringify(response));
checkCnt = checkCnt + 1;
if (response.result == undefined) {
resultReturnCode += "0001" + ",";
} else if (response.result.length == 0) {
resultReturnCode += "0001" + ",";
} else {
resultReturnCode += response.result[0].returnCd + ",";
}
if (item.length == checkCnt) {
callback(resultReturnCode, checkCnt, item.length, stepName);
resultReturnCode = "";
checkCnt = 0;
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
},
error: function (XHR, textStatus, errorThrown) {
self.loading("hide");
alert("저장에 실패하였습니다.");
}
});
},
// 수혈 인증저장
inputBloodSignData : function(param, item, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/inputBloodSignData.json",
type : "POST",
contentType: "application/json",
async: false,
data: JSON.stringify(param),
success: function(response){
console.log("response -- > " + JSON.stringify(response));
checkCnt = checkCnt + 1;
if (response.result == undefined) {
resultReturnCode += "0001" + ",";
} else if (response.result.length == 0) {
resultReturnCode += "0001" + ",";
} else {
resultReturnCode += response.result[0].returnCd + ",";
}
if (item.length == checkCnt) {
callback(resultReturnCode, checkCnt, item.length);
resultReturnCode = "";
checkCnt = 0;
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
},
error: function (XHR, textStatus, errorThrown) {
self.loading("hide");
alert("저장에 실패하였습니다.");
}
});
},
// 부작용 리스트
getSideEffectList : function(param, callback){
$.ajax ({
url : $serviceBaseUrl + "/safety/getSideEffectList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
},
// 수혈중단 사유 리스트
getTransStopReasonList: function (param, type, callback) {
$.ajax ({
url : $serviceBaseUrl + "/safety/getTransStopReasonList.json",
type : "POST",
contentType: "application/json",
data: JSON.stringify(param),
success: function(response){
if(response.result!=undefined){
callback(type, response.result);
}else{
self.alert(response.msg);
}
},
beforeSend: function(){
self.loading("show");
},
complete:function(){
self.loading("hide");
}
});
}
};
/* 공통 서비스 --------------------------------------------------------------------- */
this.common = {
/**
* 환자를 선택한 경우, 각 다이얼로그 화면에 사용자 정보를 설정
*
* @param {string} patientId 환자 번호
* @param {string} patientNm 환자 이름
* @param {string} patientAge 환자 나이
* @param {string} patientGender 환자 성별
* @param {string} patientTreatCls ??
* @param {string} patientReceiptNo 접수 번호
* @param {string} patientDeptCd 환자 진료과 코드
* @param {string} patientDoctorId 진료의? 주치의?
*/
setSelectedPatient : function(patientId, patientNm, patientAge, patientGender, patientTreatCls, patientReceiptNo, patientDeptCd, patientDoctorId){
// 전역 변수에 값 할당
gPatientId = patientId;
gPatientNm = patientNm;
gPatientAge = patientAge;
gPatientGender = patientGender;
gPatientTreatCls = patientTreatCls;
gPatientReceiptNo = patientReceiptNo;
gPatientDeptCd = patientDeptCd;
gPatientDoctorId = patientDoctorId;
$(".modal-patient-id").text(gPatientId);
$(".modal-patient-name").text(gPatientNm);
$(".modal-patient-age-gender").text(gPatientAge + " / " + patientGender);
$(".modal-patient-treat-cls").text(self.common.displayTreatCls( patientTreatCls));
},
/**
* 전역 변수에 어떤 일자를 설정
*
* @param {string} hospitalizationDt 어떤 일자
*/
setHospitalizationDt : function(hospitalizationDt){
gPatientHospitalizationDt = hospitalizationDt;
},
// localstorage 를 초기화 : 로그 아웃에서 사용
initLocalStorage : function(){
var hospitalCd = "";
var defaultDeptCd = "";
var defaultHomePage = "";
var defaultUserID = "";
var defaultData = "";
var defaultisAuto = "";
if( localStorage.getItem("hospitalCd") != undefined && localStorage.getItem("hospitalCd") != "" )
hospitalCd = localStorage.getItem("hospitalCd");
if( localStorage.getItem("defaultDeptCd") != undefined && localStorage.getItem("defaultDeptCd") != "" )
defaultDeptCd = localStorage.getItem("defaultDeptCd");
if( localStorage.getItem("defaultHomePage") != undefined && localStorage.getItem("defaultHomePage") != "" )
defaultHomePage = localStorage.getItem("defaultHomePage");
if( localStorage.getItem("defaultUserID") != undefined && localStorage.getItem("defaultUserID") != "" )
defaultUserID = localStorage.getItem("defaultUserID");
if( localStorage.getItem("defaultData") != undefined && localStorage.getItem("defaultData") != "" )
defaultData = localStorage.getItem("defaultData");
if( localStorage.getItem("defaultisAuto") != undefined && localStorage.getItem("defaultisAuto") != "" )
defaultisAuto = localStorage.getItem("defaultisAuto");
localStorage.clear();
localStorage.setItem("hospitalCd", hospitalCd);
localStorage.setItem("defaultDeptCd", defaultDeptCd);
localStorage.setItem("defaultHomePage", defaultHomePage);
localStorage.setItem("defaultUserID", defaultUserID);
localStorage.setItem("defaultData", defaultData);
localStorage.setItem("defaultisAuto", defaultisAuto);
},
// localstorage에 선택된 사용자 설정 등록
setLocalStorageSelectedInfo : function(userDeptInfo){
localStorage.setItem("selectedUserId", userDeptInfo.userId);
localStorage.setItem("selectedUserNm", userDeptInfo.userNm);
localStorage.setItem("selectedDeptCd", userDeptInfo.deptCd);
localStorage.setItem("selectedDeptNm", userDeptInfo.deptNm);
localStorage.setItem("selectedJobKindCd", userDeptInfo.jobKindCd);
localStorage.setItem("selectedJobKindNm", userDeptInfo.jobKindNm);
localStorage.setItem("selectedUserAuth", userDeptInfo.userAuth);
},
// 배열 Object 문자 정렬
sortArrayObject : function(arrayObject, fieldName, isAscending){
if( arrayObject.length < 2){
console.log( "sortArrayObject : 배열이 2개 미만으로 정렬하지 않음");
return;
}
if( isAscending){
arrayObject.sort( function(a, b) { // 오름차순
return a[fieldName] < b[fieldName] ? -1 : a[fieldName] > b[fieldName] ? 1 : 0;
});
} else {
arrayObject.sort( function(a, b) { // 내림차순
return a[fieldName] > b[fieldName] ? -1 : a[fieldName] < b[fieldName] ? 1 : 0;
});
}
},
// 현재 로그인 사용자의 jobKind와 맞는 권한 인지 체크
checkAccessJobKind : function(jobKindLevel){
if( localStorage.getItem("selectedJobKindCd") == jobKindLevel)
return true;
else
return false;
},
//현재 로그인 사용자의 userAuth와 맞는 권한 인지 체크
checkAccessUserAuth : function(authLevel){
if( localStorage.getItem("selectedUserAuth") == authLevel)
return true;
else
return false;
},
// 기본 페이지 URL 가져오는 함수
getDefaultHomePageURL : function(strHomePage){
if (strHomePage == "injection")
return contextPath + "/mobile_poc/medicine/medicine.page?menuId=clinic";
else if (strHomePage == "bleeding")
return contextPath + "/mobile_poc/bleeding/bleeding.page?menuId=clinic";
else if (strHomePage == "transfusion")
return contextPath + "/mobile_poc/transfusion/transfusion.page?menuId=clinic";
else
return contextPath + "/mobile_poc/medicine/medicine.page?menuId=clinic";
},
// 기본 페이지로 이동해주는 함수
gotoDefaultHomePage : function(){
//alert( "[" + localStorage.getItem("defaultHomePage") + "]");
if (localStorage.getItem("defaultHomePage") == undefined || localStorage.getItem("defaultHomePage") == "") {
//location.href="index.page";
//location.href = contextPath + "/mobile/medical/inpatient.page?menuId=clinic";
location.href = getDefaultHomePageURL("default");
} else {
location.href = getDefaultHomePageURL( localStorage.getItem("defaultHomePage"));
}
},
// 화면 element disabled 설정
enableElements : function(targetObj){
targetObj.prop("enabled", true);
targetObj.find("*").prop("enabled", true);
},
// 화면 element enable or disabled 설정
disableElements : function(targetObj){
targetObj.prop("disabled", true);
targetObj.find("*").prop("disabled", true);
},
//JSON 그룹핑
JSONGroupBy : function(xs, key) {
return xs.reduce(function(rv, x) {
(rv[x[key]] = rv[x[key]] || []).push(x);
return rv;
}, {});
},
displayTreatCls : function(treatCls){
if( gPatientTreatCls == "I")
return "입원";
else if( gPatientTreatCls == "O")
return "외래";
else if( gPatientTreatCls == "E")
return "응급";
else
return "";
},
/**
* 각 화면별 입력 화면 권한처리
*/
authorityCheck : function(objectID){
var adminID = "29990030";
if(objectID != null && objectID != "" && adminID != gLoginUserId){
$(objectID).prop( "disabled", true );
console.log("authorityCheck call");
}
},
/**
* 건대 요구사항 : 소속 과에 사용자명이 없을 경우 %전공의로 처리
* 해당 이름이 있을 경우
*/
kuhResidentSelect : function(selectElement, targetName, targetValue){
if( !selectElement){
return "";
}
for( var i = 0; i < selectElement.options.length; i ++){
if(selectElement.options[i].text == targetName && selectElement.options[i].value == targetValue){
return targetValue;
}
}
for( var i = 0; i < selectElement.options.length; i ++){
if((selectElement.options[i].text).indexOf("전공의") > -1){
return selectElement.options[i].value;
}
}
return "";
},
/**
* 백병원 요구사항 : 소속 과에 사용자명이 없을 경우 %전공의로 처리 부분 제외
* 해당 이름이 있을 경우
*/
commonResidentSelect : function(selectElement, targetName, targetValue){
if( !selectElement){
return "";
}
for( var i = 0; i < selectElement.options.length; i ++){
if(selectElement.options[i].text == targetName && selectElement.options[i].value == targetValue){
return targetValue;
}
}
return "";
}
};
};