StableVersion4.3/HL_GetHISTool/GetHISForm.cs

237 lines
12 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
namespace HL_GetHISTool
{
public partial class GetHISForm : Form
{
public GetHISForm()
{
InitializeComponent();
}
/// <summary>
/// 当前患者编号
/// </summary>
public string Cur_PatientGuid = string.Empty;
/// <summary>
/// 保存信息后患者所属系统模块编号(修改和新增)
/// </summary>
public long Cur_PatientSystemModuleID = 0;
#region config文件配置方法
//private string conn = ConfigurationManager.AppSettings["StrCon"];//数据库连接字符串
//private string querySql = ConfigurationManager.AppSettings["QuerySQL"];//数据库查询语句
//private void modif_Button_Click(object sender, EventArgs e)
//{
// query_textEdit.ReadOnly = false;
// connect_textEdit.ReadOnly = false;
// connect_textEdit.Text = conn;
// query_textEdit.Text = querySql;
//}
//private void save_Button_Click(object sender, EventArgs e)
//{
// Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// config.AppSettings.Settings["QuerySQL"].Value = query_textEdit.Text;
// config.AppSettings.Settings["StrCon"].Value = connect_textEdit.Text;
// config.Save(ConfigurationSaveMode.Modified);
// ConfigurationManager.RefreshSection("appSettings");
// query_textEdit.ReadOnly = true;
// connect_textEdit.ReadOnly = true;
//}
#endregion
private void query_Button_Click(object sender, EventArgs e)
{
string sqlText =string.Format(PublicClassForDataBase.Config118, start_Time.Text, end_Time.Text, key_textEdit.Text);
SqlDBHelper sqlDBHelper = new SqlDBHelper();
DataTable dt=sqlDBHelper.GetDT(sqlText, PublicClassForDataBase.Config117);
HIS_gridControl.DataSource = dt;
}
private void GetHISForm_Load(object sender, EventArgs e)
{
start_Time.Text =DateTime.Now.AddDays(-5).ToShortDateString();
end_Time.Text= DateTime.Now.ToShortDateString();
}
private void simpleButton_Add_Click(object sender, EventArgs e)
{
#region 院前急救模式添加患者
//try
//{
// string Url = "/api/admin/AddFromApp";
// List<Interface_T_Service_PatientModel> interface_T_Service_PatientModels = new List<Interface_T_Service_PatientModel>();
// Interface_T_Service_PatientModel interface_T_Service_PatientModel = new Interface_T_Service_PatientModel();
// int selectRow = gridView1.GetSelectedRows()[0];
// interface_T_Service_PatientModel.Age = Convert.ToInt32(gridView1.GetRowCellValue(selectRow, Age).ToString());
// interface_T_Service_PatientModel.Name = gridView1.GetRowCellValue(selectRow, P_Name).ToString();
// interface_T_Service_PatientModel.Note = gridView1.GetRowCellValue(selectRow, Note).ToString();
// interface_T_Service_PatientModel.MobilePhone = gridView1.GetRowCellValue(selectRow, MobilePhone).ToString();
// interface_T_Service_PatientModel.IdentityCard = gridView1.GetRowCellValue(selectRow, IdentityCard).ToString();
// interface_T_Service_PatientModel.Gender = Convert.ToInt32(gridView1.GetRowCellValue(selectRow, Gender).ToString());
// interface_T_Service_PatientModel.GUID = Guid.NewGuid().ToString();
// interface_T_Service_PatientModel.HospitalGuid = Information.Hospital.GUID.ToString();
// interface_T_Service_PatientModel.Attack_Address = gridView1.GetRowCellValue(selectRow, Attack_Address).ToString();
// interface_T_Service_PatientModels.Add(interface_T_Service_PatientModel);
// //初始化两个工厂
// ClientFactory<Interface_T_Service_PatientModel> httpClient = new HttpClientFactory<Interface_T_Service_PatientModel>();
// Client<Interface_T_Service_PatientModel> client = httpClient.VisitFactory();
// //访问
// ListEntity<Interface_T_Service_PatientModel> t = client.Post(Url, interface_T_Service_PatientModels);
//}
//catch (Exception)
//{
// throw;
//}
#endregion
#region 院内模式添加患者
try
{
#region 保存信息
string Url = string.Empty;
int selectRow = gridView1.GetSelectedRows()[0];
#region 保存患者信息
List<T_Service_PatientDTO> list_Patient = new List<T_Service_PatientDTO>();
T_Service_PatientDTO model_Patient = new T_Service_PatientDTO();
Url = "api/service/T_Service_Patient/AddNotNullColumns";
Cur_PatientGuid = Guid.NewGuid().ToString();
model_Patient.GUID = Cur_PatientGuid;
model_Patient.HospitalGuid = Information.Hospital.GUID;
model_Patient.DeleteFlag = 0;
model_Patient.CreatorID = Information.User.ID;
model_Patient.Creator = Information.User.FullName;
model_Patient.CreationDate = PublicClass.DateTimeNow();
//档案归属日期
model_Patient.RegisterTime = PublicClass.DateTimeNow();
//绕行方式 1:未绕行 2:单绕 3:双绕 4:三绕
model_Patient.IsGreenChannel = (int)Enumerate.CircumferenceMode.;
//是否上传到胸痛数据平台1是0否
model_Patient.CCPC_State = 0;
//填报状态
model_Patient.Status = 1;
//所属模块ID
Cur_PatientSystemModuleID = model_Patient.SystemModuleID = Information.SystemModuleInfo.ID;
//人员种类0正常,1三无人员
model_Patient.Category = 0;
//真实姓名
string PatientName = gridView1.GetRowCellValue(selectRow, P_Name).ToString();
model_Patient.Name = PatientName;
//拼音码
model_Patient.PymCode = SpellAndWbConfig.GetSpellCode(PatientName);
//五笔码
model_Patient.WbmCode = SpellAndWbConfig.GetWBCode(PatientName);
//性别
model_Patient.Gender = gridView1.GetRowCellValue(selectRow, Gender).ToString() == "男" ? 1 : 2;
//年龄
model_Patient.Age = Convert.ToInt32(gridView1.GetRowCellValue(selectRow, Age)+"");
//年龄单位
model_Patient.Age_Unit = "岁";
//民族
string Nation = "-1";
model_Patient.Nation = Nation == "-1" ? "" : Nation;
//移动电话
model_Patient.MobilePhone = gridView1.GetRowCellValue(selectRow, MobilePhone).ToString();
//身份证类别
model_Patient.Credentials_Type = "1";
//身份证号码
model_Patient.IdentityCard = gridView1.GetRowCellValue(selectRow, IdentityCard).ToString();
//联系地址
model_Patient.Address = gridView1.GetRowCellValue(selectRow, Attack_Address).ToString();
//发病地址
model_Patient.Attack_Address = gridView1.GetRowCellValue(selectRow, Attack_Address).ToString();
//出生日期
model_Patient.Birthday = "";
//备注
model_Patient.Note = gridView1.GetRowCellValue(selectRow, Note).ToString();
//紧急联系人
model_Patient.EmergencyContact = "";
//紧急联系电话
model_Patient.EmergencyContactPhone = "";
//亲属关系
model_Patient.Relationship = "";
//标签卡编号
long WristStrapID = -1;
model_Patient.WristStrapID = WristStrapID == -1 ? 0 : WristStrapID;
//急救状态
model_Patient.EmergencyState = 0;
//住院时间
model_Patient.HospitalizationTime = "";
//急救车编号
string AmbulanceGuid = "-1";
model_Patient.AmbulanceGuid = AmbulanceGuid == "-1" ? "" : AmbulanceGuid;
//身高
model_Patient.Height = gridView1.GetRowCellValue(selectRow, Height)+""==""?"0": gridView1.GetRowCellValue(selectRow, Height) + "";
//体重
model_Patient.Weight = gridView1.GetRowCellValue(selectRow, Weight).ToString();
list_Patient.Add(model_Patient);
ClientFactory<T_Service_PatientDTO> httpClient = new HttpClientFactory<T_Service_PatientDTO>();
Client<T_Service_PatientDTO> client = httpClient.VisitFactory();
//访问
ListEntity<T_Service_PatientDTO> t = client.Post(Url, list_Patient);
#endregion
if (t.Success)
{
#region 保存各模块病人相关信息
//胸痛中心系统
if (Cur_PatientSystemModuleID.ToString() == PublicClassForDataBase.Config10001)
{
SaveChestPainInfo(Cur_PatientSystemModuleID);
}
#endregion
// XtraMessageBox.Show(string.Format("保存信息成功!"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
//XtraMessageBox.Show("保存失败,请稍后重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
#endregion
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "保存信息:\r\n" + ex);
}
#endregion
}
/// <summary>
/// 保存胸痛相关信息
/// </summary>
/// <param name="systemModuleID">当前模块编号</param>
private void SaveChestPainInfo(long systemModuleID)
{
try
{
#region 时间节点记录生成
string Url = "api/service/T_Service_ChestPain_PatientsTimeAxis";
List<T_Service_ChestPain_PatientsTimeAxisDTO> list_PatientsTimeAxis = new List<T_Service_ChestPain_PatientsTimeAxisDTO>();
T_Service_ChestPain_PatientsTimeAxisDTO model_PatientsTimeAxis = new T_Service_ChestPain_PatientsTimeAxisDTO();
model_PatientsTimeAxis.PatientGuid = Cur_PatientGuid;
model_PatientsTimeAxis.SystemModuleID = systemModuleID;
model_PatientsTimeAxis.RecordingTime = PublicClass.DateTimeNow();
model_PatientsTimeAxis.NormalTime = PublicClass.DateTimeNow();
list_PatientsTimeAxis.Add(model_PatientsTimeAxis);
//初始化两个工厂
ClientFactory<T_Service_ChestPain_PatientsTimeAxisDTO> httpClient_PatientsTimeAxis = new HttpClientFactory<T_Service_ChestPain_PatientsTimeAxisDTO>();
Client<T_Service_ChestPain_PatientsTimeAxisDTO> client_PatientsTimeAxis = httpClient_PatientsTimeAxis.VisitFactory();
//执行
bool isSure = client_PatientsTimeAxis.Post(Url, list_PatientsTimeAxis).Success;
#endregion
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "保存胸痛相关信息:\r\n" + ex);
}
}
}
}