using DevExpress.Utils.Design.Internal; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.Grid; using HL_FristAidPlatform_DTO; using HL_FristAidPlatform_FollowUp; using HL_FristAidPlatform_Public; using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Linq; using System.Windows.Forms; namespace HL_FristAidPlatform_Apoplexy { public partial class Form_ApoplexyHighRiskScreening : XtraForm { /// /// 当前页 /// private int curPage = 1; /// /// 每页大小 /// private int pageSize = 20; /// /// 所有记录条数 /// private int totalNumber = 0; private DataTable patientDT = null; DataTable ResultDT = null; //工单下拉选项选中索引 IList rowsIndex = new List(); //定义修改进入验证 bool edit_flag = false; //定义修改进入的工单赋值 string wo_text = ""; public Form_ApoplexyHighRiskScreening() { InitializeComponent(); } private void MyPagerEvents(int curPage, int pageSize) { this.curPage = curPage; this.pageSize = pageSize; FillGridListCtrlQuery(); } public void FillGridListCtrlQuery() { try { string visitType = cmb_visitType.SelectedIndex == -1 ? "" : (cmb_visitType.SelectedIndex + 1).ToString(); string ecg = check_ecg.Checked == true ? "1" : ""; string tcd = check_tcd.Checked == true ? "1" : ""; string laboratory = check_laboratory.Checked == true ? "1" : ""; string cervical = check_cervical.Checked == true ? "1" : ""; string rescreeningStatus = cmb_rescreeningStatus.SelectedIndex == -1 ? "" : (cmb_rescreeningStatus.SelectedIndex + 1).ToString(); string cDepartment = look_cDepartment.Text == "全部" ? "" : look_cDepartment.Text; string cHighRisk = ""; string startTime = time_startTime.TimeValue.ToString() != "" ? Convert.ToDateTime(time_startTime.TimeValue).ToString("yyyy-MM-dd") : ""; string endTime = time_endTime.TimeValue.ToString() != "" ? Convert.ToDateTime(time_endTime.TimeValue).ToString("yyyy-MM-dd") : ""; int highRisk = -1; if (cmb_highRisk.Text == "低危") highRisk = 0; ; if (cmb_highRisk.Text == "高危") highRisk = 1; ; if (cmb_highRisk.Text == "中危") highRisk = 2; ; if (cmb_highRisk.Text == "正常") highRisk = 3; for (int i = 0; i < check_cHighRisk.Properties.Items.ToList().Count(); i++) { if (check_cHighRisk.Properties.Items[i].CheckState == CheckState.Checked) { if (string.IsNullOrEmpty(cHighRisk)) { cHighRisk += check_cHighRisk.Properties.Items[i].Value; } else { cHighRisk += "," + check_cHighRisk.Properties.Items[i].Value; } } } //筛选来院方式 int sourceIndex = com_source.SelectedIndex == -1 ? com_source.SelectedIndex : com_source.SelectedIndex - 1; //筛选人群来源 int categoryIndex = cmb_category.SelectedIndex == -1 ? cmb_category.SelectedIndex : cmb_category.SelectedIndex - 1; string Url = string.Format("api/service/T_Service_ApoplexyScreen/GetScreeninListModel?info={0}&source={1}&category={2}&startTime={3}&endTime={4}&visitType={5}&ecg={6}&tcd={7}&laboratory={8}&cervical={9}&cDepartment={10}&cDoctor={11}&highRisk={12}&cHighRisk={13}&rescreeningStatus={14}&pageIndex={15}&pageSize={16}", txt_info.Text, sourceIndex, categoryIndex, startTime, endTime, visitType, ecg, tcd, laboratory, cervical, cDepartment, txt_cDoctor.Text, highRisk, cHighRisk, rescreeningStatus, curPage, pageSize); patientDT = DBHelpClass.Get(Url); gridControl1.DataSource = patientDT; gridView1.BestFitColumns();//列宽自适应 totalNumber = DBHelpClass.TotalNumber; userControlForPage.RefreshPager(pageSize, totalNumber, curPage);//更新分页控件显示。 } catch (Exception ex) { throw ex; } } public void ExportEvents(bool singlePage)//单页,所有 { //导出GridControl代码写在这。 } private void userControlForPage_exportEvents(bool singlePage) { userControlForPage.exportEvents += ExportEvents; } private void userControlForPage_myPagerEvents(int curPage, int pageSize) { userControlForPage.myPagerEvents += MyPagerEvents; } private void simpleButton1_Click(object sender, EventArgs e) { if (patientDT != null && patientDT.Columns.Count > 0) patientDT.Clear(); FillGridListCtrlQuery(); } private void Form_ApoplexyHighRiskScreening_Load(object sender, EventArgs e) { //string department = string.Format("api/admin/T_SYS_Departments/GetListByHospitalGuid?hospitalGuid={0}", Information.Hospital.GUID); //ResultDT = DBHelpClass.Get(department); //if (ResultDT != null) // PublicClass.SetLookUpList(ref look_cDepartment, ResultDT, 0, 3, true, ""); List list = new List(); list.Add("全部"); List lst = DBHelpClass.GetList(string.Format("api/service/T_Service_ApoplexyScreen/GetScreenDepartment")); if (lst!=null&&lst.Count > 0) list.AddRange(lst); DataTable dt = new DataTable(); if (list.Count > 0) { look_cDepartment.Properties.DataSource = list; } if (patientDT != null && patientDT.Columns.Count > 0) patientDT.Clear(); FillGridListCtrlQuery(); } private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.Column.FieldName == "Gender") { int value = PublicClass.ToInt32(e.Value, -1); switch (value) { case 2: e.DisplayText = "女"; break; case 1: e.DisplayText = "男"; break; } } if (e.Column.FieldName == "VisitType") { string value = e.Value.ToString(); switch (value) { case "1": e.DisplayText = "门诊"; break; case "2": e.DisplayText = "住院"; break; case "3": e.DisplayText = "体检"; break; case "4": e.DisplayText = "其他"; break; } } if (e.Column.FieldName == "Source") { int value = PublicClass.ToInt32(e.Value, -1); switch (value) { case 0: e.DisplayText = "院内"; break; case 1: e.DisplayText = "院外"; break; } } if (e.Column.FieldName == "HighRisk") { int value = PublicClass.ToInt32(e.Value, -1); switch (value) { case 0: e.DisplayText = "低危"; break; case 1: e.DisplayText = "高危"; break; case 2: e.DisplayText = "中危"; break; case 3: e.DisplayText = "正常"; break; } } if (e.Column.FieldName == "Category") { int value = PublicClass.ToInt32(e.Value, -1); switch (value) { case 0: e.DisplayText = "筛查系统"; break; case 1: e.DisplayText = "App"; break; case 2: e.DisplayText = "扫码"; break; } } } private void 打印卒中筛查表ToolStripMenuItem_Click(object sender, EventArgs e) { try { if (gridView1.DataRowCount > 0) { int selectRow = gridView1.GetSelectedRows()[0]; string PatientID = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "ID"), "0"); string Cur_PatientGuid = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "GUID"), ""); if (!string.IsNullOrEmpty(Cur_PatientGuid)) { Print.PrintApoplexyHighRiskScreening(Cur_PatientGuid); } } } catch (Exception ex) { PublicClass.WriteErrorLog(this.Text, "卒中筛查表打印:\r\n" + ex); } } private void simpleButton2_Click(object sender, EventArgs e) { Form_AddApoplexyHighRiskScreening form = new Form_AddApoplexyHighRiskScreening(); form.Owner = this; form.ShowDialog(); } private void 查看知情同意书ToolStripMenuItem_Click(object sender, EventArgs e) { try { if (gridView1.DataRowCount > 0) { int selectRow = gridView1.GetSelectedRows()[0]; string Cur_PatientGuid = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "GUID"), ""); //var selectDT = patientDT.Select("GUID ='" + Cur_PatientGuid + "'"); Form_ApoplexyHighRiskScreening_InformedConsent form_ApoplexyHighRisk = new Form_ApoplexyHighRiskScreening_InformedConsent("", "", "", "", Cur_PatientGuid); form_ApoplexyHighRisk.Show(); } } catch (Exception ex) { PublicClass.WriteErrorLog(this.Text, "查看知情同意书:\r\n" + ex); } } private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.FieldName == "HighRisk") { string HighRisk = gridView1.GetRowCellValue(e.RowHandle, "HighRisk").ToString(); if (HighRisk == "0"|| HighRisk=="3") e.Appearance.ForeColor = Color.FromArgb(25, 190, 107); if (HighRisk == "1") e.Appearance.ForeColor = Color.FromArgb(250, 53, 52); if (HighRisk == "2") e.Appearance.ForeColor = Color.FromArgb(255, 153, 0); } } private void 社区乡镇随访表ToolStripMenuItem_Click(object sender, EventArgs e) { try { if (gridView1.DataRowCount > 0) { int selectRow = gridView1.GetSelectedRows()[0]; string Cur_PatientGuid = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "GUID"), ""); string Name = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Name"), ""); //if (true) //{ // string Idcard = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "IDCard"), ""); //} string age = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Age"), ""); string gender = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Gender"), ""); if (gender == "0") { gender = "未知"; } if (gender == "1") { gender = "男"; } if (gender == "2") { gender = "女"; } Form_CommunityFollowup communityFollowup = new Form_CommunityFollowup(Cur_PatientGuid, Name, age, gender); communityFollowup.Show(); } } catch (Exception ex) { PublicClass.WriteErrorLog(this.Text, "社区乡镇随访表:\r\n" + ex); } } private void 社区乡镇筛查表ToolStripMenuItem_Click(object sender, EventArgs e) { int selectRow = gridView1.GetSelectedRows()[0]; string patientGuid = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "GUID"), ""); string name = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Name"), ""); string age = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Age"), ""); string gender = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Gender"), ""); Form_Screen Screen = new Form_Screen(patientGuid, "1", name, age, gender); Screen.ShowDialog(); } private void 院内综合干预工作量表ToolStripMenuItem_Click(object sender, EventArgs e) { if (gridView1.DataRowCount > 0) { int selectRow = gridView1.GetSelectedRows()[0]; string PatientID = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "ID"), "0"); string Cur_PatientGuid = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "GUID"), ""); string name = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Name"), ""); string age = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Age"), ""); string gender = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Gender"), ""); if (!string.IsNullOrEmpty(Cur_PatientGuid)) { Form_InterventionWorkScale_Hospitalized form_Intervention = new Form_InterventionWorkScale_Hospitalized(Cur_PatientGuid, name, age, gender); form_Intervention.ShowDialog(); } } } private void 社区乡镇干预调查表ToolStripMenuItem_Click(object sender, EventArgs e) { int selectRow = gridView1.GetSelectedRows()[0]; string patientGuid = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "GUID"), ""); string name = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Name"), ""); string age = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Age"), ""); string gender = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Gender"), ""); Form_Intervene Intervene = new Form_Intervene(patientGuid, "2", name, age, gender); Intervene.ShowDialog(); } /// /// 新增健康档案及随访——健康档案和随访 /// /// /// private void 健康档案和随访ToolStripMenuItem_Click(object sender, EventArgs e) { try { if (gridView1.DataRowCount > 0) { int selectRow = gridView1.GetSelectedRows()[0]; string Cur_PatientGuid = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "GUID"), ""); string Name = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Name"), ""); string Age = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Age"), ""); string Gender = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Gender"), ""); string ContactNmber = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "ContactNmber"), ""); string IDCard = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "IDCard"), ""); if (Gender == "1") Gender = "男"; if (Gender == "2") Gender = "女"; string url = string.Format("api/service/T_Service_Apoplexy_FAHBase/GetFAHBaseByPatientGuid?patientGuid={0}", Cur_PatientGuid); T_Service_Apoplexy_FAHBaseDTO temp = DBHelpClass.GetDateModel(url); if (temp == null) { string Url = "api/service/T_Service_Apoplexy_FAHBase/Add"; List list = new List(); T_Service_Apoplexy_FAHBaseDTO fAHBaseDTO = new T_Service_Apoplexy_FAHBaseDTO(); fAHBaseDTO.GUID = Cur_PatientGuid; fAHBaseDTO.PatientGUID = Cur_PatientGuid; list.Add(fAHBaseDTO); ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); ListEntity s = client.Post(Url, list); } Form_FollowUpAndHealthDetail communityFollowup = new Form_FollowUpAndHealthDetail(Cur_PatientGuid, Name, Age, Gender, IDCard, ContactNmber); communityFollowup.Show(); } } catch (Exception ex) { PublicClass.WriteErrorLog(this.Text, "社区乡镇随访表:\r\n" + ex); } } private void simpleButton3_Click_1(object sender, EventArgs e) { if (patientDT != null && patientDT.Columns.Count > 0) patientDT.Clear(); txt_info.Text = ""; com_source.SelectedIndex = -1; cmb_category.SelectedIndex = -1; time_startTime.TimeValue = ""; time_endTime.TimeValue = ""; cmb_visitType.SelectedIndex = -1; look_cDepartment.Text = "全部"; txt_cDoctor.Text = ""; cmb_highRisk.SelectedIndex = -1; cmb_rescreeningStatus.SelectedIndex = -1; for (int i = 0; i < check_cHighRisk.Properties.Items.ToList().Count(); i++) { check_cHighRisk.Properties.Items[i].CheckState = CheckState.Unchecked; } FillGridListCtrlQuery(); } private void check__AdvancedQuery_CheckedChanged(object sender, EventArgs e) { if (check__AdvancedQuery.Checked == true) { panel_AdvancedQuery.Visible = true; } else { panel_AdvancedQuery.Visible = false; } } private void gridView1_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e) { if (e.Info.IsRowIndicator && e.RowHandle >= 0) e.Info.DisplayText = (e.RowHandle + 1).ToString(); } private void panelControl4_Paint(object sender, PaintEventArgs e) { } private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { int selectRow = gridView1.GetSelectedRows()[0]; if (selectRow <= -1) { MessageBox.Show("请先选中一行数据"); return; } string patientGuid = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "GUID"), ""); string name = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Name"), ""); string age = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Age"), ""); string gender = PublicClass.ToString(gridView1.GetRowCellValue(selectRow, "Gender"), ""); switch (e.Button.Caption) { case "初筛": Form_InitialScreening initialScreening = new Form_InitialScreening(patientGuid, name, gender, age); initialScreening.ShowDialog(); break; case "复筛": Form_Screen Screen = new Form_Screen(patientGuid, "1", name, age, gender); // Screen.WindowState = FormWindowState.Maximized; Screen.ShowDialog(); break; } } } }