StableVersion4.3/HL_FristAidPlatform_Bussiness/Service/T_Service_ChestPain_FollowU...

608 lines
28 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using HL_FristAidPlatform_DataBase;
using HL_FristAidPlatform_Help;
using HL_FristAidPlatform_IDataBase;
using HL_FristAidPlatform_Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HL_FristAidPlatform_Bussiness
{
public class T_Service_ChestPain_FollowUpInfoBLL
{
private IT_Service_ChestPain_FollowUpInfo IService = new T_Service_ChestPain_FollowUpInfoDB();
/// <summary>
/// 胸痛随访患者列表查询
/// </summary>
/// <param name="hospitalGuid"></param>
/// <param name="name"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="cp_Diagnosis_Code"></param>
/// <param name="status"></param>
/// <param name="month"></param>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <returns></returns>
public TableModel<ChestPain_FollowUpListModel> GetChestPainFollowUpList(string hospitalGuid, string name, string startDate, string endDate, string cp_Diagnosis_Code, string status, string month, string reporting, int pageSize, int pageIndex)
{
return IService.GetChestPainFollowUpList(hospitalGuid, name, startDate, endDate, cp_Diagnosis_Code, status, month, reporting, pageSize, pageIndex);
}
public List<KeyValue> GetChestPainFollowUpList(string hospitalGuid)
{
return IService.GetChestPainFollowUpList(hospitalGuid);
}
/// <summary>
/// 胸痛随访患者列表查询
/// </summary>
/// <param name="hospitalGuid"></param>
/// <param name="name"></param>
/// <param name="pageSize"></param>
/// <param name="pageIndex"></param>
/// <returns></returns>
public TableModel<ChestPain_FollowUpModel> GetFollowUpList(string hospitalGuid, string name, int pageSize, int pageIndex)
{
return IService.GetFollowUpList(hospitalGuid, name, pageSize, pageIndex);
}
/// <summary>
/// 随访计划
/// </summary>
/// <param name="registerId"></param>
/// <returns></returns>
public List<FollowUpPlanModel> GetFollowUpPlanList(string registerId)
{
return IService.GetFollowUpPlanList(registerId);
}
/// <summary>
/// 随访患者部分基本信息--(表头数据展示)
/// </summary>
/// <param name="registerId"></param>
/// <returns></returns>
public RegisterInfoModel GetRegisterInfo(string registerId)
{
return IService.GetRegisterInfo(registerId);
}
/// <summary>
/// 获取随访基本信息
/// </summary>
/// <param name="registerId"></param>
/// <returns></returns>
public FollowUpInfoModel GetFollowUpInfo(string registerId, string month)
{
return IService.GetFollowUpInfo(registerId, month);
}
/// <summary>
/// 保存随访基本信息
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public MessageModel<bool> SaveFollowUpInfo(FollowUpInfoModel model)
{
T_Service_ChestPain_FollowUpInfo info = new T_Service_ChestPain_FollowUpInfo();
info = IService.GetModel(model.registerId);
if (info == null)
{
return new MessageModel<bool> { Success = false, Msg = "患者不存在" };
}
else
{
if (IService.SaveFollowUpInfo(model, info.status))
{
return new MessageModel<bool> { Success = true, Msg = "保存成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "保存失败" };
}
}
}
/// <summary>
/// 获取危险因素控制
/// </summary>
/// <param name="registerId"></param>
/// <param name="month"></param>
/// <returns></returns>
public FollowUpRiskReasonModel GetFollowUpRiskReason(string registerId, string month)
{
return IService.GetFollowUpRiskReason(registerId, month);
}
/// <summary>
/// 保存危险因素控制
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public MessageModel<bool> SaveFollowUpRiskReason(FollowUpRiskReasonModel model)
{
T_Service_ChestPain_FollowUpInfo info = new T_Service_ChestPain_FollowUpInfo();
info = IService.GetModel(model.registerId);
if (info == null)
{
return new MessageModel<bool> { Success = false, Msg = "患者不存在" };
}
else
{
if (IService.SaveFollowUpRiskReason(model, info.status))
{
return new MessageModel<bool> { Success = true, Msg = "保存成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "保存失败" };
}
}
}
/// <summary>
/// 获取检查项目
/// </summary>
/// <param name="registerId"></param>
/// <param name="month"></param>
/// <returns></returns>
public FollowUpInspectionItemModel GetFollowUpInspectionItem(string registerId, string month)
{
return IService.GetFollowUpInspectionItem(registerId, month);
}
/// <summary>
/// 保存危险因素控制
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public MessageModel<bool> SaveFollowUpInspectionItem(FollowUpInspectionItemModel model)
{
T_Service_ChestPain_FollowUpInfo info = new T_Service_ChestPain_FollowUpInfo();
info = IService.GetModel(model.registerId);
if (info == null)
{
return new MessageModel<bool> { Success = false, Msg = "患者不存在" };
}
else
{
if (IService.SaveFollowUpInspectionItem(model, info.status))
{
return new MessageModel<bool> { Success = true, Msg = "保存成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "保存失败" };
}
}
}
/// <summary>
/// 获取躯体症状与心功能评价
/// </summary>
/// <param name="registerId"></param>
/// <param name="month"></param>
/// <returns></returns>
public FollowUpSomaticSymptomsModel GetFollowUpSomaticSymptoms(string registerId, string month)
{
return IService.GetFollowUpSomaticSymptoms(registerId, month);
}
/// <summary>
/// 保存躯体症状与心功能评价
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public MessageModel<bool> SaveFollowUpSomaticSymptoms(FollowUpSomaticSymptomsModel model)
{
T_Service_ChestPain_FollowUpInfo info = new T_Service_ChestPain_FollowUpInfo();
info = IService.GetModel(model.registerId);
if (info == null)
{
return new MessageModel<bool> { Success = false, Msg = "患者不存在" };
}
else
{
//model.registerId = info.registerId;
if (IService.SaveFollowUpSomaticSymptoms(model, info.status))
{
return new MessageModel<bool> { Success = true, Msg = "保存成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "保存失败" };
}
}
}
/// <summary>
/// 获取用药信息
/// </summary>
/// <param name="registerId"></param>
/// <param name="month"></param>
/// <returns></returns>
public FollowUpMedicationModel GetFollowUpMedication(string registerId, string month)
{
return IService.GetFollowUpMedication(registerId, month);
}
/// <summary>
/// 获取用药信息
/// </summary>
/// <param name="registerId"></param>
/// <param name="month"></param>
/// <returns></returns>
public List<T_Service_ChestPain_FollowUpMedicationInfo> GetFollowUpMedicationList(string registerId, string month)
{
return IService.GetFollowUpMedicationList(registerId, month);
}
/// <summary>
/// 保存用药信息
/// </summary>
/// <param name="infoList"></param>
/// <returns></returns>
public MessageModel<bool> SaveFollowUpMedication(FollowUpMedicationModel model)
{
T_Service_ChestPain_FollowUpInfo info = new T_Service_ChestPain_FollowUpInfo();
info = IService.GetModel(model.registerId);
if (info == null)
{
return new MessageModel<bool> { Success = false, Msg = "患者不存在" };
}
else
{
info.registerId = model.registerId;
info.month = model.month;
info.isAntiplateletDrugs = model.isAntiplateletDrugs;
info.isLipidLoweringDrugs = model.isLipidLoweringDrugs;
info.isAceiAndArb = model.isAceiAndArb;
info.isArni = model.isArni;
info.isBetaBlocker = model.isBetaBlocker;
info.isHypoglycemicDrugs = model.isHypoglycemicDrugs;
info.isAnticoagulant = model.isAnticoagulant;
info.isDiuretics = model.isDiuretics;
List<T_Service_ChestPain_FollowUpMedicationInfo> list = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
if (model.antiplateletDrugsList.Count > 0)
list.AddRange(model.antiplateletDrugsList);
if (model.lipidLoweringDrugsList.Count > 0)
list.AddRange(model.lipidLoweringDrugsList);
if (model.aceiAndArbList.Count > 0)
list.AddRange(model.aceiAndArbList);
if (model.arniList.Count > 0)
list.AddRange(model.arniList);
if (model.betaBlockerList.Count > 0)
list.AddRange(model.betaBlockerList);
if (model.hypoglycemicDrugsList.Count > 0)
list.AddRange(model.hypoglycemicDrugsList);
if (model.anticoagulantList.Count > 0)
list.AddRange(model.anticoagulantList);
if (model.diureticsList.Count > 0)
list.AddRange(model.diureticsList);
if (IService.SaveFollowUpMedication(info, list, info.status))
{
return new MessageModel<bool> { Success = true, Msg = "保存成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "保存失败" };
}
}
}
/// <summary>
/// 保存用药信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MessageModel<bool> SaveFollowUpMedicationOfString(FollowUpMedicationOfStringModel model)
{
T_Service_ChestPain_FollowUpInfo info = new T_Service_ChestPain_FollowUpInfo();
info = IService.GetModel(model.registerId);
if (info == null)
{
return new MessageModel<bool> { Success = false, Msg = "患者不存在" };
}
else
{
info.registerId = model.registerId;
info.month = model.month;
info.isAntiplateletDrugs = model.isAntiplateletDrugs;
info.isLipidLoweringDrugs = model.isLipidLoweringDrugs;
info.isAceiAndArb = model.isAceiAndArb;
info.isArni = model.isArni;
info.isBetaBlocker = model.isBetaBlocker;
info.isHypoglycemicDrugs = model.isHypoglycemicDrugs;
info.isAnticoagulant = model.isAnticoagulant;
info.isDiuretics = model.isDiuretics;
List<T_Service_ChestPain_FollowUpMedicationInfo> list = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
if (!string.IsNullOrEmpty(model.antiplateletDrugsList))
{
string str = model.antiplateletDrugsList.Replace("\'", "\"");
JArray jo = (JArray)JsonConvert.DeserializeObject(str);
List<T_Service_ChestPain_FollowUpMedicationInfo> lst = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
lst = jo.ToObject<List<T_Service_ChestPain_FollowUpMedicationInfo>>();
if (lst.Count > 0)
list.AddRange(lst);
}
if (!string.IsNullOrEmpty(model.lipidLoweringDrugsList))
{
string str = model.lipidLoweringDrugsList.Replace("\'", "\"");
JArray jo = (JArray)JsonConvert.DeserializeObject(str);
List<T_Service_ChestPain_FollowUpMedicationInfo> lst = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
lst = jo.ToObject<List<T_Service_ChestPain_FollowUpMedicationInfo>>();
if (lst.Count > 0)
list.AddRange(lst);
}
if (!string.IsNullOrEmpty(model.aceiAndArbList))
{
string str = model.aceiAndArbList.Replace("\'", "\"");
JArray jo = (JArray)JsonConvert.DeserializeObject(str);
List<T_Service_ChestPain_FollowUpMedicationInfo> lst = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
lst = jo.ToObject<List<T_Service_ChestPain_FollowUpMedicationInfo>>();
if (lst.Count > 0)
list.AddRange(lst);
}
if (!string.IsNullOrEmpty(model.arniList))
{
string str = model.arniList.Replace("\'", "\"");
JArray jo = (JArray)JsonConvert.DeserializeObject(str);
List<T_Service_ChestPain_FollowUpMedicationInfo> lst = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
lst = jo.ToObject<List<T_Service_ChestPain_FollowUpMedicationInfo>>();
if (lst.Count > 0)
list.AddRange(lst);
}
if (!string.IsNullOrEmpty(model.betaBlockerList))
{
string str = model.betaBlockerList.Replace("\'", "\"");
JArray jo = (JArray)JsonConvert.DeserializeObject(str);
List<T_Service_ChestPain_FollowUpMedicationInfo> lst = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
lst = jo.ToObject<List<T_Service_ChestPain_FollowUpMedicationInfo>>();
if (lst.Count > 0)
list.AddRange(lst);
}
if (!string.IsNullOrEmpty(model.hypoglycemicDrugsList))
{
string str = model.hypoglycemicDrugsList.Replace("\'", "\"");
JArray jo = (JArray)JsonConvert.DeserializeObject(str);
List<T_Service_ChestPain_FollowUpMedicationInfo> lst = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
lst = jo.ToObject<List<T_Service_ChestPain_FollowUpMedicationInfo>>();
if (lst.Count > 0)
list.AddRange(lst);
}
if (!string.IsNullOrEmpty(model.anticoagulantList))
{
string str = model.anticoagulantList.Replace("\'", "\"");
JArray jo = (JArray)JsonConvert.DeserializeObject(str);
List<T_Service_ChestPain_FollowUpMedicationInfo> lst = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
lst = jo.ToObject<List<T_Service_ChestPain_FollowUpMedicationInfo>>();
if (lst.Count > 0)
list.AddRange(lst);
}
if (!string.IsNullOrEmpty(model.diureticsList))
{
string str = model.diureticsList.Replace("\'", "\"");
JArray jo = (JArray)JsonConvert.DeserializeObject(str);
List<T_Service_ChestPain_FollowUpMedicationInfo> lst = new List<T_Service_ChestPain_FollowUpMedicationInfo>();
lst = jo.ToObject<List<T_Service_ChestPain_FollowUpMedicationInfo>>();
if (lst.Count > 0)
list.AddRange(lst);
}
if (IService.SaveFollowUpMedication(info, list, info.status))
{
return new MessageModel<bool> { Success = true, Msg = "保存成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "保存失败" };
}
}
}
/// <summary>
/// 获取胸痛随访患者全部信息--上传
/// </summary>
/// <param name="registerId"></param>
/// <param name="month"></param>
/// <returns></returns>
public FollowUpDataUploadModel GetFollowUpDataUpload(string hospitalGuid, string registerId, string month)
{
return IService.GetFollowUpDataUpload(hospitalGuid, registerId, month);
}
/// <summary>
/// 修改状态
/// </summary>
/// <param name="registerId"></param>
/// <param name="month"></param>
/// <returns></returns>
public bool UpdateStatus(UpdateStatusModel model)
{
return IService.UpdateStatus(model);
}
//===提交
/// <summary>
/// 提交随访基本信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public MessageModel<bool> SubmitFollowUpInfo(FollowUpInfoModel model)
{
T_Service_ChestPain_FollowUpInfo info = new T_Service_ChestPain_FollowUpInfo();
info = IService.GetModel(model.registerId);
if (info == null)
{
return new MessageModel<bool> { Success = false, Msg = "患者不存在" };
}
else
{
if (IService.SaveFollowUpInfo(model, info.status))
{
//返回校验不通过的数据 return DataVerification(info);
return new MessageModel<bool> { Success = true, Msg = "保存失成功" };
}
else
{
return new MessageModel<bool> { Success = false, Msg = "保存失败" };
}
}
}
/// <summary>
/// 校验
/// </summary>
/// <param name="guid"></param>
/// <param name="month"></param>
/// <returns></returns>
public MessageModel<bool> DataVerification(T_Service_ChestPain_FollowUpInfo info)
{
if (string.IsNullOrEmpty(info.isFollowUp))
{
if (info.isFollowUp == "1")
{
if (string.IsNullOrEmpty(info.way))
return new MessageModel<bool> { Success = false, Msg = "信息获取途径不能为空" };
if (string.IsNullOrEmpty(info.actualEvaluationDate))
return new MessageModel<bool> { Success = false, Msg = "实际评估日期不能为空" };
if (!string.IsNullOrEmpty(info.followUpStatus))
{//1存活 2死亡 3失访
if (info.followUpStatus == "2")
{
if (string.IsNullOrEmpty(info.deathDate))
return new MessageModel<bool> { Success = false, Msg = "死亡日期不能为空" };
if (string.IsNullOrEmpty(info.deathCause))
return new MessageModel<bool> { Success = false, Msg = "死亡不能为空" };
if (info.deathCause == "1" && string.IsNullOrEmpty(info.cardiovascularDeath))
return new MessageModel<bool> { Success = false, Msg = "心血管死亡不能为空" };
if (info.cardiovascularDeath == "99" && string.IsNullOrEmpty(info.cardiovascularDeathDesc))
return new MessageModel<bool> { Success = false, Msg = "心血管死亡(内容描述)不能为空" };
if (info.deathCause == "2" && string.IsNullOrEmpty(info.nonCardiovascularDeath))
return new MessageModel<bool> { Success = false, Msg = "非心血管死亡不能为空" };
if (info.deathCause == "3" && string.IsNullOrEmpty(info.unexplainedDeath))
return new MessageModel<bool> { Success = false, Msg = "不明原因的死亡不能为空" };
}
if (info.followUpStatus == "1")
{
if (string.IsNullOrEmpty(info.currentState))
return new MessageModel<bool> { Success = false, Msg = "目前状况不能为空" };
if (string.IsNullOrEmpty(info.isRecoveryPlan))
return new MessageModel<bool> { Success = false, Msg = "加入心脏康复计划不能为空" };
if (info.isRecoveryPlan == "1" && string.IsNullOrEmpty(info.recoveryPlanDate))
return new MessageModel<bool> { Success = false, Msg = "加入心脏康复计划(开始日 期)不能为空" };
if (string.IsNullOrEmpty(info.isHeartCarePlan))
return new MessageModel<bool> { Success = false, Msg = "加入心脏关爱计划不能为空" };
if (string.IsNullOrEmpty(info.adverseEvents))
return new MessageModel<bool> { Success = false, Msg = "出院后主要心血管不良事件不能为空" };
if (info.adverseEvents.Contains("5") && string.IsNullOrEmpty(info.bleedingSite))
return new MessageModel<bool> { Success = false, Msg = "出血部位不能为空" };
#region 危险因素控制数据校验
if (string.IsNullOrEmpty(info.isHypertension))
return new MessageModel<bool> { Success = false, Msg = "血压监测不能为空" };
if (info.isHypertension == "1" && string.IsNullOrEmpty(info.hypertensionValue))
return new MessageModel<bool> { Success = false, Msg = "血压监测(值)不能为空" };
if (info.isHypertension == "2" && string.IsNullOrEmpty(info.isHypertensionUptopar))
return new MessageModel<bool> { Success = false, Msg = "血压监测(控制是否达标)不能为空" };
if (string.IsNullOrEmpty(info.isHyperLipidemia))
return new MessageModel<bool> { Success = false, Msg = "血脂四项不能为空" };
if (info.isHyperLipidemia == "1" && string.IsNullOrEmpty(info.bloodfatCheckTime))
return new MessageModel<bool> { Success = false, Msg = "血脂四项(检查时间)不能为空" };
if (info.isHyperLipidemia == "1" && string.IsNullOrEmpty(info.bloodfatTcValue))
return new MessageModel<bool> { Success = false, Msg = "血脂四项TC数值不能为空" };
if (info.isHyperLipidemia == "1" && string.IsNullOrEmpty(info.bloodfatTgValue))
return new MessageModel<bool> { Success = false, Msg = "血脂四项TG数值不能为空" };
if (info.isHyperLipidemia == "1" && string.IsNullOrEmpty(info.bloodfatLdlcValue))
return new MessageModel<bool> { Success = false, Msg = "血脂四项LDL-C数值不能为空" };
if (info.isHyperLipidemia == "1" && string.IsNullOrEmpty(info.bloodfatHdlcValue))
return new MessageModel<bool> { Success = false, Msg = "血脂四项HDL-C数值不能为空" };
if (string.IsNullOrEmpty(info.isLpa))
return new MessageModel<bool> { Success = false, Msg = "脂蛋白 a(LPa)不能为空" };
if (info.isLpa == "1" && string.IsNullOrEmpty(info.bloodfatLpaValue))
return new MessageModel<bool> { Success = false, Msg = "脂蛋白 a(LPa)值不能为空" };
if (info.isLpa == "1" && string.IsNullOrEmpty(info.bloodfatLpaUnit))
return new MessageModel<bool> { Success = false, Msg = "脂蛋白 a(LPa)单位值不能为空" };
if (string.IsNullOrEmpty(info.isDiabetes))
return new MessageModel<bool> { Success = false, Msg = "空腹血糖不能为空" };
if (info.isDiabetes == "1" && string.IsNullOrEmpty(info.fbgCheckTime))
return new MessageModel<bool> { Success = false, Msg = "空腹血糖(检查时间)不能为空" };
if (info.isDiabetes == "1" && string.IsNullOrEmpty(info.fbgValue))
return new MessageModel<bool> { Success = false, Msg = "空腹血糖(数值)不能为空" };
if (info.isDiabetes == "2" && string.IsNullOrEmpty(info.isDiabeesNormal))
return new MessageModel<bool> { Success = false, Msg = "血糖控制在正常范围不能为空" };
if (string.IsNullOrEmpty(info.isGhb))
return new MessageModel<bool> { Success = false, Msg = "糖化血红蛋白不能为空" };
if (info.isGhb == "1" && string.IsNullOrEmpty(info.ghbValue))
return new MessageModel<bool> { Success = false, Msg = "糖化血红蛋白(数值)不能为空" };
if (info.isGhb == "1" && string.IsNullOrEmpty(info.ghbCheckTime))
return new MessageModel<bool> { Success = false, Msg = "糖化血红蛋白(检查时间)不能为空" };
if (string.IsNullOrEmpty(info.isSmoke))
return new MessageModel<bool> { Success = false, Msg = "吸烟不能为空" };
if (info.isSmoke == "1" && string.IsNullOrEmpty(info.smokeStatus))
return new MessageModel<bool> { Success = false, Msg = "吸烟不能为空" };
if (string.IsNullOrEmpty(info.isDrink))
return new MessageModel<bool> { Success = false, Msg = "饮酒不能为空" };
if (string.IsNullOrEmpty(info.height))
return new MessageModel<bool> { Success = false, Msg = "身高不能为空" };
if (string.IsNullOrEmpty(info.weight))
return new MessageModel<bool> { Success = false, Msg = "体重不能为空" };
#endregion
#region
#endregion
}
}
else
{
return new MessageModel<bool> { Success = false, Msg = "随访状态不能为空" };
}
}
}
else
{
return new MessageModel<bool> { Success = false, Msg = "是否随访不能为空" };
}
return new MessageModel<bool> { Success = false, Msg = "" };
}
}
}