using DevExpress.XtraEditors; using HL_FristAidPlatform_DTO; using HL_FristAidPlatform_Public; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; namespace HL_FristAidPlatform_ChestPain { public static class ChestPainPublicClass { /// /// 更新患者转归状态 /// /// 患者编号 /// public static bool Update_EmergencyState(string patientGuid) { try { if (!string.IsNullOrEmpty(patientGuid)) { #region 更新转归状态 string Url = "api/service/T_Service_Patient/UpdateEmergencyState"; List list = new List(); 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 httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); #endregion //访问 return client.Post(Url, list).Success; } else { return false; } } catch (Exception ex) { PublicClass.WriteErrorLog("ChestPainPublicClass", "更新转归状态:\r\n" + ex); return false; } } /// /// 修改标签卡状态 /// /// 标签卡编号 /// public static bool Update_WristStrap_Status1(long wristStrapID) { try { if (wristStrapID > 0) { #region 修改标签卡状态 string Url = "api/base/T_Base_WristStrap/UpdateStatus"; List list = new List(); T_Base_WristStrapDTO model = new T_Base_WristStrapDTO(); model.ID = wristStrapID; model.CreationDate = PublicClass.DateTimeNow(); model.Status = 0;//空闲 list.Add(model); //初始化两个工厂 ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); return client.Post(Url, list).Success; } else { return false; } } catch (Exception ex) { PublicClass.WriteErrorLog("ChestPainPublicClass", "修改标签卡状态:\r\n" + ex); return false; } } /// /// 修改标签卡状态 /// /// 标签卡编号 /// 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 list = new List(); GUIDDTO model = new GUIDDTO(); model.GUID = Guid; list.Add(model); //初始化两个工厂 ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); #endregion ListEntity 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; } } /// /// 修改急救车状态 /// /// 急救车编号 /// public static bool Update_Ambulance_Status(string ambulanceGuid) { try { #region 更改急救车信息 string Url = "api/base/T_Base_Ambulance/UpdateState"; List list = new List(); T_Base_AmbulanceDTO model = new T_Base_AmbulanceDTO(); model.GUID = ambulanceGuid; model.State = 1; model.CreationDate = PublicClass.DateTimeNow(); list.Add(model); //初始化两个工厂 ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); #endregion //访问 return client.Post(Url, list).Success; } catch (Exception ex) { PublicClass.WriteErrorLog("ChestPainPublicClass", "修改急救车状态:\r\n" + ex); return false; } } /// /// 心电图服务结束 /// 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); } } /// /// 提交医单归还设备 /// /// 姓名 /// 年龄 /// 性别 /// 设备号 /// GUID /// 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 list = PublicHelp.GetParameter(paras); string getserviceorglistString = Util.GetECG(list[1], Util.ServiceCode.POSTMEDICALFORM.ToString(), list[0]); var organizeView = JsonConvert.DeserializeObject(getserviceorglistString); return organizeView; } /// /// 逻辑处理时间绑定 /// 从记录表中获取当前时间,如果当前时间没有值,则在记录源中绑定对应的时间 /// /// 时间源,页面加载时调用,避免重复查询 /// 赋值后的时间控件 /// 时间编号 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; } } } } } } }