/// [설계자]
/// 클립소프트 연구소 홍지철 (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();
}
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;
}
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;
if (consentMain.ConsentExecuteInfo.ContainsKey("userNo"))
{
GetUserDetailInfo(consentMain.ConsentExecuteInfo["userNo"], commandControl);
}
else
{
throw new UserException(Properties.Resources.msg_error_user_args);
}
}
private void GetUserDetailInfo(string userNo, ConsentCommandCtrl commandControl)
{
UserVO userVO = (UserVO)this.hospitalWebService.GetUserInfo(userNo);
if (userVO == null)
{
//if (userNo.Substring(0,4).Equals("5000"))
//{
// MessageBox.Show("일반의사는 출력만 가능합니다.");
// commandControl.CurrentEndUser = new EndUser();
// commandControl.CurrentEndUser.UserName = this.labelUserNm.Text = "일반의사";
// commandControl.CurrentEndUser.UserNo = this.labelUserNo.Text = userNo;
// commandControl.CurrentEndUser.DeptCode = "";
// commandControl.CurrentEndUser.DeptName = this.labelUserDept.Text = "";
//}
//else
//{
throw new UserException(string.Format(Properties.Resources.msg_error_get_user, userNo));
//}
}
else
{
if (userNo.Substring(0, 4).Equals("5000"))
{
MessageBox.Show("일반의사는 출력만 가능합니다.");
}
commandControl.CurrentEndUser = new EndUser();
commandControl.CurrentEndUser.UserNo = this.labelUserNo.Text = userVO.UserNo;
commandControl.CurrentEndUser.UserName = this.labelUserNm.Text = userVO.UserName;
commandControl.CurrentEndUser.Password = userVO.UserPassword;
commandControl.CurrentEndUser.DeptCode = userVO.UserDeptCode;
commandControl.CurrentEndUser.DeptName = this.labelUserDept.Text = userVO.UserDeptName;
commandControl.CurrentEndUser.UserGroupCode = userVO.UserGroupCode;
commandControl.CurrentEndUser.HosType = userVO.HosType;
if(!consentMain.ConsentExecuteInfo.ContainsKey("loginUserName"))
{
consentMain.ConsentExecuteInfo["loginUserName"] = commandControl.CurrentEndUser.UserName;
}
if(consentMain.ConsentExecuteInfo.ContainsKey("loginUserNo")
&& consentMain.ConsentExecuteInfo["loginUserNo"].Equals(commandControl.CurrentEndUser.UserNo))
{
consentMain.ConsentExecuteInfo["loginUserName"] = commandControl.CurrentEndUser.UserName;
}
}
}
// 환자 정보 셋팅
private void SetPatientBasicInfo(IConsentMain consentMain)
{
if (consentMain.ConsentExecuteInfo.ContainsKey("patientNo") && consentMain.ConsentExecuteInfo.ContainsKey("clnDate")
&& consentMain.ConsentExecuteInfo.ContainsKey("visitType") && consentMain.ConsentExecuteInfo.ContainsKey("clnDept")
&& consentMain.ConsentExecuteInfo.ContainsKey("cretno"))
{
PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo( consentMain.ConsentExecuteInfo["patientNo"],
consentMain.ConsentExecuteInfo["clnDate"],
consentMain.ConsentExecuteInfo["visitType"],
consentMain.ConsentExecuteInfo["clnDept"],
consentMain.ConsentExecuteInfo["cretno"]
);
if (patientVOList == null || patientVOList.Length == 0)
{
//throw new UserException(string.Format(Properties.Resources.msg_error_get_patient
// , consentMain.ConsentExecuteInfo["patientNo"]));
//환자정보 없이 프로그램을 실행해야 하는 경우가 있음.
commandControl.CurrentTargetPatient = new TargetPatient();
if (commandControl != null && commandControl.CurrentEndUser != null)
{
commandControl.CurrentTargetPatient.HosType = commandControl.CurrentEndUser.HosType;
}
}
else
{
PatientVO vo = patientVOList[0];
this.labelPtntNm.Text = vo.IO_Pt_Name;
this.labelPtntNo.Text = vo.IO_Pt_ID;
commandControl.CurrentTargetPatient = new TargetPatient();
if (commandControl != null && commandControl.CurrentEndUser != null)
{
commandControl.CurrentTargetPatient.HosType = commandControl.CurrentEndUser.HosType;
}
SetTargetPatientInfo(vo);
}
}
else
{
throw new UserException(Properties.Resources.msg_error_patient_args);
}
}
//PatientVO 정보를 이용해서 CurrentTargetPatient 정보 SET
private void SetTargetPatientInfo(PatientVO vo)
{
commandControl.CurrentTargetPatient.PatientName = vo.IO_Pt_Name;
commandControl.CurrentTargetPatient.PatientCode = vo.IO_Pt_ID;
commandControl.CurrentTargetPatient.PatientSexAge = vo.IO_sex_age_y_m;
commandControl.CurrentTargetPatient.PatientJuminNo = vo.IO_JuminNo;
commandControl.CurrentTargetPatient.VisitType = vo.IO_VisitType;
commandControl.CurrentTargetPatient.cretno = vo.IO_CretNo;
commandControl.CurrentTargetPatient.Dschdd = vo.IO_Dschdd.Replace("-","");
commandControl.CurrentTargetPatient.clnDate = vo.IO_ADdate;
commandControl.CurrentTargetPatient.clnDeptCode = vo.IO_DeptCd;
commandControl.CurrentTargetPatient.clnDeptName = vo.IO_DeptNm;
commandControl.CurrentTargetPatient.clnDeptNameKO = vo.IO_Dept2;
commandControl.CurrentTargetPatient.clnDxCd = vo.IO_DxCd;
commandControl.CurrentTargetPatient.clnDxNm = vo.IO_DxNm;
commandControl.CurrentTargetPatient.MainDrId = vo.IO_MaindrId;
commandControl.CurrentTargetPatient.MainDrNm = vo.IO_MaindrNm;
commandControl.CurrentTargetPatient.Ward = vo.IO_Ward;
commandControl.CurrentTargetPatient.RoomNo = vo.IO_RoomNo;
commandControl.CurrentTargetPatient.OrderNo = vo.IO_OrderNo;
commandControl.CurrentTargetPatient.OPdrId = vo.IO_OPdrId;
commandControl.CurrentTargetPatient.OPdrNm = vo.IO_OPdrNm;
commandControl.CurrentTargetPatient.OPdeptCode = vo.IO_OPdeptCd;
commandControl.CurrentTargetPatient.OPdeptName = vo.IO_OPdeptNm;
commandControl.CurrentTargetPatient.PatientAddr = vo.IO_Zipcdaddr;
commandControl.CurrentTargetPatient.PatientTelNo = vo.IO_Tel;
commandControl.CurrentTargetPatient.Insukind = vo.IO_Insukind;
commandControl.CurrentTargetPatient.Ex_bp = vo.IO_bp;
commandControl.CurrentTargetPatient.Ex_dm = vo.IO_dm;
commandControl.CurrentTargetPatient.Ex_heart = vo.IO_heart;
commandControl.CurrentTargetPatient.Ex_kidney = vo.IO_kidney;
commandControl.CurrentTargetPatient.Ex_respiration = vo.IO_respiration;
commandControl.CurrentTargetPatient.Ex_hx = vo.IO_hx;
commandControl.CurrentTargetPatient.Ex_allergy = vo.IO_allergy;
commandControl.CurrentTargetPatient.Ex_drug = vo.IO_drug;
commandControl.CurrentTargetPatient.Ex_smoking = vo.IO_smoking;
commandControl.CurrentTargetPatient.Ex_idio = vo.IO_idio;
commandControl.CurrentTargetPatient.Ex_nacrotics = vo.IO_nacrotics;
commandControl.CurrentTargetPatient.Ex_airway = vo.IO_airway;
commandControl.CurrentTargetPatient.Ex_hemorrhage = vo.IO_hemorrhage;
commandControl.CurrentTargetPatient.Ex_status_etc = vo.IO_status_etc;
}
// 진료일 범위 설정
private void SetClnDateItem()
{
Dictionary