/// [설계자]
/// 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)
/// [원본 작성자]
/// 클립소프트 기술부 4팀 이창훈 (chlee@clipsoft.co.kr)
/// [수정 작성자]
/// 클립소프트 기술부 이인희
/// ----------------------------------------------------------------------------------------
/// [HISTORY]
/// 2016-06-28 : 최초작성
/// ----------------------------------------------------------------------------------------
///
public partial class ConsentSelectTabPageConsentSet : UserControl
{
private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
private IConsentMain consentMain = null;
private ConsentCommandCtrl commandControl = null;
public ConsentSelectTabPageConsentSet()
{
InitializeComponent();
}
private void ConsentSelectTabPageConsentSet_Load(object sender, EventArgs e)
{
if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
{
return;
}
consentMain = ConsentMainControl.GetConsentMainInterface(this);
commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
if (commandControl.CurrentEndUser != null)
{
InitConsentSetTreeView();
}
}
// 트리 노드 생성 (개인 SET)
public void InitConsentSetTreeView()
{
//개인SET과 진료과SET인 경우
//ConsentSetVO[] arrayData = this.hospitalWebService.GetConsentSetList(commandControl.CurrentEndUser.UserNo,
// commandControl.CurrentEndUser.DeptCode);
ConsentSetVO[] arrayData = this.hospitalWebService.GetConsentSetList(commandControl.CurrentEndUser.UserNo);
this.treeViewConsentSet.Nodes.Clear();
TreeNode personalTreeNode = AddFirstChildNodeOfTreeView("PERS", "개인 SET", 1);
//TreeNode deptTreeNode = AddFirstChildNodeOfTreeView("DEPT", "진료과 SET", 2);
if (arrayData != null)
{
foreach (ConsentSetVO vo in arrayData)
{
if (vo.SetAuth.Equals("PERS_SET"))
{
AddConsentNode(personalTreeNode, vo);
}
//else if (vo.SetAuth.Equals("DEPT_SET"))
//{
// AddDeptsConsentSet(vo);
//}
}
}
this.treeViewConsentSet.Nodes["PERS"].ExpandAll();
//this.treeViewConsentSet.Nodes["DEPT"].Expand();
//사용자의 부서에 해당하는 동의서들만 펼친다.
//if (this.treeViewConsentSet.Nodes["DEPT"].Nodes.ContainsKey(commandControl.CurrentEndUser.DeptCode))
//{
// this.treeViewConsentSet.Nodes["DEPT"].Nodes[commandControl.CurrentEndUser.DeptCode].ExpandAll();
//}
}
// 동의서 미리보기
private void ExecutePreviewWithSelectedConsent()
{
ConsentSetVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentSetVO;
if (vo == null)
{
return;
}
if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
consentMain.preParamClean();
PatientInfoCtrl patient = consentMain.PatientInfoCtrl as PatientInfoCtrl;
Cursor currentCursor = this.Cursor;
this.Cursor = Cursors.WaitCursor;
commandControl.CurrentPreviewConsent = new PreviewConsent();
commandControl.CurrentPreviewConsent.FormRid = vo.FormRid.ToString();
commandControl.CurrentPreviewConsent.FormGuid = vo.FormGuid;
commandControl.CurrentPreviewConsent.FormCd = vo.FormCd.ToString();
commandControl.CurrentPreviewConsent.FormName = vo.FormName;
commandControl.CurrentPreviewConsent.PrntCnt = vo.PrntCnt;
commandControl.CurrentPreviewConsent.ConsentMstRid = "-1";
commandControl.CurrentPreviewConsent.ConsentState = string.Empty;
if (commandControl.CurrentTargetPatient.VisitType.Equals("I") || commandControl.CurrentTargetPatient.VisitType.Equals("E"))
{
commandControl.CurrentPreviewConsent.InputId = commandControl.CurrentTargetPatient.MainDrId;
commandControl.CurrentPreviewConsent.InputNm = commandControl.CurrentTargetPatient.MainDrNm;
}
else
{
commandControl.CurrentPreviewConsent.InputId = commandControl.CurrentTargetPatient.MainDrId = commandControl.CurrentEndUser.UserNo;
commandControl.CurrentPreviewConsent.InputNm = commandControl.CurrentTargetPatient.MainDrNm = commandControl.CurrentEndUser.UserName;
}
commandControl.CurrentPreviewConsent.ReissueConsentMstRid = 0;
commandControl.CurrentPreviewConsent.RewriteConsentMstRid = 0;
commandControl.CurrentPreviewConsent.Ocrtagprntyn = vo.OcrTagYN;
commandControl.CurrentPreviewConsent.PrintOnly = vo.PrintOnly;
//동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다.
consentMain.PatientInfoCtrl.SetBasicPatientInfo();
consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.FormName);
commandControl.PreviewConsent(consentMain);
this.Cursor = currentCursor;
}
#region 트리 노드 추가
private TreeNode AddFirstChildNodeOfTreeView(string treeNodeName, string treeNodeLabel, int imageIndex)
{
TreeNode parentNode = new TreeNode(treeNodeLabel);
parentNode.Name = treeNodeName;
parentNode.ImageIndex = imageIndex;
parentNode.SelectedImageIndex = imageIndex;
this.treeViewConsentSet.Nodes.Add(parentNode);
return parentNode;
}
private void AddConsentNode(TreeNode parentTreeNode, ConsentSetVO consentSet)
{
TreeNode childTreeNode = new TreeNode();
childTreeNode.Text = consentSet.FormName; // + "[" + consentSet.FormCd + "]";
childTreeNode.ImageIndex = 0;
childTreeNode.SelectedImageIndex = 0;
childTreeNode.Tag = consentSet;
parentTreeNode.Nodes.Add(childTreeNode);
ContextMenuStrip strip = new ContextMenuStrip();
ToolStripMenuItem setItemDelete = new ToolStripMenuItem();
setItemDelete.Text = "즐겨찾기 삭제";
strip.Items.Add(setItemDelete);
setItemDelete.Click += new EventHandler(setItemDelete_Click);
childTreeNode.ContextMenuStrip = strip;
}
/*
private void AddDeptsConsentSet(ConsentSetVO vo)
{
TreeNode deptNode = this.treeViewConsentSet.Nodes["DEPT"];
if (deptNode.Nodes.ContainsKey(vo.DeptCd))
{
AddConsentNode(deptNode.Nodes[vo.DeptCd], vo);
}
else
{
//해당 부서코드 노드를 생성 한다.
TreeNode deptSubNode = new TreeNode(vo.DeptNm);
deptSubNode.Name = vo.DeptCd;
deptSubNode.ImageIndex = 3;
deptSubNode.SelectedImageIndex = 3;
deptNode.Nodes.Add(deptSubNode);
//부서코드 노드에 동의서들을 추가한다.
AddConsentNode(deptSubNode, vo);
}
}
*/
#endregion
#region 트리 컨트롤 이벤트
private void treeViewConsentSet_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (this.treeViewConsentSet.SelectedNode.Tag != null)
{
IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
if (consentMain.ConsentExecuteInfo["patientNo"].Equals(""))
{
MessageBox.Show(this, "환자를 먼저 선택하세요.", string.Format(Properties.Resources.msg_caption_confirm),MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
ExecutePreviewWithSelectedConsent();
RunConsentDualView();
}
/*
ConsentSetVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentSetVO;
if (vo != null)
{
RunConsentDualView();
}
*/
}
}
// 트리 노드 선택해서 SET 삭제
private void setItemDelete_Click(object sender, EventArgs e)
{
ConsentSetVO vo = this.treeViewConsentSet.SelectedNode.Tag as ConsentSetVO;
if (vo == null)
{
return;
}
IConsentMain consentMain = ConsentMainControl.GetConsentMainInterface(this);
Cursor currentCursor = this.Cursor;
try
{
this.Cursor = Cursors.WaitCursor;
// 동의서 SET에 추가하는 웹서비스 콜
hospitalWebService.DelUserFormSetList(commandControl.CurrentEndUser.UserNo, vo.FormCd);
this.Cursor = currentCursor;
MessageBox.Show(string.Format(Properties.Resources.msg_consent_set_deleted)
, string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
this.Cursor = currentCursor;
throw ex;
}
finally
{
InitConsentSetTreeView();
}
}
private void RunConsentDualView()
{
if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
commandControl.RunConsentDualView();
}
#endregion
}
}