public async Task Given_Patient_Sets_Latitude_LongitudeAsync_Returns_Patient() { IConfiguration config = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var patientHelper = new PatientHelper(config); var patient = new Patient { Name = "Patient", Bsn = "Bsn", Email = "*****@*****.**", Dob = DateTime.Now, Gender = Gender.Male, PhoneNumber = "PhoneNumber", City = "Hank", Street = "Lepelaarstraat", HouseNumber = "20", HouseNumberAddon = null, PostalCode = "4273CV", Country = "Netherlands" }; var result = await patientHelper.AddLatLongToPatient(patient); Assert.Equal(result.Name, patient.Name); Assert.True(result.Latitude > 0); Assert.True(result.Longitude > 0); }
public HttpResponseMessage GetEmployee(string clinicName) { HttpResponseMessage response = new HttpResponseMessage(); // 返回所有当前科室下所有医生的所有信息 // employee表找到clinic符合的医生 // 返回医生的所有信息 ArrayList list = null; try { list = PatientHelper.GetEmployeeOfClinic(clinicName); } catch (Exception e) { response.Content = new StringContent(e.Message + " ClinicName:" + clinicName); response.StatusCode = HttpStatusCode.BadRequest; return(response); } if (list == null) { response.Content = new StringContent("查询失败,请检查科室名是否正确或服务器内部错误 ClinicName:" + clinicName); response.StatusCode = HttpStatusCode.NotFound; } else { response.Content = new StringContent(JsonObjectConverter.ObjectToJson(list)); response.StatusCode = HttpStatusCode.OK; } return(response); }
public void CanGetEnumerator() { // Arrange int expectedEntries = 3; bool notNull; bool notEmpty; bool correctAmount; PatientHelper.ManualStorageInsertion(PatientHelper.GetNewPatient(), PatientRepo.Link.FullPath); PatientHelper.ManualStorageInsertion(PatientHelper.GetNewPatient(), PatientRepo.Link.FullPath, true); PatientHelper.ManualStorageInsertion(PatientHelper.GetNewPatient(), PatientRepo.Link.FullPath, true); // Act List <IPatient> patients = PatientRepo.Link.GetEnumerable().ToList(); notNull = patient != null; notEmpty = patients?.Count != 0; correctAmount = patients?.Count == 3; // Assert Assert.True(notNull && notEmpty && correctAmount, $" {AssertHelper.ValidatorMessage ("Is Null:", !notNull, !notNull, false)} <|> {AssertHelper.ValidatorMessage ("Is Empty:", !notEmpty, ( ( patient != null ) ? ( patients.Count.ToString () ) : ( "NaN" ) ), "> 0")} <|> {AssertHelper.ValidatorMessage ("Correct Amount:", correctAmount, ( ( patients != null ) ? ( patients.Count.ToString () ) : ( "NaN" ) ), expectedEntries)}"); currentIDIndex++; // Incrementing the ID index in case another patient is created after this test currentIDIndex++; // Incrementing the ID index in case another patient is created after this test currentIDIndex++; // Incrementing the ID index in case another patient is created after this test }
private void button1_Click(object sender, EventArgs e) { Firebase.Firebase firebase = new Firebase.Firebase(); Patient patient = new Patient() { id = currentPatient.id, firstname = txtFirstname.Text, middlename = txtMiddleName.Text, lastname = txtLastname.Text, gender = char.Parse(cmbGender.SelectedItem.ToString()), birthdate = dtpBirthdate.Value, birthplace = txtBirthplace.Text, contact = txtContact.Text, emergency_contact = txtEmergencyContact.Text, address = txtStreet.Text + "/" + txtBaranggay.Text + "/" + txtCity.Text, occupation = txtOccupation.Text, citizenship = txtCitizenship.Text, religion = txtReligion.Text, }; PatientHelper.Update(patient); firebase.UpdatePatientMember(patient); this.DialogResult = System.Windows.Forms.DialogResult.OK; }
public HttpResponseMessage GetSingleEmployee(string employeeId) { HttpResponseMessage response = new HttpResponseMessage(); EmployeeWithComment employeeWithComment = PatientHelper.GetDoctor(employeeId); if (employeeWithComment == null) { response.Content = new StringContent("未找到医生"); response.StatusCode = HttpStatusCode.NotFound; } else { employeeWithComment.comment = PatientHelper.GetCommentByDocId(employeeId); if (employeeWithComment.comment == null) { response.Content = new StringContent("查询失败"); response.StatusCode = HttpStatusCode.NotFound; } else if (employeeWithComment.comment.Count == 0) { response.Content = new StringContent("评论列表空"); response.StatusCode = HttpStatusCode.OK; } else { response.Content = new StringContent(JsonObjectConverter.ObjectToJson(employeeWithComment)); response.StatusCode = HttpStatusCode.OK; } } return(response); }
//done //获取所有科室名称 public HttpResponseMessage GetAllClinic() { // 只需要获取名字就可以了 // Clinic表获取所有名称 ArrayList list = PatientHelper.GetAllClinic(); HttpResponseMessage response = new HttpResponseMessage(); if (list == null) { response.Content = new StringContent("查询失败"); response.StatusCode = HttpStatusCode.NotFound; } else if (list.Count == 0) { response.Content = new StringContent("查询列表空"); response.StatusCode = HttpStatusCode.OK; } else { response.Content = new StringContent(JsonObjectConverter.ObjectToJson(list)); response.StatusCode = HttpStatusCode.OK; } return(response); }
public void ParseHL7Message() { string hl7Message = PatientHelper.CreateSampleHL7Message(); List <Patient> objPatientList = PatientHelper.CreateListOfPatient(); Patient objPatientToValidate = objPatientList[0]; Patient parsedObj = objPatientToValidate.Parse(hl7Message); parsedObj.ShouldBeEquivalentTo(objPatientToValidate); }
public Patient(int id, string firstName, string lastName, string pesel) { Id = id; FirstName = firstName; LastName = lastName; PESEL = pesel; FullName = PatientHelper.GetFullName(firstName, lastName); Visits = new List <Visit>(); }
private void Initiate() { if (!Directory.Exists(TravelerJournalRepo.Link.StoragePath)) { Directory.CreateDirectory(TravelerJournalRepo.Link.StoragePath); } patient = PatientHelper.GetNewPatient(); journal = JournalFactory.CreateWithPatient(JournalType.TravelerJournal, patient) as ITravelerJournal; currentIDIndex++; }
public void CreateHL7MessageAndVerify() { List <Patient> objPatientList = PatientHelper.CreateListOfPatient(); foreach (var objPatient in objPatientList) { string hl7Message = objPatient.Encode(objPatient); Patient parsedObj = objPatient.Parse(hl7Message); objPatient.ShouldBeEquivalentTo(parsedObj); } }
public MainWindow() { InitializeComponent(); // Wyświetlenie aplikacji na środku ekranu WindowStartupLocation = WindowStartupLocation.CenterScreen; // Wyświetlenie obrazków na przyciskach InsertImage("image/Add.png", BAdd); InsertImage("image/Search.png", BSearch); InsertImage("image/Settings.png", BSettings); InsertImage("image/print.png", BPrint); patientsListBox.ItemsSource = PatientHelper.GetPatients("127.0.0.0.1", 10010, "KLIENTL", "ARCHIWUM"); }
/// <summary> /// Displays all the registered patients in the hospital. /// </summary> public static void ShowRegisteredPatients() { if (!Console.IsOutputRedirected) { Console.Clear(); } if (HospitalConfiguration.GetInstance().Patients.Count() == 0) { Console.WriteLine("No registered patients yet."); return; } HospitalConfiguration.GetInstance().Patients.ForEach(patient => PatientHelper.PrintPatientInfo(patient)); }
//评价医生 public HttpResponseMessage Comment(dynamic obj) { string patient_id = HttpContext.Current.User.Identity.Name; HttpResponseMessage response = new HttpResponseMessage(); // 向evaluation插入相关评价 // 返回评价后的界面 //反序列化的过程 Evaluation evaluation = new Evaluation(); try { evaluation = JsonConvert.DeserializeAnonymousType(JsonObjectConverter.ObjectToJson(obj), evaluation); } catch (Exception e) { response.Content = new StringContent("参数传递出错,反序列化失败!"); response.StatusCode = HttpStatusCode.Forbidden; return(response); } evaluation.patient_id = patient_id; //数据库更新相关评论 //多次评价限制 try { if (!PatientHelper.Comment(evaluation)) { response.Content = new StringContent("由于某些原因,评价失败~"); response.StatusCode = HttpStatusCode.Forbidden; } else { response.Content = new StringContent("评价成功~"); response.StatusCode = HttpStatusCode.OK; } } catch (Exception e) { response.Content = new StringContent("只能评价一次哦~"); response.StatusCode = HttpStatusCode.BadRequest; } return(response); }
public void CanDeletePatient() { // Arrange int expectedID = currentIDIndex; bool didDelete; bool wasNull; PatientHelper.ManualStorageInsertion(patient, PatientRepo.Link.FullPath); // Act didDelete = PatientRepo.Link.DeleteData(patient); wasNull = !PatientHelper.CheckIDFromStorage(expectedID, PatientRepo.Link.FullPath); // Assert Assert.True(didDelete && wasNull, $"{AssertHelper.ValidatorMessage ("Did Delete:", didDelete, didDelete, true)} <|> {AssertHelper.ValidatorMessage ("Was Null:", wasNull, wasNull, true)}"); }
public void A_CanInsertPatient() { // Arrange int expectedID; bool didInsert; bool ensuredInsertion; // Act expectedID = currentIDIndex; didInsert = PatientRepo.Link.InsertData(patient); ensuredInsertion = PatientHelper.CheckIDFromStorage(expectedID, PatientRepo.Link.FullPath); // Assert Assert.True(didInsert && ensuredInsertion, $"{AssertHelper.ValidatorMessage ("Did Insert:", didInsert, didInsert, true)} <|> {AssertHelper.ValidatorMessage ("Ensured Insertion:", ensuredInsertion, patient.ID, expectedID)}"); }
private void PopulateListView() { patients = PatientHelper.GetPatients(); ListViewItem item; lsvPatient.Items.Clear(); foreach (var p in patients) { item = lsvPatient.Items.Add(p.id); item.SubItems.Add(p.firstname); item.SubItems.Add(p.middlename); item.SubItems.Add(p.lastname); item.SubItems.Add(p.gender.ToString()); item.SubItems.Add((p.isRegistered == 0) ? "Pending" : "Member"); } }
public void CanUpdatePatient() { // Arrange bool updated; bool validated; string orignalValue = patient.ChildFathersName; PatientHelper.ManualStorageInsertion(patient, PatientRepo.Link.FullPath); // Act patient.ChildFathersName = "MyChangedChildFathersName"; updated = PatientRepo.Link.UpdateData(patient); validated = PatientHelper.CheckValueFromStorage(patient.ChildFathersName, PatientRepo.Link.FullPath); patient.ChildFathersName = orignalValue; // Asserts Assert.True(updated && validated, $"{AssertHelper.ValidatorMessage ("Updated:", updated, updated, true)} <|> {AssertHelper.ValidatorMessage ("Validated:", validated, validated, true)}"); }
public void CanGetByID() { // Arrange int expectedID; IPatient retrievedPatient; bool notNull; bool correctID; PatientHelper.ManualStorageInsertion(patient, PatientRepo.Link.FullPath); // Ensuring that an entry exists in storage // Act expectedID = patient.ID; retrievedPatient = PatientRepo.Link.GetDataByIdentifier(patient.ID); notNull = (retrievedPatient != null); correctID = (retrievedPatient?.ID == expectedID); // Assert Assert.True(notNull && correctID, $"{AssertHelper.ValidatorMessage ("Is Null:", !notNull, !notNull, false)} <|> {AssertHelper.ValidatorMessage ("Correct ID:", correctID, ( ( notNull ) ? ( retrievedPatient.ID.ToString () ) : ( "NaN" ) ), expectedID)}"); }
//done //根据医疗流水号找到相关医生的id和name,返回一个arraylist{doc_id,doc_name} public HttpResponseMessage GetDoctorIdName(string treatment_id) { HttpResponseMessage response = new HttpResponseMessage(); ArrayList doctorIdName = PatientHelper.GetDoctorIdName(treatment_id); if (doctorIdName == null) { response.Content = new StringContent("查询医生未找到"); response.StatusCode = HttpStatusCode.NotFound; } else { response.Content = new StringContent(JsonObjectConverter.ObjectToJson(doctorIdName)); response.StatusCode = HttpStatusCode.OK; } return(response); }
public void CanUpdateTravelerJournal() { // Arrange Initiate(); bool updated; bool validated; string orignalValue = journal.PatientData.ChildFathersName; JournalHelper.ManualStorageInsertion(journal, JournalType.TravelerJournal, TravelerJournalRepo.Link.StoragePath); PatientHelper.ManualStorageInsertion(patient, PatientRepo.Link.FullPath); // Act journal.PatientData.ChildFathersName = "MyChangedChildFathersName"; updated = TravelerJournalRepo.Link.UpdateData(journal); validated = PatientHelper.CheckValueFromStorage(journal.PatientData.ChildFathersName, PatientRepo.Link.FullPath); journal.PatientData.ChildFathersName = orignalValue; CleanUp(); // Asserts Assert.True(updated && validated, $"{AssertHelper.ValidatorMessage ("Updated:", updated, updated, true)} <|> {AssertHelper.ValidatorMessage ("Validated:", validated, validated, true)}"); }
public HttpResponseMessage GetEmployeeDutyTime(string employeeId) { HttpResponseMessage response = new HttpResponseMessage(); // 返回医生值班的时间 // employee表找到duty_id // duty表找到所有数据 Duty employeeDuty = PatientHelper.GetEmployeeDutyTime(employeeId); //duty不存在 if (employeeDuty == null) { response.Content = new StringContent("医生Id错误,或医生没有值班信息"); response.StatusCode = HttpStatusCode.NotFound; } else { response.Content = new StringContent(JsonObjectConverter.ObjectToJson(employeeDuty)); response.StatusCode = HttpStatusCode.OK; } return(response); }
public PatientRepoTests() { patient = PatientFactory.Create(PatientHelper.GetPatientData(), PatientHelper.GetSocialData()); currentIDIndex++; // Incrementing the ID index in case another patient is created after this test }
public PatientController() { _patientHelper = new PatientHelper(); }
public HttpResponseMessage Register(dynamic obj) { HttpResponseMessage response = new HttpResponseMessage(); string time; string employeeId; try { time = obj.time.Value; employeeId = obj.doctorId.Value; } catch (Exception e) { response.Content = new StringContent(e.Message); response.StatusCode = HttpStatusCode.BadRequest; return(response); } string patientId = HttpContext.Current.User.Identity.Name; if (employeeId == null || employeeId.Equals("")) { // 这url不合法 response.Content = new StringContent("Url不合法!"); response.StatusCode = HttpStatusCode.BadRequest; return(response); } else { // Url合法 EmployeeInfo employeeInfo = UserHelper.GetEmployeeInfo(employeeId); //判断医生是否有空 if (employeeInfo == null) { response.Content = new StringContent("医生不存在"); response.StatusCode = HttpStatusCode.BadRequest; } // 创建挂号记录 Treatment treatment = new Treatment(); //设置预约挂号时间段 treatment.patient_id = patientId; DateTime treatTime = Convert.ToDateTime(time); DateTime treatEndTime = treatTime.AddHours(1); treatment.start_time = treatTime; treatment.end_time = treatEndTime; //添加医生Id treatment.doc_id = employeeId; // 根据employeeId找到医生的科室 treatment.clinic = employeeInfo.clinic; // 设置挂号金额 Random ran = new Random(); treatment.pay = 100 * ran.NextDouble(); // treatment 表插入一条记录 string treatment_id = PatientHelper.RegisterTreat(treatment); if (treatment == null) { response.Content = new StringContent("挂号失败"); response.StatusCode = HttpStatusCode.BadRequest; } else { response.Content = new StringContent("挂号成功:" + "\n" + employeeId + time + "\n" + "挂号单id:" + treatment_id); response.StatusCode = HttpStatusCode.OK; } // 得到这条记录的主码 // takes表插入患者id treatment id 医生id设为空, 等接诊成功时再填充doc_id } //response.Content = new StringContent(employeeId + " " + time); return(response); }
public HttpResponseMessage GetTreatmentID() { HttpResponseMessage response = new HttpResponseMessage(); string patient_id = HttpContext.Current.User.Identity.Name; // treatment表调取数据 ArrayList list = null; try { list = PatientHelper.GetTreatmentInfo(patient_id); } catch (Exception e) { response.Content = new StringContent(e.Message); response.StatusCode = HttpStatusCode.NotFound; return(response); } ArrayList returnList = new ArrayList(); if (list == null) { response.Content = new StringContent("查询失败"); response.StatusCode = HttpStatusCode.NotFound; } else if (list.Count == 0) { response.Content = new StringContent(JsonObjectConverter.ObjectToJson(returnList)); response.StatusCode = HttpStatusCode.OK; } else { for (int i = 0; i < list.Count; i++) { Treatment treatment = (Treatment)list[i]; TreatPayInfo treatPayInfo = new TreatPayInfo(); treatPayInfo.docName = PatientHelper.GetDoctorNameById(treatment.doc_id); treatPayInfo.pay = treatment.pay; treatPayInfo.clinicName = treatment.clinic; treatPayInfo.treatId = treatment.treat_id; treatPayInfo.treatTime = treatment.start_time.ToString(); if (treatment.pay_time.Year == 1) { treatPayInfo.isPay = false; } else { treatPayInfo.isPay = true; } returnList.Add(treatPayInfo); } response.Content = new StringContent(JsonObjectConverter.ObjectToJson(returnList)); response.StatusCode = HttpStatusCode.OK; } return(response); }
public HttpResponseMessage GetAllCost(string treatmentId) { HttpResponseMessage response = new HttpResponseMessage(); ArrayList list = new ArrayList(); try { list = PatientHelper.GetAllConsumption(treatmentId); } catch (Exception e) { response.Content = new StringContent(e.Message); response.StatusCode = HttpStatusCode.BadRequest; return(response); } ArrayList returnList = new ArrayList(); if (list == null) { response.Content = new StringContent("查询失败"); response.StatusCode = HttpStatusCode.NotFound; } else if (list.Count == 0) { response.Content = new StringContent("查询列表空"); response.StatusCode = HttpStatusCode.OK; } else { try { for (int i = 0; i < list.Count; i++) { ArrayList costList = (ArrayList)list[i]; ArrayList payList; switch (i) { case 0: payList = new ArrayList(); for (int j = 0; j < costList.Count; j++) { Treatment examination = (Treatment)costList[j]; DetailCostInfo detailCostInfo = new DetailCostInfo(); detailCostInfo.cost = examination.pay; detailCostInfo.costId = examination.treat_id; detailCostInfo.docName = PatientHelper.GetDoctorNameById(examination.doc_id); detailCostInfo.startTime = examination.start_time.ToString(); if (examination.pay_time.Year == 1) { detailCostInfo.isPay = false; } else { detailCostInfo.isPay = true; } payList.Add(detailCostInfo); } returnList.Add(payList); break; case 1: payList = new ArrayList(); for (int j = 0; j < costList.Count; j++) { Examination examination = (Examination)costList[j]; DetailCostInfo detailCostInfo = new DetailCostInfo(); detailCostInfo.cost = examination.pay; detailCostInfo.costId = examination.exam_id; detailCostInfo.docName = PatientHelper.GetDoctorNameById(examination.employee_id); detailCostInfo.startTime = examination.exam_time.ToString(); if (examination.pay_time.Year == 1) { detailCostInfo.isPay = false; } else { detailCostInfo.isPay = true; } payList.Add(detailCostInfo); } returnList.Add(payList); break; case 2: payList = new ArrayList(); for (int j = 0; j < costList.Count; j++) { Prescription examination = (Prescription)costList[j]; DetailCostInfo detailCostInfo = new DetailCostInfo(); detailCostInfo.cost = examination.pay; detailCostInfo.costId = examination.pres_id; detailCostInfo.docName = PatientHelper.GetDoctorNameById(examination.employee_id); detailCostInfo.startTime = examination.make_time.ToString(); if (examination.pay_time.Year == 1) { detailCostInfo.isPay = false; } else { detailCostInfo.isPay = true; } payList.Add(detailCostInfo); } returnList.Add(payList); break; case 3: payList = new ArrayList(); for (int j = 0; j < costList.Count; j++) { Surgery examination = (Surgery)costList[j]; DetailCostInfo detailCostInfo = new DetailCostInfo(); detailCostInfo.cost = examination.pay; detailCostInfo.costId = examination.surg_id; //detailCostInfo.docName = PatientHelper.GetDoctorNameById(examination.); detailCostInfo.docName = examination.surgery_name; detailCostInfo.startTime = examination.start_time.ToString(); if (examination.pay_time.Year == 1) { detailCostInfo.isPay = false; } else { detailCostInfo.isPay = true; } payList.Add(detailCostInfo); } returnList.Add(payList); break; case 4: payList = new ArrayList(); for (int j = 0; j < costList.Count; j++) { Hospitalization examination = (Hospitalization)costList[j]; DetailCostInfo detailCostInfo = new DetailCostInfo(); detailCostInfo.cost = examination.pay; detailCostInfo.costId = examination.hos_id; detailCostInfo.docName = PatientHelper.GetDoctorNameById(examination.nurse_id); detailCostInfo.startTime = examination.in_time.ToString(); if (examination.pay_time.Year == 1) { detailCostInfo.isPay = false; } else { detailCostInfo.isPay = true; } payList.Add(detailCostInfo); } returnList.Add(payList); break; default: break; } } } catch (Exception e) { response.Content = new StringContent(e.Message); response.StatusCode = HttpStatusCode.BadRequest; return(response); } response.Content = new StringContent(JsonObjectConverter.ObjectToJson(returnList)); response.StatusCode = HttpStatusCode.OK; } return(response); }
public void Setup() { _queryDispatcher = A.Fake <IQueryDispatcher>(); _patientHelper = new PatientHelper(_queryDispatcher); }
public Boolean isPatientAvailable(int patientID) { return(PatientHelper.isPatientAvailable(patientID)); }