using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CLIP.eForm.Consent.UI.HospitalSvcRef;
namespace CLIP.eForm.Consent.UI {
public partial class PatientSelectTabExam : UserControl {
private IConsentMain consentMain = null;
private ConsentCommandCtrl commandControl = null;
private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
private string userSelectedBaseCds = string.Empty;
public PatientSelectTabExam() {
InitializeComponent();
}
///
/// UserControl 페이지 로드 이벤트
///
///
///
private void PatientSelectTabExam_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"]);
// todt 를 오늘 날자로 설정
this.todt.Value = DateTime.Now;
this.fromdt.Value = DateTime.Now;
initGrid();
}
private void initGrid() {
this.gridPatientList.AutoGenerateColumns = false;
this.gridPatientList.AllowUserToAddRows = false;
CommonUtil.AddNewColumnToDataGridView(this.gridPatientList, "등록번호", "pid", true, 80);
CommonUtil.AddNewColumnToDataGridView(this.gridPatientList, "성명", "hngnm", true, 60);
CommonUtil.AddNewColumnToDataGridView(this.gridPatientList, "진료/입원일", "indd", true, 100);
CommonUtil.AddNewColumnToDataGridView(this.gridPatientList, "진료과", "deptnm", true, 100);
CommonUtil.AddNewColumnToDataGridView(this.gridPatientList, "진료의", "doctornm", true, 80);
CommonUtil.AddNewColumnToDataGridView(this.gridPatientList, "ER접수과", "erorddeptnm", false, 100);
CommonUtil.AddNewColumnToDataGridView(this.gridPatientList, "ER진료의", "ermedispclnm", false, 80);
//dataGridViewPatientSelectResult.Columns["colCheck"].Visible = false;
}
///
/// 지원부서설정 버튼 클릭 이벤트
/// 팝업창을 호출하여 사용자가 선택한 지원부서를 저장한다.
///
///
///
private void setSupportDepts_Click(object sender, EventArgs e) {
// 지원부서설정 폼 호출
using(var supportDeptsForm = new SetSupportDeptsForm(consentMain.ConsentExecuteInfo["dutinstcd"],
commandControl.CurrentEndUser.userId,
commandControl.CurrentEndUser.supportDeptcd,
commandControl.CurrentEndUser.supportBaseCd,
consentMain.ConsentExecuteInfo["sysInstNm"])) {
var result = supportDeptsForm.ShowDialog();
if(result == DialogResult.OK) {
// 사용자가 저장한 지원부서 목록을 설정
commandControl.CurrentEndUser.supportBaseCd = supportDeptsForm.supportBaseCd;
commandControl.CurrentEndUser.supportDeptcd = supportDeptsForm.supportDeptCd;
}
}
}
public Hashtable getQueryString() {
//var result = new {
// fromdd = dateTimePickerClnDate.Value.ToString("yyyyMMdd"),
// wardcd = (this.comboWard.Items.Count > 0) ? this.comboWard.SelectedValue.ToString().Trim() : "",
// deptcd = (this.comboDept.Items.Count > 0) ? this.comboDept.SelectedValue.ToString().Trim() : "",
// doctorId = (this.comboDoctor.Items.Count > 0) ? this.comboDoctor.SelectedValue.ToString().Trim() : ""
//};
string fromdt = this.fromdt.Value.ToString("yyyyMMdd");
string todt = this.todt.Value.ToString("yyyyMMdd");
string pid = this.txtBoxPid.Text;
string mainDr = this.mainDr.Text;
string strGubun = "";
string mainDrChecked = "Y";
string supportBaseCd = commandControl.CurrentEndUser.supportBaseCd;
string supportDeptcd = commandControl.CurrentEndUser.supportDeptcd;
if (this.radioGubunAll.Checked) {
strGubun = "";
} else {
RadioButton rdoTemp = null;
if (this.radioGubunOut.Checked) {
rdoTemp = radioGubunOut;
} else if (this.radioGubunIn.Checked) {
rdoTemp = radioGubunIn;
} else if (this.radioGubunEx.Checked) {
rdoTemp = radioGubunEx;
}
strGubun = rdoTemp.Tag.ToString();
}
if (this.chkIsMainD.Checked == true) {
// 대가대 요청사항
mainDrChecked = "N";
}
Hashtable result = new Hashtable();
result.Add("pid", pid);
result.Add("srchDd", fromdt);
result.Add("toDd", todt);
result.Add("mainDr", mainDr);
result.Add("mainDrChecked", mainDrChecked);
result.Add("supportBaseCd", supportBaseCd);
result.Add("supportDeptCd", supportDeptcd);
result.Add("patientState", strGubun);
result.Add("ordType", "EX");
return result;
}
///
/// 키보드 입력
///
///
///
private void textBoxSearchText_KeyDown(object sender, KeyEventArgs e) {
if (e.KeyCode == Keys.Enter) {
buttonPatientSelect.PerformClick();
}
}
private string getSelectedPatientState() {
RadioButton rdoTemp = null;
if (this.radioGubunAll.Checked) {
rdoTemp = radioGubunAll;
}
else if (this.radioGubunIn.Checked) {
rdoTemp = radioGubunIn;
} else if (this.radioGubunOut.Checked) {
rdoTemp = radioGubunOut;
} else if (this.radioGubunEx.Checked) {
rdoTemp = radioGubunEx;
}
return rdoTemp.Tag.ToString();
}
///
/// 검사실 환자 목록 조회
///
///
///
private void buttonPatientSelect_Click(object sender, EventArgs e) {
var pid = this.txtBoxPid.Text.Trim();
var patientState = getSelectedPatientState();
var maindDrStr = this.mainDr.Text.Trim();
var isMaindD = this.chkIsMainD.Checked; // true 면 cnfmmaind, false 면 cnfmmaind2 비교
var isMaindDParam = "Y";
if (isMaindD) {
isMaindDParam = "N";
}
Cursor currentCursor = this.Cursor;
this.Cursor = Cursors.WaitCursor;
PatListVO[] patlistVos = null;
try {
patlistVos = hospitalWebService.GetPatientExListPC("EX",
this.todt.Value.ToString("yyyyMMdd"),
this.fromdt.Value.ToString("yyyyMMdd"),
commandControl.CurrentEndUser.supportBaseCd,
commandControl.CurrentEndUser.supportDeptcd,
pid,
patientState,
isMaindDParam,
maindDrStr
);
}
catch(Exception ex) {
}
finally {
this.Cursor = currentCursor;
}
if (patlistVos == null) {
return;
}
this.gridPatientList.DataSource = new SortableBindingList(patlistVos);
}
///
/// 환자를 선택 시 CurrentTargetPatient 로 설정해 준다
///
///
///
private void gridPatientList_CellContentClick(object sender, DataGridViewCellEventArgs e) {
if (e.RowIndex > -1) {
PatListVO vo = this.gridPatientList.Rows[e.RowIndex].DataBoundItem as PatListVO;
consentMain.PatientListCtrl.SetChangePID(vo);
}
}
}
}