public bool SavePatient(CommContracts.Patient Patient) { using (DAL.HisContext ctx = new DAL.HisContext()) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <CommContracts.Patient, DAL.Patient>(); }); var mapper = config.CreateMapper(); DAL.Patient temp = new DAL.Patient(); temp = mapper.Map <DAL.Patient>(Patient); ctx.Patients.Add(temp); try { ctx.SaveChanges(); } #pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过 catch (Exception ex) #pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过 { return(false); } } return(true); }
private void LoadAllRegistration() { var vm = this.DataContext as HISGUIClinicDoctorWorkVM; if (vm == null) { return; } // 链接数据库,wcf报错,未解决,改用假数据暂时支撑。 //List<CommContracts.ClinicRegistration> list = vm.getAllClinicRegistration(); //this.m_候诊List.ItemsSource = list; List <CommContracts.ClinicRegistration> list = new List <CommContracts.ClinicRegistration>(); for (int i = 0; i < 10; i++) { CommContracts.Patient patient = new CommContracts.Patient(); patient.Name = "患者" + (i + 1); patient.ID = i + 1; patient.Gender = CommContracts.GenderEnum.男; CommContracts.ClinicRegistration clinic = new CommContracts.ClinicRegistration(); clinic.ID = i + 1; clinic.PatientID = patient.ID; clinic.RegistrationTime = DateTime.Now; clinic.VistDoctorDate = DateTime.Now;; clinic.Patient = patient; list.Add(clinic); } this.m_候诊List.ItemsSource = list; }
private void updatePatientsMsg(String strPatientCardNum) { var vm = this.DataContext as HISGUIFeeVM; CommContracts.Patient patient = new CommContracts.Patient(); string strAge = ""; if (string.IsNullOrEmpty(strPatientCardNum)) { vm.CurrentPatient = patient; this.AgeBox.Text = strAge; return; } CommClient.Patient patientClient = new CommClient.Patient(); string ErrorMsg = ""; patient = patientClient.ReadCurrentPatientByPatientCardNum(strPatientCardNum, ref ErrorMsg); if (patient == null) { MessageBox.Show(ErrorMsg); } else { vm.CurrentPatient = patient; strAge = IDCardHellper.GetAge(patient.BirthDay.Value.Year, patient.BirthDay.Value.Month, patient.BirthDay.Value.Day); this.AgeBox.Text = strAge; } }
private void CallBtn_Click(object sender, RoutedEventArgs e) { var vm = this.DataContext as HISGUIDoctorVM; vm.IsClinicOrInHospital = true; String strPatientCardNum = Interaction.InputBox("请输入就诊卡卡号", "读卡", "", 100, 100); if (string.IsNullOrEmpty(strPatientCardNum)) { return; } CommClient.Patient patientClient = new CommClient.Patient(); string ErrorMsg = ""; CommContracts.Patient patient = patientClient.ReadCurrentPatientByPatientCardNum(strPatientCardNum, ref ErrorMsg); CommClient.Registration registrationClient = new CommClient.Registration(); List <CommContracts.Registration> list = registrationClient.GetPatientRegistrations(patient.ID, DateTime.Now); if (list == null || list.Count() <= 0) { return; } vm.CurrentRegistration = list.ElementAt(0); }
private bool updateViewToInDate() { if (this.GenderCombo.SelectedItem == null) { return(false); } var vm = this.DataContext as HISGUIFeeVM; if (MyCurrentInpatient != null) { MyCurrentInpatient.NO = this.InHospitalNo.Text; //MyCurrentInpatient.CaseNo = this.CaseNo.Text; //MyCurrentInpatient.BaoXianEnum = (CommContracts.BaoXianEnum)this.PayTypeEnumCombo.SelectedItem; //MyCurrentInpatient.YiBaoNo = this.YiBaoNo.Text; CommContracts.Patient patient = new CommContracts.Patient(); if (MyCurrentInpatient.Patient != null) { patient.ID = MyCurrentInpatient.Patient.ID; } patient.Name = this.Name.Text; patient.Gender = (CommContracts.GenderEnum) this.GenderCombo.SelectedItem; if (this.BirthDay.SelectedDate.HasValue) { patient.BirthDay = this.BirthDay.SelectedDate.Value; } patient.ZhengJianNum = this.IDCardNo.Text; patient.Volk = (CommContracts.VolkEnum) this.VolkEnumCombo.SelectedItem; patient.JiGuan_Sheng = this.JiGuan.Text; patient.Tel = this.Tel.Text; MyCurrentInpatient.Patient = patient; //MyCurrentInpatient.MarriageEnum = (CommContracts.MarriageEnum)this.MarriageEnumCombo.SelectedItem; //MyCurrentInpatient.Job = this.Job.Text; //MyCurrentInpatient.WorkAddress = this.WorkUnitAddress.Text; //MyCurrentInpatient.ContactsName = this.ConnectsName.Text; //MyCurrentInpatient.ContactsTel = this.ConnectsTel.Text; //MyCurrentInpatient.ContactsAddress = this.ConnectsAddress.Text; MyCurrentInpatient.InTime = this.InHospitalTime.SelectedDate.Value; //MyCurrentInpatient.IllnesSstateEnum = (CommContracts.IllnesSstateEnum)this.IllnesSstateEnumCombo.SelectedItem; MyCurrentInpatient.Diagnosis = this.InHospitalDiagnosis.Text; //MyCurrentInpatient.InHospitalDepartment = this.InDepartmentEdit.Text; //MyCurrentInpatient.InHospitalDoctorName = this.InDoctorEdit.Text; //"_" = this.InHospitalYaJin.Text; MyCurrentInpatient.UserID = vm.CurrentUser.ID; } return(true); }
public bool UpdatePatient(CommContracts.Patient Patient, ref string ErrorMsg) { using (DAL.HisContext ctx = new DAL.HisContext()) { var temp = ctx.Patients.FirstOrDefault(m => m.ID == Patient.ID); if (temp != null) { temp.Name = Patient.Name; temp.PID = Patient.PID; temp.PatientCardEnum = (DAL.PatientCardEnum)Patient.PatientCardEnum; temp.PatientCardNo = Patient.PatientCardNo; temp.Gender = (DAL.GenderEnum)Patient.Gender; temp.BirthDay = Patient.BirthDay; temp.ZhengJianEnum = (DAL.ZhengJianEnum)Patient.ZhengJianEnum; temp.ZhengJianNum = Patient.ZhengJianNum; temp.HunYin = (DAL.HunYinEnum)Patient.HunYin; temp.Country = (DAL.CountryEnum)Patient.Country; temp.PatientJob = (DAL.PatientJobEnum)Patient.PatientJob; temp.JobUnit = Patient.JobUnit; temp.JobUnitTel = Patient.JobUnitTel; temp.HomeAddress = Patient.HomeAddress; temp.HomeTel = Patient.HomeTel; temp.ConnectName = Patient.ConnectName; temp.ConnectTel = Patient.ConnectTel; temp.ConnectGuanXi = (DAL.GuanXiEnum)Patient.ConnectGuanXi; temp.Volk = (DAL.VolkEnum)Patient.Volk; temp.Tel = Patient.Tel; temp.JiGuan_Sheng = Patient.JiGuan_Sheng; temp.JiGuan_Shi = Patient.JiGuan_Shi; temp.JiGuan_Xian = Patient.JiGuan_Xian; temp.FeeTypeEnum = (DAL.FeeTypeEnum)Patient.FeeTypeEnum; temp.YbCardNo = Patient.YbCardNo; temp.PatientCardStatus = (DAL.PatientCardStatusEnum)Patient.PatientCardStatus; temp.PatientCardBalance = Patient.PatientCardBalance; } else { return(false); } try { ctx.SaveChanges(); } catch (Exception ex) { ErrorMsg = ex.Message; return(false); } } return(true); }
private void ReadCardBtn_Click(object sender, RoutedEventArgs e) { // 读卡 //var vm = this.DataContext as HISGUIFeeVM; //if (InManageCheck.IsChecked.Value) //{ // MyCurrentInpatient = vm?.ReadNewInHospital(7); //} //else if (LeaveManageCheck.IsChecked.Value) //{ // MyCurrentInpatient = vm?.ReadCurrentInHospital(9); //} //else if (RecallManageCheck.IsChecked.Value) //{ // MyCurrentInpatient = vm?.ReadLeavedPatient(9); //} //updateInDateToView(); //updateLeaveDateToView(); String strPatientCardNum = Interaction.InputBox("请输入就诊卡卡号", "读卡", "", 100, 100); if (string.IsNullOrEmpty(strPatientCardNum)) { return; } var vm = this.DataContext as HISGUIFeeVM; CommContracts.Patient tempPatient = new CommContracts.Patient(); CommClient.Patient patientClient = new CommClient.Patient(); string ErrorMsg = ""; tempPatient = patientClient.ReadCurrentPatientByPatientCardNum(strPatientCardNum, ref ErrorMsg); vm.CurrentPatient = tempPatient; CommClient.InHospital registrationClient = new CommClient.InHospital(); List <CommContracts.InHospital> InHospitalList = registrationClient.GetAllInHospitalList(0, vm.CurrentPatient.Name); if (InHospitalList == null || InHospitalList.Count() <= 0) { return; } MyCurrentInpatient = InHospitalList.ElementAt(0); updateInDateToView(); updateLeaveDateToView(); }
private void SaveBtn_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(this.Name.Text.Trim())) { return; } if (this.GenderCombo.SelectedItem == null) { return; } if (bIsEdit) { Patient.Name = this.Name.Text.Trim(); Patient.ZhengJianNum = this.IDCardNo.Text; Patient.JiGuan_Sheng = this.JiGuan.Text; Patient.Tel = this.Tel.Text; Patient.Gender = (CommContracts.GenderEnum) this.GenderCombo.SelectedItem; Patient.Volk = (CommContracts.VolkEnum) this.VolkEnumCombo.SelectedItem; Patient.BirthDay = this.BirthDay.SelectedDate; CommClient.Patient myd = new CommClient.Patient(); string error = ""; if (myd.UpdatePatient(Patient, ref error)) { (this.Parent as Window).DialogResult = true; (this.Parent as Window).Close(); } } else { CommContracts.Patient patient = new CommContracts.Patient(); patient.Name = this.Name.Text.Trim(); patient.ZhengJianNum = this.IDCardNo.Text.Trim(); patient.JiGuan_Sheng = this.JiGuan.Text.Trim(); patient.Tel = this.Tel.Text.Trim(); patient.Gender = (CommContracts.GenderEnum) this.GenderCombo.SelectedItem; patient.Volk = (CommContracts.VolkEnum) this.VolkEnumCombo.SelectedItem; patient.BirthDay = this.BirthDay.SelectedDate; CommClient.Patient myd = new CommClient.Patient(); if (myd.SavePatient(patient)) { (this.Parent as Window).DialogResult = true; (this.Parent as Window).Close(); } } }
private void clearAllDate() { var vm = this.DataContext as HISGUIFeeVM; CommContracts.Patient patient = new CommContracts.Patient(); vm.CurrentPatient = patient; currentRegistration = new CommContracts.Registration(); departmentList.SelectedItem = null; SignalSourceGrid.SelectedItem = null; SignalList.SelectedItem = null; updateSignalList(); updateSignalSourceMsg(); }
public CommContracts.Patient ReadCurrentPatientByPatientCardNum(string strPatientCardNum, ref string ErrorMsg) { using (DAL.HisContext ctx = new DAL.HisContext()) { CommContracts.Patient patient = new CommContracts.Patient(); try { var query = from p in ctx.Patients where p.PatientCardNo == strPatientCardNum select p; if (query.Count() == 1) { var DALpatient = query.First(); var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.Patient, CommContracts.Patient>(); }); var mapper = config.CreateMapper(); patient = mapper.Map <CommContracts.Patient>(DALpatient); ErrorMsg = ""; } else if (query.Count() < 1) { ErrorMsg = "未找到"; return(null); } else if (query.Count() > 1) { ErrorMsg = "找到多个"; return(null); } } catch (Exception ex) { ErrorMsg = ex.Message; return(null); } return(patient); } }
public EditPatientView(CommContracts.Patient patient = null) { InitializeComponent(); GenderCombo.ItemsSource = Enum.GetValues(typeof(CommContracts.GenderEnum)); VolkEnumCombo.ItemsSource = Enum.GetValues(typeof(CommContracts.VolkEnum)); bIsEdit = false; if (patient != null) { this.Patient = patient; this.Name.Text = patient.Name; this.IDCardNo.Text = patient.ZhengJianNum; this.JiGuan.Text = patient.JiGuan_Sheng; this.Tel.Text = patient.Tel; this.GenderCombo.Text = patient.Gender.ToString(); this.VolkEnumCombo.Text = patient.Volk.ToString(); this.BirthDay.SelectedDate = patient.BirthDay; bIsEdit = true; } }
public CommContracts.Patient ReadCurrentPatient(int PatientID) { using (DAL.HisContext ctx = new DAL.HisContext()) { CommContracts.Patient patient = new CommContracts.Patient(); var temp = ctx.Patients.Find(PatientID); if (temp == null) { return(patient); } var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.Patient, CommContracts.Patient>(); }); var mapper = config.CreateMapper(); patient = mapper.Map <CommContracts.Patient>(temp); return(patient); } }
/// <summary> /// 新建卡 /// </summary> private void newPatientCard() { CommClient.Patient patientClient = new CommClient.Patient(); CommContracts.Patient tempPatient = new CommContracts.Patient(); tempPatient.PID = patientClient.getNewPID(); tempPatient.PatientCardNo = patientClient.getNewPatientCardNum(); var vm = this.DataContext as HISGUIPatientCardVM; vm.CurrentPatient = tempPatient; this.PatientMsgGrid.IsEnabled = true; this.bIsEdit = false; this.EditBtn.IsEnabled = false; this.LostBtn.IsEnabled = false; this.ReNewBtn.IsEnabled = false; this.txt_Name.Focus(); this.ManageCardRecordsList.SelectedItems.Clear(); this.ManageCardRecordsList.ItemsSource = null; }
private void ShowPatientMsg() { var vm = this.DataContext as HISGUIFeeVM; CommContracts.Patient tempPatient = vm?.ReadCurrentPatient(PatientID); decimal?dBalance = vm?.GetCurrentPatientBalance(PatientID); PatientMsg.Inlines.Clear(); string str = "姓名:" + tempPatient.Name + " " + "性别:" + tempPatient.Gender + " " + "生日:" + tempPatient.BirthDay + " " + "身份证号:" + tempPatient.ZhengJianNum + " " + "民族:" + tempPatient.Volk + " " + "籍贯:" + tempPatient.JiGuan_Sheng + " " + "电话:" + tempPatient.Tel + " " ; PatientMsg.Inlines.Add(new Run(str)); PatientMsg.Inlines.Add(new Run("账户余额:" + dBalance.Value) { Foreground = Brushes.Green, FontSize = 25 }); }
// 读取未入院患者信息,并新建入院登记 public CommContracts.InHospital ReadNewInHospital(int PatientID) { CommContracts.InHospital temp = new CommContracts.InHospital(); using (DAL.HisContext ctx = new DAL.HisContext()) { var query = from a in ctx.Patients where a.ID == PatientID select a; foreach (DAL.Patient ass in query) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <DAL.Patient, CommContracts.Patient>(); }); var mapper = config.CreateMapper(); CommContracts.Patient patient = mapper.Map <CommContracts.Patient>(ass); temp.Patient = patient; break; } } return(temp); }
/// <summary> /// 更新患者登记信息 /// </summary> public bool UpdatePatientMsg(CommContracts.Patient patient, ref string ErrorMsg) { CommClient.Patient client = new CommClient.Patient(); return(client.UpdatePatient(patient, ref ErrorMsg)); }