public DoctorAppointmentAssignResult(int appoitnmentId) { InitializeComponent(); groupBox.Visibility = Visibility.Hidden; h_date.Visibility = Visibility.Hidden; h_diagnosis.Visibility = Visibility.Hidden; h_medication.Visibility = Visibility.Hidden; h_symptoms.Visibility = Visibility.Hidden; h_results.Visibility = Visibility.Hidden; _appointmentService = new AppointmentService(); _patientService = new PatientService(); _resultsService = new ResultsService(); _selectedAppointment = _appointmentService.FindById(appoitnmentId); _selectedPatient = _patientService.FindById(_selectedAppointment.IdPacient); nameLabel.Content = _selectedPatient.FirstName + " " + _selectedPatient.LastName; insuranceNumberLabel.Content = _selectedPatient.InsuranceNumber; geneticDisorderLabel.Content = _selectedPatient.GeneticDiseases; }
/// <summary> /// 把信息添加到医疗救助系统中 /// </summary> /// <param name="patient"></param> /// <returns></returns> public static bool InsertYiLiao_Users(Patient patient) { bool result = false; try { StringBuilder strSql = new StringBuilder(); strSql.Append(" insert into T_Med_Patient ("); strSql.Append(" Name,Sex,IdCard,Birthday,Tel,HomeId,HomeDetails,HelpId,PatientClass,HelpClass,HelpNums,HelpScale,"); strSql.Append(" HelpMax,CliMoney,CliBalance,PhaMoney,PhaBalance,IsHos,HosId,IsLock,AddTime,InHosId)"); strSql.Append(" values("); strSql.Append(" @Name,@Sex,@IdCard,@Birthday,@Tel,@HomeId,@HomeDetails,@HelpId,@PatientClass,@HelpClass,@HelpNums,@HelpScale,"); strSql.Append(" @HelpMax,@CliMoney,@CliBalance,@PhaMoney,@PhaBalance,@IsHos,@HosId,@IsLock,@AddTime,@InHosId) "); strSql.Append(" ;select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar,50), new SqlParameter("@Sex", SqlDbType.NVarChar,10), new SqlParameter("@IdCard", SqlDbType.NVarChar,20), new SqlParameter("@Birthday", SqlDbType.NVarChar,10), new SqlParameter("@Tel", SqlDbType.NVarChar,15), new SqlParameter("@HomeId", SqlDbType.Int,4), new SqlParameter("@HomeDetails", SqlDbType.NVarChar,100), new SqlParameter("@HelpId", SqlDbType.NVarChar,50), new SqlParameter("@PatientClass", SqlDbType.Int,4), new SqlParameter("@HelpClass", SqlDbType.Int,4), new SqlParameter("@HelpNums", SqlDbType.Int,4), new SqlParameter("@HelpScale", SqlDbType.NVarChar,20), new SqlParameter("@HelpMax", SqlDbType.Decimal), new SqlParameter("@CliMoney", SqlDbType.Decimal), new SqlParameter("@CliBalance", SqlDbType.Decimal), new SqlParameter("@PhaMoney", SqlDbType.Decimal), new SqlParameter("@PhaBalance", SqlDbType.Decimal), new SqlParameter("@IsHos", SqlDbType.Int,2), new SqlParameter("@HosId", SqlDbType.Int,4), new SqlParameter("@IsLock", SqlDbType.Int,2), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@InHosId", SqlDbType.Int) }; parameters[0].Value = patient.Name; parameters[1].Value = patient.Sex; parameters[2].Value = patient.IdCard; parameters[3].Value = patient.Birthday; parameters[4].Value = patient.Tel; parameters[5].Value = patient.HomeId; parameters[6].Value = patient.HomeDetails; parameters[7].Value = patient.HelpId; parameters[8].Value = patient.PatientClass; parameters[9].Value = patient.HelpClass; parameters[10].Value = patient.HelpNums; parameters[11].Value = patient.HelpScale; parameters[12].Value = patient.HelpMax; parameters[13].Value = patient.CliMoney; parameters[14].Value = patient.CliBalance; parameters[15].Value = patient.PhaMoney; parameters[16].Value = patient.PhaBalance; parameters[17].Value = 0; parameters[18].Value = null; parameters[19].Value = 0; parameters[20].Value = DateTime.Now; parameters[21].Value = null; int count = DbHelperSQL.ExecuteSql1(strSql.ToString(), parameters); if (count == 1) { result = true; } } catch (Exception e) { Log4Net.LogWrite("err", "Controler.Med_Ass.InsertYiLiao_Users:" + e.Message); } return result; }
public void PatientUpdateTest() { string lastName = GenString(_r.Next(4, 9)); string firstName = GenString(_r.Next(4, 9)); OpenConnection(); Credentials c = new Credentials(lastName + firstName + "@testPatient.com", Utils.Encrypter.GetMD5("0000"), Utils.UserTypes.PATIENT); Patient p = new Patient(credentialsService.Save(c), lastName, firstName, "instsav363", "address", System.DateTime.Now, "geneticsDis", "54468413"); patientService.Save(p); p.GeneticDiseases = "new genetics"; patientService.Update(p); Assert.IsNotNull(patientService.FindAllByProperty(Utils.PatientTableProperties.GeneticDisorder, p.GeneticDiseases)); CloseConnection(); }
/// <summary> /// using SessionData.UserSessionData finds which user is currently logged in, /// using PatientService retrieve data from database about the current user, in order to fill the fields of the edit form /// </summary> private void PopulateUserForm() { _patientService = new PatientService(); _patient = _patientService.FindById(SessionData.UserSessionData.CurrentUserId); if (_patient != null) { textBoxUserFirstName.Text = _patient.FirstName; textBoxUserLastName.Text = _patient.LastName; textBoxUserAddress.Text = _patient.Address; textBoxUserPhone.Text = _patient.PhoneNumber; datePickerUserBirthdate.SelectedDate = _patient.BirthDate; textBoxUserGeneticDisorder.Text = _patient.GeneticDiseases; textBoxUserInsuranceNr.Text = _patient.InsuranceNumber; } }