137 lines
5.1 KiB
C#
137 lines
5.1 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.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_Apoplexy
|
|
{
|
|
public partial class Form_LifeStyle : XtraForm
|
|
{
|
|
string patientGUID;
|
|
string flag;
|
|
public Form_LifeStyle(string _patientGUID = "", string _flag = "")
|
|
{
|
|
InitializeComponent();
|
|
patientGUID = _patientGUID;
|
|
flag = _flag;
|
|
}
|
|
|
|
private void Form_LifeStyle_Load(object sender, EventArgs e)
|
|
{
|
|
LoadLifeStyle();
|
|
}
|
|
|
|
private void LoadLifeStyle()
|
|
{
|
|
try
|
|
{
|
|
string url = string.Format("api/service/T_Service_Apoplexy_Community/GetLifeStyleByPatientGuidAndFlag?patientGuid={0}&flag={1}", patientGUID, flag);
|
|
T_Service_Apoplexy_Community_LifeStyleDTO temp = DBHelpClass.GetDateModel<T_Service_Apoplexy_Community_LifeStyleDTO>(url);
|
|
if (temp != null)
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(temp.Movement + ""))
|
|
radioGroup9.EditValue = temp.Movement;
|
|
if (!string.IsNullOrEmpty(temp.Smoke + ""))
|
|
radioGroup10.EditValue = temp.Smoke;
|
|
if (!string.IsNullOrEmpty(temp.Drink + ""))
|
|
radioGroup11.EditValue = temp.Drink;
|
|
if (!string.IsNullOrEmpty(temp.Taste + ""))
|
|
radioGroup12.EditValue = temp.Taste;
|
|
if (!string.IsNullOrEmpty(temp.MeatAndVegetable + ""))
|
|
radioGroup13.EditValue = temp.MeatAndVegetable;
|
|
if (!string.IsNullOrEmpty(temp.Vegetable + ""))
|
|
radioGroup14.EditValue = temp.Vegetable;
|
|
if (!string.IsNullOrEmpty(temp.Fruit + ""))
|
|
radioGroup15.EditValue = temp.Fruit;
|
|
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
public void SaveLifeStyle()
|
|
{
|
|
try
|
|
{
|
|
T_Service_Apoplexy_Community_LifeStyleDTO lifeStyleDTO = new T_Service_Apoplexy_Community_LifeStyleDTO();
|
|
lifeStyleDTO.PatientGUID = patientGUID;
|
|
lifeStyleDTO.Flag = flag;
|
|
if (string.IsNullOrEmpty(lifeStyleDTO.CreatorID + ""))
|
|
{
|
|
lifeStyleDTO.CreatorID = Information.User.ID;
|
|
}
|
|
lifeStyleDTO.Movement = radioGroup9.EditValue + "";
|
|
lifeStyleDTO.Smoke = radioGroup10.EditValue + "";
|
|
lifeStyleDTO.Drink = radioGroup11.EditValue + "";
|
|
lifeStyleDTO.Taste = radioGroup12.EditValue + "";
|
|
lifeStyleDTO.MeatAndVegetable = radioGroup13.EditValue + "";
|
|
lifeStyleDTO.Vegetable = radioGroup14.EditValue + "";
|
|
lifeStyleDTO.Fruit = radioGroup15.EditValue + "";
|
|
|
|
List<T_Service_Apoplexy_Community_LifeStyleDTO> lifeStyleDTOs = new List<T_Service_Apoplexy_Community_LifeStyleDTO>();
|
|
|
|
string Url = string.Format("api/service/T_Service_Apoplexy_Community/AddORUpdateLifeStyle");
|
|
|
|
ClientFactory<T_Service_Apoplexy_Community_LifeStyleDTO> httpClient = new HttpClientFactory<T_Service_Apoplexy_Community_LifeStyleDTO>();
|
|
Client<T_Service_Apoplexy_Community_LifeStyleDTO> client = httpClient.VisitFactory();
|
|
|
|
lifeStyleDTOs.Add(lifeStyleDTO);
|
|
//访问
|
|
ListEntity<T_Service_Apoplexy_Community_LifeStyleDTO> t = client.Post(Url, lifeStyleDTOs);
|
|
|
|
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("保存失败");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
PublicClass.WriteErrorLog(this.Text, "保存基本信息:\r\n" + ex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|