123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- "use strict";
- /**
- * mplus_modal_medicationlist
- */
- var mplus_modal_medicationlist = function(){
- // 상속
- mplus_common.call(this);
-
- // 상위 객체 생성
- //var mplusPatient = new mplus_mobile_patient();
- //var mplusNursing = new mplus_nursing();
-
- //super
- var self = this;
-
- //==== 변수 { ====
- var varResultLists = [];
-
- //==== 변수 } ====
-
- /**
- * 초기화
- */
- this.init = function(sendParam){ //여기서 모든화면 콤보박스데이터를 집어넣자!!! 그래야지 화면이동할때 속도가 오래걸리지않음!!!
- // 초기 화면 조건 구성
- initCondition(sendParam);
-
- // 이벤트 초기화
- addEvent();
- };
-
- //==== 초기화 설정 { ====
- var initCondition = function(sendParam){
- $("#divMedicationListResultRows").empty();
- varResultLists = [];
-
- // 초기 화면 조건 구성
- // 일자 설정
- initStartEndDate();
-
- if(sendParam !== undefined && sendParam != null){
- //console.log("searchMedicationListPrescriptionCall call!");
- searchMedicationListPrescriptionCall(sendParam)
- }else{
- //console.log("searchMedicationList call!");
- searchMedicationList();
- }
- };
-
- var searchMedicationList = function(){
- //7일 이상 차이 날 경우 처리
- var varVitalListStartDt = moment($("#txtMedicationListStartDt").val() , "YYYY-MM-DD");
- var varVitalListEndDt = moment($("#txtMedicationListEndDt").val() , "YYYY-MM-DD");
-
- //console.log("날짜이동 : " + moment.duration(varVitalListStartDt.diff(varVitalListEndDt , "day")));
- /*
- if(moment.duration(varVitalListStartDt.diff(varVitalListEndDt , "day")) >= 1 || moment.duration(varVitalListStartDt.diff(varVitalListEndDt , "day")) <= -7){
- self.alert("1주 이상 검색할 수 없습니다.");
- initStartEndDate();
- return;
- }
- */
- //화면 호출일 경우
- var param = {
- userId:gLoginUserId,
- patientId:gPatientId,
- startDt: moment($("#txtMedicationListStartDt").val()).format("YYYYMMDD"),
- endDt: moment($("#txtMedicationListEndDt").val()).format("YYYYMMDD"),
- prescriptionCd:"%",
- prescriptionNo:"%"
- };
-
- self.medical.getMedicationList(param, processSearchMedicalInHisList);
- };
-
- var searchMedicationListPrescriptionCall = function(sendParam){
- if(sendParam === undefined || sendParam == null){
- self.alert("데이터 오류입니다. 관리자에게 문의하세요.");
- return;
- }
-
- //화면 호출일 경우
- var param = {
- userId:gLoginUserId,
- patientId:gPatientId,
- startDt: moment(sendParam.medicationSearchDt).format("YYYYMMDD"),
- endDt: moment(sendParam.medicationSearchDt).format("YYYYMMDD"),
- prescriptionCd:sendParam.prescriptionCd,
- prescriptionNo:sendParam.prescriptionNo
- };
-
- self.medical.getMedicationList(param, processSearchMedicalInHisList);
- };
-
- var processSearchMedicalInHisList = function(lists){
- //console.log(JSON.stringify(lists));
- varResultLists = lists;
- var strDisplayTemp = "";
- var varDoseDtTm = "";
- var varPrescriptionDtTm = "";
- $("#divMedicationListResultRows").empty();
- for( var i = 0; i < lists.length; i++){
- if(lists[i].doseDtTm != undefined && lists[i].doseDtTm != "" && lists[i].doseDtTm != null) {
- varDoseDtTm = moment(lists[i].doseDtTm , "YYYYMMDDhhmmss").format("MM/DD HH:mm");
- } else {
- varDoseDtTm = lists[i].doseDtTm;
- }
- if(lists[i].prescriptionDtTm != undefined && lists[i].prescriptionDtTm != "" && lists[i].prescriptionDtTm != null) {
- varPrescriptionDtTm = moment(lists[i].prescriptionDtTm , "YYYYMMDDhhmmss").format("YYYY-MM-DD HH:mm:ss");
- } else {
- varPrescriptionDtTm = lists[i].prescriptionDtTm;
- }
- strDisplayTemp += "<div id=\"" + "divMedicationList" + i + "\" class=\"row list-group-item\" listCnt=\"" + i + "\" prescriptionCd=\"" + lists[i].prescriptionCd + "\" style=\"overflow: hidden; padding-left: 0px; padding-right: 0px;\">"
- + " <div class=\"col-xs-12\" style=\" padding-left: 0px; padding-right: 0px;\">"
- + " <div class=\"col-xs-1 text-center\" style=\"padding: 4px 0px;\">" + lists[i].prescriptionNo + "</div>"
- + " <div class=\"col-xs-1 text-center\" style=\"padding: 4px 0px;\">" + lists[i].prescriptionClsNm +"</div>"
- + " <div class=\"col-xs-10 text-center\" style=\"padding: 4px 0px; text-align: left;\">" + lists[i].prescriptionNm + "</div>"
- + " </div>"
- + " <div class=\"col-xs-12\" style=\" padding-left: 0px; padding-right: 0px;\">"
- // + " <div class=\"col-xs-2 text-center\" style=\"padding: 4px 0px;\">" + ((moment(lists[i].doseDtTm , "YYYYMMDDhhmmss").format("YYYY-MM-DD HH:mm:ss") != "Invalid date") ? moment(lists[i].doseDtTm , "YYYYMMDDhhmmss").format("MM/DD HH:mm") : "-") + "</div>"
- + " <div class=\"col-xs-2 text-center\" style=\"padding: 4px 0px;\">" + varDoseDtTm + "</div>"
- + " <div class=\"col-xs-3 text-center\" style=\"padding: 4px 0px;\">" + lists[i].doseQtyPerDay + "/" + lists[i].doseQtyTotal + "</div>"
- + " <div class=\"col-xs-3 text-center\" style=\"padding: 4px 0px;\">" + lists[i].doseQtyPer1Tim + "</div>"
- + " <div class=\"col-xs-4 text-center\" style=\"padding: 4px 0px;\">" + lists[i].doseWay + "</div>"
- + " </div>"
- + " <div id=\"divMedicationListDetail" + i + "\" class=\"hidden col-xs-12\">"
- // + " <div class=\"col-xs-9 \" style=\"padding: 0px;\">" + ((moment(lists[i].prescriptionDtTm , "YYYYMMDDhhmmss").format("YYYY-MM-DD HH:mm:ss") != "Invalid date") ? moment(lists[i].prescriptionDtTm , "YYYYMMDDhhmmss").format("YYYY-MM-DD HH:mm:ss") : "-") + "/" + lists[i].prescriptionDeptNm + "/" + lists[i].prescriptionDoctorNm + "/" + lists[i].doseExecutorNm + "</div>";
- + " <div class=\"col-xs-9 \" style=\"padding: 0px;\">" + varPrescriptionDtTm + "/" + lists[i].prescriptionDeptNm + "/" + lists[i].prescriptionDoctorNm + "/" + lists[i].doseExecutorNm + "</div>";
- // 2019.05.09 백병원 요구사항으로 약품정보 버튼 미노출
- // 20190610 dkchoi75 일산백병원 요구사항으로 약품정보 버튼 노출 Y: 노출 N:미노출
- var varDrogInfoButtonYn = "Y";
- if(lists[i].prescriptionCd != null && lists[i].prescriptionCd != "" && lists[i].prescriptionCd != "-"){
- //if(lists[i].comment != null && lists[i].comment != "" && lists[i].comment != "-" && varDrogInfoButtonYn == "Y"){
- strDisplayTemp += "<div class=\"col-xs-3 \"><button id=\"btnCallDrugInfo\" type=\"button\" class=\"btn btn-info\">약품정보</button></div>";
- }else{
- strDisplayTemp += "<div class=\"col-xs-3 \"></div>";
- }
- strDisplayTemp += " </div>"
- + "</div>"
- ;
- //console.log( i + " : " + lists[i].deptNm);
- }
-
- $("#divMedicationListResultRows").append(strDisplayTemp); // element 추가
-
- //선택이벤트 처리
- addEventMedicationListResult();
- };
-
- var addEventMedicationListResult = function() {
- $("#divMedicationListResultRows .list-group-item").off("click"); // 기존 이벤트 해제
- $("#divMedicationListResultRows .list-group-item").on("click", function(e){
- //진료기록 조회 리스트 검색 처리
- var varPreCnt = e.currentTarget.attributes.listCnt.value;
- var varOrderCd = e.currentTarget.attributes.prescriptionCd.value;
- var divMedicationId = "#divMedicationListDetail" + varPreCnt;
- // 20190610 dkchoi75 일산백병원 약품정보 Naver 연동 서비스 구분 N:Naver, E:내부EMR, K:킴스
- var varDrugInfoApi = "N";
- //버튼 클릭 이벤트 처리
- if((e.target.id).indexOf("btnCallDrugInfo") != -1){
- //if(varResultLists[varPreCnt].prescriptionCd != null && varResultLists[varPreCnt].prescriptionCd != "" && varResultLists[varPreCnt].prescriptionCd != "-"){
- // if(varResultLists[varPreCnt].comment != null && varResultLists[varPreCnt].comment != "" && varResultLists[varPreCnt].comment != "-"){
- //examResultKey의 값을 정확하게 처리해야함!!! 체크바람!
- //if(e.target.id == "btnCallDrugInfo" && varOrderCd != null && varOrderCd != ""){//약품정보
- if(e.target.id == "btnCallDrugInfo" ){//약품정보
- if (varDrugInfoApi == "N") {
- var jsonMsg = {
- "type":"command",
- "functionType":"popup",
- "value" : {
- "url" : "http://m.terms.naver.com/medicineSearch.nhn?query=" + varResultLists[varPreCnt].comment,
- "method": "GET", // Default "GET" ** 2017-10-19 추가
- "parameters": "-" // POST 인 경우만, GET 인 경우는 "url" 에 모두 붙여서 전달 ** 2017-10-19 추가
- }
- };
- self.toNative(jsonMsg);
- } else if (varDrugInfoApi == "E") {
- //console.log("orderCd.value : " + varOrderCd);
- mplusModalMedication.init(param);
- $("#mplusAlertDrugInfo").modal("show");
- //mplusModalExamrsltty1.init(varPrescriptionLists[varPreCnt]);
- //self.alert("처방번호 : " + varResultLists[varPreCnt].prescriptionCd);
- } else if (varDrugInfoApi == "K") {
- // 킴스 연동 부분
- }
- var param = {
- orderCd: varOrderCd
- };
- }else{//판독결과
- self.alert("약품정보가 없습니다.");
- // 환자 정보 화면 띄우기
- //$("#modalExamRsltTy2").modal("show");
- //mplusModalExamrsltty2.init(varPrescriptionLists[varPreCnt]);
- //self.alert("처방번호 : " + varResultLists[varPreCnt].prescriptionCd);
- }
- // }else{
- // console.log("prescriptionCd값 확인바람 : " + varResultLists[varPreCnt].prescriptionCd);
- // }
-
- return;
- }
-
- if( $(divMedicationId).hasClass("hidden")) {
- $(divMedicationId).removeClass("hidden");
- } else {
- $(divMedicationId).addClass("hidden");
- }
-
- });
- };
-
- var initStartEndDate = function(){
- //오늘일자 로드
- var varToday = new Date();
-
- //일요일이면 차주 가져오기
- //다른 요일이면 해당 요일 처리
- //$("#txtMedicationListEndDt").val( moment(varToday).format("YYYY-MM-DD") );
- //varToday.setMonth(varToday.getMonth() - 1);
- //varToday.setDate(varToday.getDate() - 1);
- //$("#txtMedicationListStartDt").val( moment(varToday).format("YYYY-MM-DD") );
- $("#txtMedicationListEndDt").val( moment(varToday).format("YYYY-MM-DD") );
- $("#txtMedicationListStartDt").val( moment().subtract(1, 'months').format("YYYY-MM-DD") );
- };
- //==== 초기화 설정 } ====
-
- //==== 이벤트 설정 { ====
- var addEvent = function(){
- //$("#btnLogout").on("click", function(){
- // logout();
- //});
-
- eventColumnClick();
-
- eventRowClick();
-
- eventConditionClick();
- };
-
- var eventConditionClick = function(){
- // 1일 버튼클릭
- $("#btnMedicationListOneDaySearch").off('click'); // 기존 이벤트 해제
- $("#btnMedicationListOneDaySearch").on('click', function(e){
- $("#txtMedicationListStartDt").val( moment().subtract(1, 'days').format("YYYY-MM-DD") );
- searchMedicationList();
- });
- // 1주 버튼클릭
- /*
- $("#btnMedicationListOneWeekSearch").off('click'); // 기존 이벤트 해제
- $("#btnMedicationListOneWeekSearch").on('click', function(e){
- var varSelDate = new Date($("#txtMedicationListEndDt").val());
- varSelDate.setDate(varSelDate.getDate() - 6);
- //varSelDate.setMonth(varSelDate.getMonth() - 3);
- $("#txtMedicationListStartDt").val( moment(varSelDate).format("YYYY-MM-DD") );
- });
- */
- // 1달 버튼클릭
- $("#btnMedicationListOneMonthSearch").off("click"); // 기존 이벤트 해제
- $("#btnMedicationListOneMonthSearch").on("click", function(e){
- $("#txtMedicationListStartDt").val( moment().subtract(1, 'months').format("YYYY-MM-DD") );
- searchMedicationList();
- });
- // 3달 버튼클릭
- $("#btnMedicationListThreeMonthSearch").off('click'); // 기존 이벤트 해제
- $("#btnMedicationListThreeMonthSearch").on('click', function(e){
- $("#txtMedicationListStartDt").val( moment().subtract(3, 'months').format("YYYY-MM-DD") );
- searchMedicationList();
- });
- // 조회버튼
- $("#btnMedicationListSearch").off('click'); // 기존 이벤트 해제
- $("#btnMedicationListSearch").on('click', function(e){
- //로우 초기화
- $("#divMedicationListResultRows").empty();
-
- searchMedicationList();
- });
-
- };
-
- var eventColumnClick = function(){
- };
-
- var eventRowClick = function(){
-
- };
- //==== 이벤트 설정 } ====
-
-
- //==== 서비스 실행 { ====
- //==== 서비스 실행 { ====
-
- };
|