#region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved. // // All rights are reserved. Reproduction or transmission in whole or in part, // in any form or by any means, electronic, mechanical or otherwise, is // prohibited without the prior written consent of the copyright owner. // // Filename:PatientInfoCtrl.cs // #endregion using System; using System.ComponentModel; using System.Windows.Forms; using System.Collections.Generic; using ClipSoft.Exceptions; using CLIP.eForm.Consent.UI.HospitalSvcRef; namespace CLIP.eForm.Consent.UI { /// /// 동의서 조회 컨트롤의 환자 정보 탭 클래스 /// /// ///

[설계자]

///

클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)

///

[원본 작성자]

///

클립소프트 기술부 이창훈 (chlee@clipsoft.co.kr)

///

[수정 작성자]

///

클립소프트 기술부 이인희

///

----------------------------------------------------------------------------------------

///

[HISTORY]

///

2016-06-21 : 최초작성

///

----------------------------------------------------------------------------------------

///
public partial class PatientInfoCtrl : PatientInfoCtrlBase { private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null; IConsentMain consentMain = null; ConsentCommandCtrl commandControl = null; public PatientInfoCtrl() { InitializeComponent(); } public void SetPatientInfo() { if(consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); SetPatientBasicInfo(consentMain); SetClnDateItem(); } private void PatientInfoCtrl_Load(object sender, EventArgs e) { if(this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } consentMain = ConsentMainControl.GetConsentMainInterface(this); commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; consentMain.OnLoadPartControls += ConsentMain_OnLoadPartControls; hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]); } private void ConsentMain_OnLoadPartControls(object sender, EventArgs e) { if(consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if(commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; try { SetEndUser(consentMain); SetPatientBasicInfo(consentMain); SetClnDateItem(); if(comboTrmtPrd.Items.Count > 0) comboTrmtPrd.SelectedIndex = 0; // 로딩 될 때 발행리스트 탭이 갱신 되어야 한다. consentMain.ConsentListCtrl.consentSelectTabPageAllRefresh(); } catch(UserException uex) { MessageBox.Show(string.Format(uex.Message) , string.Format(Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); consentMain.TerminateConsentMain(); } } // 작성자 정보 셋팅 private void SetEndUser(IConsentMain consentMain) { if(commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; GetUserDetailInfo(consentMain.ConsentExecuteInfo["userNo"] , consentMain.ConsentExecuteInfo["dutinstcd"] , consentMain.ConsentExecuteInfo["userDeptCd"] , commandControl); } private void GetUserDetailInfo(string userid, string dutinstcd, string dutplcecd, ConsentCommandCtrl commandControl) { UserVO userVO = (UserVO)this.hospitalWebService.GetUserInfo(userid, dutinstcd, dutplcecd); if(userVO == null) { if(!string.IsNullOrEmpty(consentMain.ConsentExecuteInfo["userDeptCd"])) { // 실행 정보에 있는 사용자 정보 설정 commandControl.CurrentEndUser = new EndUser(); commandControl.CurrentEndUser.UserNo = this.labelUserNo.Text = consentMain.ConsentExecuteInfo["userNo"]; commandControl.CurrentEndUser.UserName = this.labelUserNm.Text = consentMain.ConsentExecuteInfo["userName"]; // dbs227, password 를 왜 사용하지? //commandControl.CurrentEndUser.Password = ""; //commandControl.CurrentEndUser.UserGroupCode = ""; commandControl.CurrentEndUser.DeptCode = consentMain.ConsentExecuteInfo["userDeptCd"]; commandControl.CurrentEndUser.DeptName = this.labelUserDept.Text = consentMain.ConsentExecuteInfo["userDeptName"]; commandControl.CurrentEndUser.HosType = consentMain.ConsentExecuteInfo["dutinstcd"]; commandControl.CurrentEndUser.UserTelNo = ""; commandControl.CurrentEndUser.JobKindCd = "9999"; commandControl.CurrentEndUser.JobKindNm = ""; } else { string _msg = string.Format("[{0}] 에 해당하는 의사정보가 없습니다.", userid); MessageBox.Show(_msg); throw new Exception(_msg); } } else { commandControl.CurrentEndUser = new EndUser(); commandControl.CurrentEndUser.UserNo = this.labelUserNo.Text = userVO.userId; commandControl.CurrentEndUser.UserName = this.labelUserNm.Text = userVO.userName; //commandControl.CurrentEndUser.Password = userVO.; //commandControl.CurrentEndUser.UserGroupCode = userVO.; commandControl.CurrentEndUser.DeptCode = userVO.userDeptCode; commandControl.CurrentEndUser.DeptName = this.labelUserDept.Text = userVO.userDeptName; commandControl.CurrentEndUser.HosType = userVO.instCd; commandControl.CurrentEndUser.UserTelNo = userVO.userTelNo; // 사용자의 직군코드가 없으면 9999 로 설정 commandControl.CurrentEndUser.JobKindCd = string.IsNullOrEmpty(userVO.jobKindCd) ? "9999" : userVO.jobKindCd; commandControl.CurrentEndUser.JobKindNm = userVO.jobKindNm ?? ""; commandControl.CurrentEndUser.IOFlag = userVO.ioFlag ?? ""; consentMain.ConsentExecuteInfo["userIOFlag"] = commandControl.CurrentEndUser.IOFlag; } } // 환자 정보 셋팅 private void SetPatientBasicInfo(IConsentMain consentMain) { PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(consentMain.ConsentExecuteInfo["patientNo"] , consentMain.ConsentExecuteInfo["clnDate"] , consentMain.ConsentExecuteInfo["visitType"] , consentMain.ConsentExecuteInfo["clnDept"] , consentMain.ConsentExecuteInfo["cretno"] , consentMain.ConsentExecuteInfo["dutinstcd"] , consentMain.ConsentExecuteInfo["opRsrvNo"]); // 환자 정보가 없는 경우 if(patientVOList == null || patientVOList.Length == 0) { commandControl.CurrentTargetPatient = new TargetPatient(); } else { PatientVO vo = patientVOList[0]; this.labelPtntNm.Text = vo.patientName; this.labelPtntNo.Text = vo.pid; commandControl.CurrentTargetPatient = new TargetPatient(); SetTargetPatientInfo(vo); } } /// /// PatientVO 정보를 이용해서 CurrentTargetPatient 정보 SET /// /// 설정할 PatientVO 클래스의 인스턴스 private void SetTargetPatientInfo(PatientVO vo) { commandControl.CurrentTargetPatient.HosType = vo.instCd; commandControl.CurrentTargetPatient.PatientName = vo.patientName; commandControl.CurrentTargetPatient.PatientCode = vo.pid; commandControl.CurrentTargetPatient.PatientSexAge = vo.sa; commandControl.CurrentTargetPatient.PatientJuminNo = vo.juminNo; commandControl.CurrentTargetPatient.PatientJuminNoOrg = vo.orgJuminNo; commandControl.CurrentTargetPatient.VisitType = vo.ordType; commandControl.CurrentTargetPatient.cretno = vo.cretNo; commandControl.CurrentTargetPatient.Dschdd = vo.dschDd.Replace("-", ""); commandControl.CurrentTargetPatient.clnDate = vo.inDd; commandControl.CurrentTargetPatient.clnDeptCode = vo.ordDeptCd; commandControl.CurrentTargetPatient.clnDeptName = vo.deptEngAbbr; commandControl.CurrentTargetPatient.clnDxCd = vo.dxCd; commandControl.CurrentTargetPatient.clnDxNm = vo.dxNm; commandControl.CurrentTargetPatient.MainDrId = vo.mainDrId; commandControl.CurrentTargetPatient.MainDrNm = vo.mainDrName; commandControl.CurrentTargetPatient.Ward = vo.ward; commandControl.CurrentTargetPatient.RoomNo = vo.roomCd; commandControl.CurrentTargetPatient.OrderNo = vo.orderNo; commandControl.CurrentTargetPatient.OPdrId = vo.opDrId; commandControl.CurrentTargetPatient.OPdrNm = vo.opDrNm; commandControl.CurrentTargetPatient.OPdeptCode = vo.opDeptCd; commandControl.CurrentTargetPatient.OPdeptName = vo.opDeptNm; commandControl.CurrentTargetPatient.PatientAddr = vo.zipCdAddr; commandControl.CurrentTargetPatient.PatientTelNo = vo.telNum; commandControl.CurrentTargetPatient.Insukind = vo.insuKind; // 수술 정보 commandControl.CurrentTargetPatient.OpRsrvNo = vo.opRsrvNo; commandControl.CurrentTargetPatient.OpCnfmDate = vo.opCnfmDd; commandControl.CurrentTargetPatient.PerfDrName = vo.perfDrNm; commandControl.CurrentTargetPatient.PerfDrFlag = vo.perfDrFlag; commandControl.CurrentTargetPatient.PerfDrDept = vo.perfDrDept; commandControl.CurrentTargetPatient.OpDiagName = vo.opDiagNm; commandControl.CurrentTargetPatient.OpName = vo.opNm; commandControl.CurrentTargetPatient.AnstDrName1 = vo.anstDrNm1; commandControl.CurrentTargetPatient.AnstDrFlag1 = vo.anstDrFlag1; commandControl.CurrentTargetPatient.AnstDeptName1 = vo.anstDeptNm1; commandControl.CurrentTargetPatient.AnstDrName2 = vo.anstDrNm2; commandControl.CurrentTargetPatient.AnstDrFlag2 = vo.anstDrFlag2; commandControl.CurrentTargetPatient.AnstDeptName2 = vo.anstDeptNm2; commandControl.CurrentTargetPatient.AnstDrName3 = vo.anstDrNm3; commandControl.CurrentTargetPatient.AnstDrFlag3 = vo.anstDrFlag3; commandControl.CurrentTargetPatient.AnstDeptName3 = vo.anstDeptNm3; commandControl.CurrentTargetPatient.Ex_bp = vo.bp; commandControl.CurrentTargetPatient.Ex_dm = vo.dm; commandControl.CurrentTargetPatient.Ex_heart = vo.heart; commandControl.CurrentTargetPatient.Ex_kidney = vo.kidney; commandControl.CurrentTargetPatient.Ex_respiration = vo.respiration; commandControl.CurrentTargetPatient.Ex_hx = vo.hx; commandControl.CurrentTargetPatient.Ex_allergy = vo.allergy; commandControl.CurrentTargetPatient.Ex_drug = vo.drug; commandControl.CurrentTargetPatient.Ex_smoking = vo.smoking; commandControl.CurrentTargetPatient.Ex_idio = vo.idio; commandControl.CurrentTargetPatient.Ex_nacrotics = vo.nacrotics; commandControl.CurrentTargetPatient.Ex_airway = vo.airway; commandControl.CurrentTargetPatient.Ex_hemorrhage = vo.hemorrhage; commandControl.CurrentTargetPatient.Ex_status_etc = vo.statusEtc; } /// /// 진료일 범위 설정 /// private void SetClnDateItem() { Dictionary comboItems = new Dictionary(); comboItems.Add(" - ", ""); // 환자 선택 시 수진 이력이 자동으로 갱신되게끔 변경 // 수진 이력 기간 조회 시 현재 일자가 아니라 선택된 진료일, 혹은 입원일을 기준으로 기간이 설정되게끔 수정 if(commandControl.CurrentTargetPatient != null && !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.clnDate)) { for(int i = 1; i < 4; i++) { comboItems.Add(i.ToString() + "개월", commandControl.CurrentTargetPatient.clnDate); } } else { for(int i = 1; i < 4; i++) { comboItems.Add(i.ToString() + "개월", DateTime.Now.AddMonths(-i).ToShortDateString().Replace("-", "")); } } comboTrmtPrd.DataSource = new BindingSource(comboItems, null); comboTrmtPrd.DisplayMember = "Key"; comboTrmtPrd.ValueMember = "Value"; } /// /// 진료일 범위 선택했을때, 해당하는 진료일 조회하여 바인딩 /// /// The source of the event. /// The instance containing the event data. private void comboTrmtPrd_SelectedIndexChanged(object sender, EventArgs e) { Dictionary comboItems = new Dictionary(); int pos = 0; if(comboTrmtPrd.SelectedIndex == 0) { //초기 넘겨준 특정 진료일을 바인딩 comboItems = GetClnDateSearchList(commandControl.CurrentTargetPatient.PatientCode , commandControl.CurrentTargetPatient.clnDate , "=" , commandControl.CurrentTargetPatient.clnDeptCode ,out pos); } else { //진료일 범위에 해당하는 진료일자 조회하여 바인딩 comboItems = GetClnDateSearchList(commandControl.CurrentTargetPatient.PatientCode , comboTrmtPrd.SelectedValue.ToString() , ">=" , commandControl.CurrentTargetPatient.clnDeptCode , out pos); } if(comboItems.Count > 0) { comboTrmtDate.DataSource = new BindingSource(comboItems, null); comboTrmtDate.DisplayMember = "Key"; comboTrmtDate.ValueMember = "Value"; comboTrmtDate.Tag = consentMain.ConsentExecuteInfo["patientNo"]; comboTrmtDate.SelectedIndex = pos; /* if(comboTrmtDate.Items.Count > 0) { if(comboTrmtDate.SelectedIndex == 0) GetTrmtInfo(); else comboTrmtDate.SelectedIndex = 0; }*/ } else { comboTrmtDate.DataSource = null; } } /// /// 검색된 진료일 값을 컨트롤에 바인딩 /// /// 환자번호 /// 진료일자 /// 검색일자 /// 진단부서 /// private Dictionary GetClnDateSearchList(string patientNo, string clnDate, string searchType, string orddeptcd, out int pos) { pos = 0; Dictionary comboDates = new Dictionary(); // 환자의 주진단 정보를 조회 ClnDateForDropdownVO[] clnDateList = this.hospitalWebService.GetTrmtDateList(patientNo , clnDate , searchType , orddeptcd , consentMain.ConsentExecuteInfo["dutinstcd"] , consentMain.ConsentExecuteInfo["visitType"]); if(clnDateList != null && clnDateList.Length > 0) { int i = 0; foreach(ClnDateForDropdownVO vDate in clnDateList) { comboDates.Add(string.Format("{0} / {1} / {2} / {3} / {4}", vDate.VisitTypeName, vDate.ClnFormatDate, vDate.ClnDeptName, vDate.orddrid, vDate.CretNo), string.Format("{0} / {1} / {2} / {3} / {4}", vDate.ClnDate, vDate.VisitType, vDate.ClnDeptCode, vDate.CretNo, vDate.DeptCd)); if(vDate.CretNo == Int32.Parse(consentMain.ConsentExecuteInfo["cretno"])) { pos = i; } i++; } } return comboDates; } private void comboTrmtDate_SelectedIndexChanged(object sender, EventArgs e) { GetTrmtInfo(); } /// /// 환자 선택시 수진일자별 진단 데이터 조회하여 환자명과 내원번호를 설정하고 /// 현재 선택된 한자로 설정한다 /// /// private void GetTrmtInfo() { //수진일자를 변경했을때 환자의 주진단 정보를 재조회한다. if(commandControl.CurrentTargetPatient != null && comboTrmtDate.SelectedItem != null) { string[] clnDate = ((KeyValuePair)comboTrmtDate.SelectedItem).Value.Split('/'); if(clnDate != null && clnDate.Length == 5) { // 환자 선택시 수진일자별 진단 데이터 조회 PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(consentMain.ConsentExecuteInfo["patientNo"] , clnDate[0].Trim() , clnDate[1].Trim() , clnDate[4].Trim() , clnDate[3].Trim() , this.consentMain.ConsentExecuteInfo["dutinstcd"] , this.consentMain.ConsentExecuteInfo["opRsrvNo"]); if(patientVOList == null || patientVOList.Length == 0) { throw new UserException(string.Format(Properties.Resources.msg_error_get_patient , consentMain.ConsentExecuteInfo["patientNo"])); } else { PatientVO vo = patientVOList[0]; // 환자명과 내원번호 설정 this.labelPtntNm.Text = vo.patientName; this.labelPtntNo.Text = vo.pid; //현재 선택된 환자로 설정 commandControl.CurrentTargetPatient = new TargetPatient(); SetTargetPatientInfo(vo); } } } } /// /// 환자목록에서 더블클릭했을 경우, 선택된 환자 정보로 상단정보를 재조회한다. /// /// 방문 타입 public override void OnRefeashPartControls(string visitType) { if(consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this); if(commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; try { SetEndUser(consentMain); SetPatientBasicInfo(consentMain); SetClnDateItem(); if(comboTrmtPrd.SelectedIndex > 0) { comboTrmtPrd.SelectedIndex = 0; } else { comboTrmtPrd_SelectedIndexChanged(null, null); } } catch(UserException uex) { MessageBox.Show(string.Format(uex.Message) , string.Format(Properties.Resources.msg_caption_fail), MessageBoxButtons.OK, MessageBoxIcon.Error); consentMain.TerminateConsentMain(); } } /// /// 동의서명을 설정 /// /// Name of the document. public override void SetConsentDocumentName(string documentName) { this.labelDocName.Text = documentName; } /// /// 작성자 정보를 설정 /// /// The userid. /// The dutinstcd. /// The dutplcecd. public override void SetConsentUserInfo(string userid, string dutinstcd, string dutplcecd) { ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; GetUserDetailInfo(userid, dutinstcd, dutplcecd, commandControl); } public override void SetConsentUserInfo(string userid, string dutinstcd, string dutplcecd, string temp) { ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl; UserVO userVO = (UserVO) this.hospitalWebService.GetUserInfo(userid, dutinstcd, dutplcecd); if (userVO == null) { userVO = (UserVO) this.hospitalWebService.GetUserInfo(commandControl.CurrentEndUser.UserNo, dutinstcd, commandControl.CurrentEndUser.DeptCode); } commandControl.CurrentEndUser = new EndUser(); commandControl.CurrentEndUser.UserNo = this.labelUserNo.Text = userVO.userId; commandControl.CurrentEndUser.UserName = this.labelUserNm.Text = userVO.userName; //commandControl.CurrentEndUser.Password = userVO.; //commandControl.CurrentEndUser.UserGroupCode = userVO.; commandControl.CurrentEndUser.DeptCode = userVO.userDeptCode; commandControl.CurrentEndUser.DeptName = this.labelUserDept.Text = userVO.userDeptName; commandControl.CurrentEndUser.HosType = userVO.instCd; commandControl.CurrentEndUser.UserTelNo = userVO.userTelNo; // 사용자의 직군코드가 없으면 9999 로 설정 commandControl.CurrentEndUser.JobKindCd = userVO.jobKindCd ?? "9999"; commandControl.CurrentEndUser.JobKindNm = userVO.jobKindNm ?? ""; commandControl.CurrentEndUser.IOFlag = userVO.ioFlag ?? ""; consentMain.ConsentExecuteInfo["userIOFlag"] = commandControl.CurrentEndUser.IOFlag; //GetUserDetailInfo(userid, dutinstcd, dutplcecd, commandControl); } /// /// 상단의 진료일과 작성자 정보로 설정 (수진일자를 변경했을때 환자의 주진단 정보를 재조회한다.) /// /// public override void SetBasicPatientInfo() { if(commandControl.CurrentTargetPatient != null && comboTrmtDate.SelectedValue != null) { string[] clnDate = ((KeyValuePair)comboTrmtDate.SelectedItem).Value.Split('/'); if(clnDate != null && clnDate.Length == 4) { PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(consentMain.ConsentExecuteInfo["patientNo"] , clnDate[0].Trim() , clnDate[1].Trim() , clnDate[2].Trim() , clnDate[3].Trim() , consentMain.ConsentExecuteInfo["dutinstcd"] , consentMain.ConsentExecuteInfo["opRsrvNo"]); if(patientVOList == null || patientVOList.Length == 0) { throw new UserException(string.Format(Properties.Resources.msg_error_get_patient , consentMain.ConsentExecuteInfo["patientNo"])); } else { PatientVO vo = patientVOList[0]; commandControl.CurrentTargetPatient = new TargetPatient(); SetTargetPatientInfo(vo); } } } } /// /// 동의서 정보로 환자 주진단 정보 설정 (ConsentVO 데이터로 PatientVO 조회) /// /// The order date. /// Type of the order. /// The order dept cd. /// The cretno. /// public override void SetPatientByConsentInfo(string orderDate, string orderType, string orderDeptCd, string cretno) { PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(commandControl.CurrentTargetPatient.PatientCode , orderDate.Replace("-", "") , orderType , orderDeptCd , cretno , this.consentMain.ConsentExecuteInfo["dutinstcd"] , this.consentMain.ConsentExecuteInfo["opRsrvNo"]); if(patientVOList == null || patientVOList.Length == 0) { throw new UserException(string.Format(Properties.Resources.msg_error_get_patient , consentMain.ConsentExecuteInfo["patientNo"])); } else { PatientVO vo = patientVOList[0]; commandControl.CurrentTargetPatient = new TargetPatient(); SetTargetPatientInfo(vo); } } } }