140 lines
5.2 KiB
C#
140 lines
5.2 KiB
C#
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.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_FollowUp
|
|
{
|
|
public partial class Form_PatientWaterSwallow : Form
|
|
{
|
|
public string WaterSwallow;
|
|
public string _guid;
|
|
public int _type = 0;
|
|
|
|
//设置委托
|
|
public delegate void TextEventHandler(string strText, PatientWaterSwallowDTO dto);
|
|
|
|
public TextEventHandler TextHandler;
|
|
private PatientWaterSwallowDTO dto;
|
|
|
|
public Form_PatientWaterSwallow()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public Form_PatientWaterSwallow(string patientGUID = "", int type = 0)
|
|
{
|
|
_guid = patientGUID;
|
|
_type = type;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Form_PatientWaterSwallow_Load(object sender, EventArgs e)
|
|
{
|
|
radioGroup_WaterSwallow.SelectedIndex = -1;
|
|
dto = new PatientWaterSwallowDTO();
|
|
|
|
string url = string.Format("api/service/T_Service_Apoplexy_ScoreSummary/GetTunYanScoreByPatientGuid?patientGuid={0}", _guid);
|
|
PatientWaterSwallowDTO WaterSwallowModel = DBHelpClass.GetDateModel<PatientWaterSwallowDTO>(url);
|
|
|
|
if (WaterSwallowModel != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(WaterSwallowModel.TotalScore + ""))
|
|
radioGroup_WaterSwallow.EditValue = WaterSwallowModel.TotalScore + "";
|
|
}
|
|
}
|
|
|
|
private void simpleButton_Save_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (_type == 0)
|
|
{
|
|
Getdata();
|
|
}
|
|
else
|
|
{
|
|
PatientWaterSwallowDTO WaterSwallowModel = new PatientWaterSwallowDTO();
|
|
List<PatientWaterSwallowDTO> list = new List<PatientWaterSwallowDTO>();
|
|
|
|
WaterSwallowModel.PatientGUID = _guid;
|
|
WaterSwallowModel.TotalScore = radioGroup_WaterSwallow.EditValue + "";
|
|
WaterSwallowModel.CreateUser = Information.User.ID;
|
|
|
|
list.Add(WaterSwallowModel);
|
|
string Url = "api/service/T_Service_Apoplexy_ScoreSummary/AddORUpdateTunYanScore";
|
|
//初始化两个工厂
|
|
ClientFactory<PatientWaterSwallowDTO> httpClient = new HttpClientFactory<PatientWaterSwallowDTO>();
|
|
Client<PatientWaterSwallowDTO> client = httpClient.VisitFactory();
|
|
//访问
|
|
ListEntity<PatientWaterSwallowDTO> t = client.Post(Url, list);
|
|
if (radioGroup_WaterSwallow.SelectedIndex > -1)
|
|
{
|
|
TextHandler.Invoke(radioGroup_WaterSwallow.EditValue + "", dto);
|
|
dto.TotalScore = radioGroup_WaterSwallow.EditValue + "";
|
|
DialogResult = DialogResult.OK;
|
|
}
|
|
this.Close();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void simpleButton_Cancel_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
public void Getdata()
|
|
{
|
|
PatientWaterSwallowDTO WaterSwallowModel = new PatientWaterSwallowDTO();
|
|
List<PatientWaterSwallowDTO> list = new List<PatientWaterSwallowDTO>();
|
|
|
|
WaterSwallowModel.PatientGUID = _guid;
|
|
WaterSwallowModel.TotalScore = radioGroup_WaterSwallow.EditValue + "";
|
|
WaterSwallowModel.CreateUser = Information.User.ID;
|
|
|
|
list.Add(WaterSwallowModel);
|
|
string Url = "api/service/T_Service_Apoplexy_ScoreSummary/AddORUpdateTunYanScore";
|
|
//初始化两个工厂
|
|
ClientFactory<PatientWaterSwallowDTO> httpClient = new HttpClientFactory<PatientWaterSwallowDTO>();
|
|
Client<PatientWaterSwallowDTO> client = httpClient.VisitFactory();
|
|
//访问
|
|
ListEntity<PatientWaterSwallowDTO> t = client.Post(Url, list);
|
|
if (t.Success)
|
|
{
|
|
if (!string.IsNullOrEmpty(t.DataString))
|
|
{
|
|
if (t.DataString.Contains("Success"))
|
|
{
|
|
JObject jo = (JObject)JsonConvert.DeserializeObject(t.DataString);
|
|
string msg = jo["Msg"].ToString();
|
|
if (!string.IsNullOrEmpty(msg))
|
|
{
|
|
XtraMessageBox.Show(msg);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string msg1 = t.DataString.Replace("/", "").Replace(@"\", "").Replace("\"", "");
|
|
XtraMessageBox.Show(msg1);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
XtraMessageBox.Show("保存失败");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
XtraMessageBox.Show("保存失败");
|
|
}
|
|
}
|
|
}
|
|
} |