using DevExpress.XtraEditors; using HL_FristAidPlatform_DTO; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.IO; namespace HL_FristAidPlatform_Public { public partial class Form_UpwardReferral : XtraForm { public string PatientGuid; public string HospitalGuid; public PatientReferralModelDTO dto; public Form_UpwardReferral(string patientGuid, string hospitalGuid) { InitializeComponent(); PatientGuid = patientGuid; HospitalGuid = hospitalGuid; } private void Form_DownwardReferral_Load(object sender, EventArgs e) { GetHospitalList(); dto = new PatientReferralModelDTO(); labelControl1.Text = Information.Hospital.Name; GetPatientReferral(); } public void GetHospitalList() { List list = new List(); list.Add("请选择"); List lst = DBHelpClass.GetList(string.Format("api/base/T_Base_Hospital/GetNameByHospitalGUID?parentHospitalGUID={0}", Information.Hospital.GUID)); if (lst != null && lst.Count > 0) { for (int i = 0; i < lst.Count; i++) { list.Add(lst[i].Name); } } if (list.Count > 0) { lookUpEdit_ReceiveHospital.Properties.DataSource = list; } } public void GetPatientReferral() { string URL = string.Format("api/service/T_Service_Chest_UpwardReferral/GetByPatientGuid?PatientGUID={0}&HospitalGuid={1}", PatientGuid, HospitalGuid); PatientReferralModelDTO model = new PatientReferralModelDTO(); lbl_LeaveHospital.Text = Information.Hospital.Name; model = DBHelpClass.GetDateModel(URL); if (model != null) { lbl_name.Text = model.Name; if (model.Gender == 0) lbl_gender.Text = "未知"; if (model.Gender == 1) lbl_gender.Text = "男"; if (model.Gender == 0) lbl_gender.Text = "女"; lbl_phone.Text = model.Phone; if (model.Medical_Insurance_Type == "1") lbl_medical_Insurance_Type.Text = "城镇职工基本医疗保险"; if (model.Medical_Insurance_Type == "2") lbl_medical_Insurance_Type.Text = "新型农村合作医疗"; if (model.Medical_Insurance_Type == "3") lbl_medical_Insurance_Type.Text = "城镇居民基本医疗保险"; if (model.Medical_Insurance_Type == "4") lbl_medical_Insurance_Type.Text = "自费"; if (model.Medical_Insurance_Type == "5") lbl_medical_Insurance_Type.Text = "军免"; lbl_age.Text = model.Age + ""; lbl_inpatient_ID.Text = model.Inpatient_ID; memo_IllnessExplain.Text = model.IllnessExplain; lbl_LeaveHospital.Text = model.LeaveHospital; if (!string.IsNullOrEmpty(model.LeaveTime + "")) timeControl_LeaveTime.TimeValue = model.LeaveTime; //lbl_LeaveTime.Text = model.LeaveTime + ""; if (!string.IsNullOrEmpty(model.ReceiveHospital)) { lookUpEdit_ReceiveHospital.Text = model.ReceiveHospital; } textEdit_AppointHospital.Text = model.AppointHospital + ""; if (!string.IsNullOrEmpty(model.TransferWay + "")) radioGroup_TransferWay.EditValue = model.TransferWay; PublicClass.SetItemChecked(checkedListBoxControl1, PublicClass.ToString(model.TransferNotice, ""), '|');//转院须知 //if (model.TransferWay == "1") // lbl_TransferWay.Text = "120"; //if (model.TransferWay == "2") // lbl_TransferWay.Text = "本院急救车"; //if (model.TransferWay == "3") // lbl_TransferWay.Text = "患者自理"; if (model.PatientSignature != null) { //string str = Encoding.ASCII.GetString(model.PatientSignature); //dto.PatientSignature = Convert.ToByte(str, 2); dto.PatientSignature = model.PatientSignature; string patientSignature = Convert.ToBase64String(model.PatientSignature); if (!string.IsNullOrEmpty(patientSignature)) { MemoryStream ms = new MemoryStream(Convert.FromBase64String(patientSignature)); Image img = Image.FromStream(ms); pic_PatientSignature.Image = img; } } //pic_ReferringDoctorSignature 转诊医生签字 if (model.ReferringDoctorSignature != null) { dto.ReferringDoctorSignature = model.ReferringDoctorSignature; string ReferringDoctorSignature = Convert.ToBase64String(model.ReferringDoctorSignature); if (!string.IsNullOrEmpty(ReferringDoctorSignature)) { MemoryStream ms = new MemoryStream(Convert.FromBase64String(ReferringDoctorSignature)); Image img = Image.FromStream(ms); pic_ReferringDoctorSignature.Image = img; } } } } private void simpleButton1_Click(object sender, EventArgs e) { try { if (dto == null) dto = new PatientReferralModelDTO(); dto.Name = lbl_name.Text; if (lbl_gender.Text == "未知") dto.Gender = 0; if (lbl_gender.Text == "男") dto.Gender = 1; if (lbl_gender.Text == "女") dto.Gender = 2; dto.Phone = lbl_phone.Text; dto.Medical_Insurance_Type = lbl_medical_Insurance_Type.Text; dto.Age = int.Parse(lbl_age.Text); dto.Inpatient_ID = lbl_inpatient_ID.Text; string tempnotice = ""; string temptext = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl1, "|", out tempnotice, out temptext); dto.TransferNotice = tempnotice; dto.IllnessExplain = memo_IllnessExplain.Text; dto.LeaveHospital = lbl_LeaveHospital.Text; dto.LeaveTime = timeControl_LeaveTime.TimeValue; if (lookUpEdit_ReceiveHospital.Text + "" == "请选择") { dto.ReceiveHospital = ""; } else { dto.ReceiveHospital = lookUpEdit_ReceiveHospital.Text; } dto.AppointHospital = textEdit_AppointHospital.Text; dto.TransferWay = radioGroup_TransferWay.EditValue + ""; dto.HospitalGuid = Information.Hospital.GUID; dto.CreatorID = Information.User.ID; dto.PatientGuid = PatientGuid; List baseInfoDTOs = new List(); string Url = string.Format("api/service/T_Service_Chest_UpwardReferral/AddORUpdate"); ClientFactory httpClient = new HttpClientFactory(); Client client = httpClient.VisitFactory(); baseInfoDTOs.Add(dto); //访问 ListEntity t = client.Post(Url, baseInfoDTOs); 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) { throw; } } private void simpleButton2_Click(object sender, EventArgs e) { try { if (dto == null) dto = new PatientReferralModelDTO(); dto.Name = lbl_name.Text; if (lbl_gender.Text == "未知") dto.Gender = 0; if (lbl_gender.Text == "男") dto.Gender = 1; if (lbl_gender.Text == "女") dto.Gender = 2; dto.Phone = lbl_phone.Text; dto.Medical_Insurance_Type = lbl_medical_Insurance_Type.Text; dto.Age = int.Parse(lbl_age.Text); dto.Inpatient_ID = lbl_inpatient_ID.Text; string tempnotice = ""; string temptext = ""; PublicClass.GetCheckedListBoxItemValues(checkedListBoxControl1, "|", out tempnotice, out temptext); dto.TransferNotice = tempnotice; dto.IllnessExplain = memo_IllnessExplain.Text; dto.LeaveHospital = lbl_LeaveHospital.Text; dto.LeaveTime = timeControl_LeaveTime.TimeValue; if (lookUpEdit_ReceiveHospital.Text + "" == "请选择") { dto.ReceiveHospital = ""; } else { dto.ReceiveHospital = lookUpEdit_ReceiveHospital.Text; } dto.AppointHospital = textEdit_AppointHospital.Text; dto.TransferWay = radioGroup_TransferWay.EditValue + ""; dto.HospitalGuid = Information.Hospital.GUID; dto.CreatorID = Information.User.ID; dto.PatientGuid = PatientGuid; Print.PrintUpwardReferral(dto, true); } catch (Exception ex) { throw; } } /// /// 患者转诊信息 /// /*private class PatientReferralModel { /// /// 创建人编号 /// public long CreatorID { get; set; } /// /// /// public string PatientGuid { get; set; } /// /// 所属院区GUID /// public string HospitalGuid { get; set; } /// /// 真实姓名 /// public string Name { get; set; } /// /// 性别 /// public int Gender { get; set; } /// /// 年龄 /// public int Age { get; set; } /// /// 移动电话 /// public string Phone { get; set; } /// /// 住院ID /// public string Inpatient_ID { get; set; } /// /// 医保类型 /// 1:城镇职工基本医疗保险 /// 2:新型农村合作医疗 /// 3:城镇居民基本医疗保险 /// 4:自费 /// 5:军免 /// public string Medical_Insurance_Type { get; set; } /// /// 转出时间 /// public string LeaveTime { get; set; } /// /// 病情摘要及情况 /// public string IllnessExplain { get; set; } /// /// 住院小结 /// public string HospitalSummary { get; set; } /// /// 后期治疗方案及建议 /// public string TreatmentPlan { get; set; } /// /// 转出医院 /// public string LeaveHospital { get; set; } /// /// 送往医院 /// public string SendHospital { get; set; } /// /// 患者/家属指定医院 /// public string DesignatedHospital { get; set; } /// /// 患者知情同意签字 /// public byte[] PatientSignature { get; set; } /// /// 转诊医生签字 /// public byte[] ReferringDoctorSignature { get; set; } /// /// 上转送往医院 /// public string ReceiveHospital { get; set; } /// /// 上转患者指定医院 /// public string AppointHospital { get; set; } /// /// 转送方式 /// public string TransferWay { get; set; } /// /// 转院须知 /// public string TransferNotice { get; set; } }*/ } }