123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500 |
- #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;
- using System.Linq;
- namespace CLIP.eForm.Consent.UI {
- /// <summary>
- /// 동의서 조회 컨트롤의 환자 정보 탭 클래스
- /// </summary>
- /// <remarks>
- /// <p>[설계자]</p>
- /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
- /// <p>[원본 작성자]</p>
- /// <p> 클립소프트 기술부 이창훈 (chlee@clipsoft.co.kr)</p>
- /// <p>[수정 작성자]</p>
- /// <p> 클립소프트 기술부 이인희</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// <p>[HISTORY]</p>
- /// <p> 2016-06-21 : 최초작성</p>
- /// <p>----------------------------------------------------------------------------------------</p>
- /// </remarks>
- 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["userId"]
- , 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.userId = this.labelUserNo.Text = consentMain.ConsentExecuteInfo["userId"];
- commandControl.CurrentEndUser.userName = this.labelUserNm.Text = consentMain.ConsentExecuteInfo["userName"];
- commandControl.CurrentEndUser.Password = "";
- commandControl.CurrentEndUser.deptcd = consentMain.ConsentExecuteInfo["userDeptCd"];
- commandControl.CurrentEndUser.supportDeptcd = consentMain.ConsentExecuteInfo["userSupportDeptCd"];
- commandControl.CurrentEndUser.supportBaseCd = consentMain.ConsentExecuteInfo["supportBaseCd"];
- commandControl.CurrentEndUser.depthngnm = this.labelUserDept.Text = consentMain.ConsentExecuteInfo["userDeptName"];
- //commandControl.CurrentEndUser.UserGroupCode = "";
- commandControl.CurrentEndUser.instcd = consentMain.ConsentExecuteInfo["dutinstcd"];
- commandControl.CurrentEndUser.userTelNo = "";
- commandControl.CurrentEndUser.jobkindcd = userVO.jobKindCd;
- commandControl.CurrentEndUser.jobkindnm = userVO.jobKindNm;
- commandControl.CurrentEndUser.drkind = userVO.drKind;
- } else {
- string _msg = string.Format("[{0}] 에 해당하는 의사정보가 없습니다.", userid);
- MessageBox.Show(_msg);
- throw new Exception(_msg);
- }
- } else {
- commandControl.CurrentEndUser = new EndUser();
- commandControl.CurrentEndUser.userId = this.labelUserNo.Text = userVO.userId;
- commandControl.CurrentEndUser.userName = this.labelUserNm.Text = userVO.userName;
- commandControl.CurrentEndUser.deptcd = userVO.userDeptcd;
- commandControl.CurrentEndUser.supportDeptcd = userVO.userSupportDeptCd;
- commandControl.CurrentEndUser.supportBaseCd = userVO.userSupportBaseCd;
- commandControl.CurrentEndUser.depthngnm = this.labelUserDept.Text = userVO.userDepthngnm;
- //commandControl.CurrentEndUser.UserGroupCode = userVO.UserGroupCode;
- //commandControl.CurrentEndUser.supportBaseCd = userVO.;
- commandControl.CurrentEndUser.instcd = consentMain.ConsentExecuteInfo["dutinstcd"];
- commandControl.CurrentEndUser.userTelNo = userVO.userTelNo;
- commandControl.CurrentEndUser.jobkindcd = userVO.jobKindCd;
- commandControl.CurrentEndUser.jobkindnm = userVO.jobKindNm;
- commandControl.CurrentEndUser.ioflag = userVO.ioFlag ?? "";
- commandControl.CurrentEndUser.drkind = userVO.drKind;
- consentMain.ConsentExecuteInfo["userIOFlag"] = commandControl.CurrentEndUser.ioflag;
- }
- }
- // 환자 정보 셋팅
- private void SetPatientBasicInfo(IConsentMain consentMain) {
- PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(consentMain.ConsentExecuteInfo["patientId"]
- , consentMain.ConsentExecuteInfo["patientClnDate"]
- , consentMain.ConsentExecuteInfo["patientOrdtype"]
- , consentMain.ConsentExecuteInfo["patientClnDept"]
- , 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);
- }
- }
- /// <summary>
- /// PatientVO 정보를 이용해서 CurrentTargetPatient 정보 SET
- /// </summary>
- /// <param name="vo">설정할 PatientVO 클래스의 인스턴스</param>
- private void SetTargetPatientInfo(PatientVO vo) {
- var ordtypeHngnm = "";
- if (!string.IsNullOrEmpty(vo.ordType)) {
- switch (vo.ordType) {
- case "I":
- ordtypeHngnm = "입원";
- break;
- case "O":
- ordtypeHngnm = "외래";
- break;
- case "E":
- ordtypeHngnm = "응급";
- break;
- case "OP":
- ordtypeHngnm = "수술";
- break;
- }
- }
- // TODO 검증 필요
- commandControl.CurrentTargetPatient.instcd = consentMain.ConsentExecuteInfo["dutinstcd"];
- commandControl.CurrentTargetPatient.name = vo.patientName;
- commandControl.CurrentTargetPatient.pid = vo.pid;
- commandControl.CurrentTargetPatient.sa = vo.sa;
- commandControl.CurrentTargetPatient.jumin = vo.juminNo;
- commandControl.CurrentTargetPatient.birthDd = vo.patientBirthDd;
- commandControl.CurrentTargetPatient.ordtype = vo.ordType;
- commandControl.CurrentTargetPatient.ordtypeHngnm = ordtypeHngnm;
- commandControl.CurrentTargetPatient.cretno = vo.cretNo.ToString();
- commandControl.CurrentTargetPatient.Dschdd = vo.dSchDd.Replace("-", "").Replace("/", "");
- commandControl.CurrentTargetPatient.clnDate = vo.inDd.Replace("-", "").Replace("/", "");
- commandControl.CurrentTargetPatient.clnDeptEngNm = vo.deptEngNm;
- commandControl.CurrentTargetPatient.clnDeptCode = vo.ordDeptCd;
- commandControl.CurrentTargetPatient.clnDeptName = vo.deptNm;
- commandControl.CurrentTargetPatient.clnDxNm = vo.diagHngNm;
- commandControl.CurrentTargetPatient.mainDrId = vo.mainDrId;
- commandControl.CurrentTargetPatient.mainDrNm = vo.mainDrNm;
- commandControl.CurrentTargetPatient.ward = vo.ward;
- commandControl.CurrentTargetPatient.roomno = vo.roomCd;
- //commandControl.CurrentTargetPatient.orderno = vo.IO_OrderNo;
- commandControl.CurrentTargetPatient.opDrId = vo.opDoctorId;
- commandControl.CurrentTargetPatient.opDrNm = vo.opDoctorNm;
- commandControl.CurrentTargetPatient.opDeptCd = vo.opDeptCd;
- commandControl.CurrentTargetPatient.opDeptNm = vo.opDeptNm;
- commandControl.CurrentTargetPatient.addr = vo.patientAddr;
- commandControl.CurrentTargetPatient.telno = vo.patientMobileNo;
- //commandControl.CurrentTargetPatient.Insukind = vo.IO_Insukind;
- // 수술 정보
- commandControl.CurrentTargetPatient.OpRsrvNo = vo.opRsrvNo;
- commandControl.CurrentTargetPatient.OpCnfmDate = vo.opCnFmDd;
- commandControl.CurrentTargetPatient.OpName = vo.opNm;
- commandControl.CurrentTargetPatient.OpremFact = vo.opremFact;
-
- /// TODO 필요시 구현 구현
- //commandControl.CurrentTargetPatient.OpDiagName = vo.OpDiagName;
- //commandControl.CurrentTargetPatient.OpName = vo.OpName;
- //commandControl.CurrentTargetPatient.AnstDrName1 = vo.AnstDrName1;
- //commandControl.CurrentTargetPatient.AnstDrFlag1 = vo.AnstDrFlag1;
- //commandControl.CurrentTargetPatient.AnstDeptName1 = vo.AnstDeptName1;
- //commandControl.CurrentTargetPatient.AnstDrName2 = vo.AnstDrName2;
- //commandControl.CurrentTargetPatient.AnstDrFlag2 = vo.AnstDrFlag2;
- //commandControl.CurrentTargetPatient.AnstDeptName2 = vo.AnstDeptName2;
- //commandControl.CurrentTargetPatient.AnstDrName3 = vo.AnstDrName3;
- //commandControl.CurrentTargetPatient.AnstDrFlag3 = vo.AnstDrFlag3;
- //commandControl.CurrentTargetPatient.AnstDeptName3 = vo.AnstDeptName3;
- }
- /// <summary>
- /// 진료일 범위 설정
- /// </summary>
- private void SetClnDateItem() {
- Dictionary<string, string> comboItems = new Dictionary<string, string>();
- 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";
- }
- /// <summary>
- /// 진료일 범위 선택했을때, 해당하는 진료일 조회하여 바인딩
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void comboTrmtPrd_SelectedIndexChanged(object sender, EventArgs e) {
- Dictionary<string, string> comboItems = new Dictionary<string, string>();
- if (comboTrmtPrd.SelectedIndex == 0) {
- //초기 넘겨준 특정 진료일을 바인딩
- comboItems = GetClnDateSearchList(commandControl.CurrentTargetPatient.pid
- , commandControl.CurrentTargetPatient.clnDate
- , "="
- , commandControl.CurrentTargetPatient.clnDeptCode);
- } else {
- //진료일 범위에 해당하는 진료일자 조회하여 바인딩
- comboItems = GetClnDateSearchList(commandControl.CurrentTargetPatient.pid
- , comboTrmtPrd.SelectedValue.ToString()
- , ">="
- , commandControl.CurrentTargetPatient.clnDeptCode);
- }
- if (comboItems.Count > 0) {
- comboTrmtDate.DataSource = new BindingSource(comboItems, null);
- comboTrmtDate.DisplayMember = "Key";
- comboTrmtDate.ValueMember = "Value";
- comboTrmtDate.Tag = consentMain.ConsentExecuteInfo["patientId"];
- if (comboTrmtDate.Items.Count > 0) {
- if (comboTrmtDate.SelectedIndex == 0) { }
- //GetTrmtInfo();
- else
- comboTrmtDate.SelectedIndex = 0;
- }
- } else {
- comboTrmtDate.DataSource = null;
- }
- }
- /// <summary>
- /// 검색된 진료일 값을 컨트롤에 바인딩
- /// </summary>
- /// <param name="patientNo">환자번호</param>
- /// <param name="clnDate">진료일자</param>
- /// <param name="searchType">검색일자</param>
- /// <param name="orddeptcd">진단부서</param>
- /// <returns></returns>
- private Dictionary<string, string> GetClnDateSearchList(string patientNo, string clnDate, string searchType, string orddeptcd) {
- Dictionary<string, string> comboDates = new Dictionary<string, string>();
- // 환자의 주진단 정보를 조회
- ClnDateForDropdownVO[] clnDateList = this.hospitalWebService.GetTrmtDateList(patientNo
- , clnDate
- , searchType
- , orddeptcd
- , consentMain.ConsentExecuteInfo["dutinstcd"]
- , consentMain.ConsentExecuteInfo["patientOrdtype"]);
- if (clnDateList != null && clnDateList.Length > 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));
- }
- }
- return comboDates;
- }
- private void comboTrmtDate_SelectedIndexChanged(object sender, EventArgs e) {
- GetTrmtInfo();
- }
- /// <summary>
- /// 환자 선택시 수진일자별 진단 데이터 조회하여 환자명과 내원번호를 설정하고
- /// 현재 선택된 한자로 설정한다
- /// </summary>
- /// <exception cref="UserException"></exception>
- private void GetTrmtInfo() {
- //수진일자를 변경했을때 환자의 주진단 정보를 재조회한다.
- if (commandControl.CurrentTargetPatient != null && comboTrmtDate.SelectedItem != null) {
- string[] clnDate = ((KeyValuePair<string, string>) comboTrmtDate.SelectedItem).Value.Split('/');
- if (clnDate != null && clnDate.Length == 5) {
- // 환자 선택시 수진일자별 진단 데이터 조회
- PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(consentMain.ConsentExecuteInfo["patientId"]
- , 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["patientId"]));
- } else {
- PatientVO vo = patientVOList[0];
- // 환자명과 내원번호 설정
- this.labelPtntNm.Text = vo.patientName;
- this.labelPtntNo.Text = vo.pid;
- //현재 선택된 환자로 설정
- commandControl.CurrentTargetPatient = new TargetPatient();
- SetTargetPatientInfo(vo);
- }
- }
- }
- }
- /// <summary>
- /// 환자목록에서 더블클릭했을 경우, 선택된 환자 정보로 상단정보를 재조회한다.
- /// </summary>
- /// <param name="visitType">방문 타입</param>
- 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();
- }
- }
- /// <summary>
- /// 동의서명을 설정
- /// </summary>
- /// <param name="documentName">Name of the document.</param>
- public override void SetConsentDocumentName(string documentName) {
- this.labelDocName.Text = documentName;
- }
- /// <summary>
- /// 작성자 정보를 설정
- /// </summary>
- /// <param name="userid">The userid.</param>
- /// <param name="dutinstcd">The dutinstcd.</param>
- /// <param name="dutplcecd">The dutplcecd.</param>
- public override void SetConsentUserInfo(string userid, string dutinstcd, string dutplcecd) {
- ConsentCommandCtrl commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
- GetUserDetailInfo(userid, dutinstcd, dutplcecd, commandControl);
- }
- /// <summary>
- /// 상단의 진료일과 작성자 정보로 설정 (수진일자를 변경했을때 환자의 주진단 정보를 재조회한다.)
- /// </summary>
- /// <exception cref="UserException"></exception>
- public override void SetBasicPatientInfo() {
- if (commandControl.CurrentTargetPatient != null && comboTrmtDate.SelectedValue != null) {
- string[] clnDate = ((KeyValuePair<string, string>) comboTrmtDate.SelectedItem).Value.Split('/');
- if (clnDate != null && clnDate.Length == 4) {
- PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(consentMain.ConsentExecuteInfo["patientId"]
- , 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["patientId"]));
- } else {
- PatientVO vo = patientVOList[0];
- commandControl.CurrentTargetPatient = new TargetPatient();
- SetTargetPatientInfo(vo);
- }
- }
- }
- }
- /// <summary>
- /// 동의서 정보로 환자 주진단 정보 설정 (ConsentVO 데이터로 PatientVO 조회)
- /// </summary>
- /// <param name="orderDate">The order date.</param>
- /// <param name="orderType">Type of the order.</param>
- /// <param name="orderDeptCd">The order dept cd.</param>
- /// <param name="cretno">The cretno.</param>
- /// <exception cref="UserException"></exception>
- public override void SetPatientByConsentInfo(string orderDate, string orderType, string orderDeptCd, string cretno) {
- PatientVO[] patientVOList = this.hospitalWebService.GetPatientInfo(commandControl.CurrentTargetPatient.pid
- , 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["patientId"]));
- } else {
- PatientVO vo = patientVOList[0];
- commandControl.CurrentTargetPatient = new TargetPatient();
- SetTargetPatientInfo(vo);
- }
- }
- }
- }
|