StableVersion4.3/SC_FristAidPlatform_ChestPa.../ChestPainPublicClass.cs

281 lines
11 KiB
C#
Raw Normal View History

2024-03-11 09:47:34 +08:00
using HL_FristAidPlatform_DTO;
using HL_FristAidPlatform_Public;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
namespace SC_FristAidPlatform_ChestPainUnit
{
public static class ChestPainPublicClass
{
/// <summary>
/// 更新患者转归状态
/// </summary>
/// <param name="patientGuid">患者编号</param>
/// <returns></returns>
public static bool Update_EmergencyState(string patientGuid)
{
try
{
if (!string.IsNullOrEmpty(patientGuid))
{
#region 更新转归状态
string Url = "api/service/T_Service_Patient/UpdateEmergencyState";
List<T_Service_PatientDTO> list = new List<T_Service_PatientDTO>();
T_Service_PatientDTO model = new T_Service_PatientDTO();
model.GUID = patientGuid;
model.EmergencyState = (int)Enumerate.EmergencyState.;
model.CreationDate = PublicClass.DateTimeNow();
model.EditTime = PublicClass.DateTimeNow();
model.RegisterTime = PublicClass.DateTimeNow();
list.Add(model);
//初始化两个工厂
ClientFactory<T_Service_PatientDTO> httpClient = new HttpClientFactory<T_Service_PatientDTO>();
Client<T_Service_PatientDTO> client = httpClient.VisitFactory();
#endregion
//访问
return client.Post(Url, list).Success;
}
else
{
return false;
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog("ChestPainPublicClass", "更新转归状态:\r\n" + ex);
return false;
}
}
/// <summary>
/// 修改标签卡状态
/// </summary>
/// <param name="wristStrapID">标签卡编号</param>
/// <returns></returns>
public static bool Update_WristStrap_Status1(long wristStrapID)
{
try
{
if (wristStrapID > 0)
{
#region 修改标签卡状态
string Url = "api/base/T_Base_WristStrap/UpdateStatus";
List<T_Base_WristStrapDTO> list = new List<T_Base_WristStrapDTO>();
T_Base_WristStrapDTO model = new T_Base_WristStrapDTO();
model.ID = wristStrapID;
model.CreationDate = PublicClass.DateTimeNow();
model.Status = 0;//空闲
list.Add(model);
//初始化两个工厂
ClientFactory<T_Base_WristStrapDTO> httpClient = new HttpClientFactory<T_Base_WristStrapDTO>();
Client<T_Base_WristStrapDTO> client = httpClient.VisitFactory();
return client.Post(Url, list).Success;
}
else
{
return false;
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog("ChestPainPublicClass", "修改标签卡状态:\r\n" + ex);
return false;
}
}
/// <summary>
/// 修改标签卡状态
/// </summary>
/// <param name="wristStrapID">标签卡编号</param>
/// <returns></returns>
public static bool Update_WristStrap_Status(string Guid)
{
try
{
bool succes = false;
if (!string.IsNullOrEmpty(Guid))
{
string Url = "api/service/T_Service_Patient/ReturnWristStrap";
List<GUIDDTO> list = new List<GUIDDTO>();
GUIDDTO model = new GUIDDTO();
model.GUID = Guid;
list.Add(model);
//初始化两个工厂
ClientFactory<GUIDDTO> httpClient = new HttpClientFactory<GUIDDTO>();
Client<GUIDDTO> client = httpClient.VisitFactory();
#endregion
ListEntity<GUIDDTO> s = client.Post(Url, list);
//访问
if (s.Success)
{
succes = true;
}
else
{
succes = false;
}
}
return succes;
}
catch (Exception ex)
{
PublicClass.WriteErrorLog("ChestPainPublicClass", "修改标签卡状态:\r\n" + ex);
return false;
}
}
/// <summary>
/// 修改急救车状态
/// </summary>
/// <param name="ambulanceGuid">急救车编号</param>
/// <returns></returns>
public static bool Update_Ambulance_Status(string ambulanceGuid)
{
try
{
#region 更改急救车信息
string Url = "api/base/T_Base_Ambulance/UpdateState";
List<T_Base_AmbulanceDTO> list = new List<T_Base_AmbulanceDTO>();
T_Base_AmbulanceDTO model = new T_Base_AmbulanceDTO();
model.GUID = ambulanceGuid;
model.State = 1;
model.CreationDate = PublicClass.DateTimeNow();
list.Add(model);
//初始化两个工厂
ClientFactory<T_Base_AmbulanceDTO> httpClient = new HttpClientFactory<T_Base_AmbulanceDTO>();
Client<T_Base_AmbulanceDTO> client = httpClient.VisitFactory();
#endregion
//访问
return client.Post(Url, list).Success;
}
catch (Exception ex)
{
PublicClass.WriteErrorLog("ChestPainPublicClass", "修改急救车状态:\r\n" + ex);
return false;
}
}
/// <summary>
/// 心电图服务结束
/// </summary>
public static void Update_Medical(string Cur_PatientGuid)
{
try
{
//心电图服务结束
string URL = string.Format("api/service/T_Service_Patient/GetModelByIdOrGuid?id={0}&guid={1}", 0, Cur_PatientGuid);
DataTable Cur_PatientDT = DBHelpClass.Get(URL);
string Cur_PatientName = Cur_PatientDT.Rows[0]["Name"].ToString();
string Cur_PatientGender = Cur_PatientDT.Rows[0]["GenderName"].ToString() == "男" ? "M" : "W";
string Cur_PatientAge = Cur_PatientDT.Rows[0]["Age"].ToString();
string Cur_WardshipId = Cur_PatientDT.Rows[0]["WardshipId"].ToString();
string EqmtNo = Cur_PatientDT.Rows[0]["EqmtNo"].ToString();
string guid = Cur_PatientDT.Rows[0]["GUID"].ToString();
ReturnMedicalForm returnMedicalForm = PostMedicalForm(Cur_PatientName, Cur_PatientAge, Cur_PatientGender, EqmtNo, guid);
}
catch (Exception ex)
{
PublicClass.WriteErrorLog("ChestPainPublicClass", "心电图服务结束" + ex);
}
}
/// <summary>
/// 提交医单归还设备
/// </summary>
/// <param name="name">姓名</param>
/// <param name="age">年龄</param>
/// <param name="sex">性别</param>
/// <param name="eqmtNo">设备号</param>
/// <param name="guid">GUID</param>
/// <returns></returns>
public static ReturnMedicalForm PostMedicalForm(string name, string age, string sex, string eqmtNo, string guid)
{
MedicalForm parameter = new MedicalForm();
parameter.formId = guid;
parameter.itemType = "ITEM_TYPE_HEART";
parameter.itemCode = "ITEM_CODE_HEART_DYNAMIC";
parameter.itemName = "";
parameter.dyAdditionalItems = "ITEM_CODE_BLOOD_DYNAMIC";
parameter.dyAnalyseOption = "0";
parameter.eqmtTypeNo = "";
parameter.eqmtNo = eqmtNo;
parameter.archivesId = guid;
parameter.ifInHospital = "NOINHOSPITAL";
parameter.techOfficeNo = "";
parameter.techOfficeName = "";
parameter.medCardNo = "";
parameter.medFormNo = "";
parameter.billNo = "";
parameter.userName = name;
parameter.sex = sex == "1" ? "M" : "W";//M或者 W(女)
parameter.year = age;
parameter.birthDay = "";
parameter.certNo = "";
parameter.phone = "";
parameter.serviceBeginTime = PublicClass.DateTimeNow();// "2019-03-25 00:00:00";
parameter.serviceLength = "1";
parameter.timeUnite = "DAY";
parameter.bedNo = "";
parameter.outPatientNo = "";
parameter.admNo = "";
parameter.roomNo = "";
parameter.treatNo = "";
parameter.ordNo = "";
parameter.examNo = "";
parameter.reportTitle = "";
parameter.aidFlag = "1";
parameter.postAction = "POST_END";
parameter.dataFormat = "";
parameter.data = "";
parameter.memo = "";
parameter.reportNotifyUrl = "";
string paras = JsonConvert.SerializeObject(parameter);
List<string> list = PublicHelp.GetParameter<MedicalForm>(paras);
string getserviceorglistString = Util.GetECG(list[1], Util.ServiceCode.POSTMEDICALFORM.ToString(), list[0]);
var organizeView = JsonConvert.DeserializeObject<ReturnMedicalForm>(getserviceorglistString);
return organizeView;
}
/// <summary>
/// 逻辑处理时间绑定
/// 从记录表中获取当前时间,如果当前时间没有值,则在记录源中绑定对应的时间
/// </summary>
/// <param name="dataTable">时间源,页面加载时调用,避免重复查询</param>
/// <param name="timeControl">赋值后的时间控件</param>
/// <param name="timeID">时间编号</param>
public static void BindTimeForDT(DataTable dataTable, TimeControl timeControl, string timeID)
{
string timeValue = timeControl.TimeValue;
//当前绑定的时间为空,从数据源处理绑定
if (string.IsNullOrEmpty(timeValue))
{
//数据源有记录
if (dataTable != null && dataTable.Rows.Count > 0)
{
//获取当前节点时间
DataRow[] Row_Time = dataTable.Select("ID='" + timeID + "'");
if (Row_Time.Length > 0)
{
string RecordingTime = PublicClass.ToString(Row_Time[0]["RecordingTime"], "");
if (!string.IsNullOrEmpty(RecordingTime))
{
timeControl.TimeValue = RecordingTime;
}
}
}
}
}
}
}