/// <summary> This method is getting list of filtered <c>Prescription</c> of logged patient by parameter <c>IsUsed</c>. </summary> /// /// <param name="prescriptions"><c>prescriptions</c> is List of presciptions that matches search fields. /// </param> /// /// <param name="prescriptionSearchDto"><c>prescriptionSearchDto</c> is Data Transfer Object of a <c>Prescription</c> that is being used to filter precriptions. /// </param> /// <returns> List of filtered patient prescriptions. </returns> private List <Prescription> SearchForUsed(List <Prescription> prescriptions, PrescriptionSearchDto prescriptionSearchDto) { if (!UtilityMethods.CheckIfStringIsEmpty(prescriptionSearchDto.IsUsed)) { prescriptions = prescriptions.FindAll(prescription => prescription.isUsed.ToString().Contains(prescriptionSearchDto.IsUsed)); } return(prescriptions); }
public IActionResult SimpleSearchPrescriptions(PrescriptionSearchDto dto) { return(Ok(PrescriptionService.SimpleSearchPrescriptions(dto))); }
/// <summary> This method is calling searchForComments, searchForUsed, searchForMedicines to get list of filtered <c>Prescription</c> of logged patient. </summary> /// /// <param name="prescriptionSearchDto"><c>prescriptionSearchDto</c> is Data Transfer Object of a <c>Prescription</c> that is beomg used to filter precriptions. /// </param> /// <returns> List of filtered patient prescriptions. </returns> public List <Prescription> SimpleSearchPrescriptions(PrescriptionSearchDto prescriptionSearchDto) { return(SearchForDoctor(SearchForMedicines(SearchForUsed(SearchForComments(GetPrescriptionsForPatient(1), prescriptionSearchDto), prescriptionSearchDto), prescriptionSearchDto), prescriptionSearchDto)); }
/// <summary> This method is getting list of filtered <c>Prescription</c> of logged patient by parameter <c>Messages</c>. </summary> /// /// <param name="prescriptions"><c>prescriptions</c> is List of presciptions that matches search fields. /// </param> /// /// <param name="prescriptionSearchDto"><c>prescriptionSearchDto</c> is Data Transfer Object of a <c>Prescription</c> that is being used to filter precriptions. /// </param> /// <returns> List of filtered patient prescriptions. </returns> private List <Prescription> SearchForMedicines(List <Prescription> prescriptions, PrescriptionSearchDto prescriptionSearchDto) { if (!UtilityMethods.CheckIfStringIsEmpty(prescriptionSearchDto.Medicines)) { prescriptions = prescriptions.Where(prescription => prescription.Medicines.Any(medicine => medicine.name.Contains(prescriptionSearchDto.Medicines))).ToList(); } return(prescriptions); }
/// <summary> This method is getting list of filtered <c>Prescription</c> of logged patient by parameter <c>Comment</c>. </summary> /// /// <param name="prescriptions"><c>prescriptions</c> is List of presciptions that matches search fields. /// </param> /// /// <param name="prescriptionSearchDto"><c>prescriptionSearchDto</c> is Data Transfer Object of a <c>Prescription</c> that is being used to filter precriptions. /// </param> /// <returns> List of filtered patient prescriptions. </returns> private List <Prescription> SearchForComments(List <Prescription> prescriptions, PrescriptionSearchDto prescriptionSearchDto) { if (!UtilityMethods.CheckIfStringIsEmpty(prescriptionSearchDto.Comment)) { prescriptions = prescriptions.FindAll(prescription => prescription.comment.Contains(prescriptionSearchDto.Comment)); } return(prescriptions); }
/// <summary> This method is getting list of filtered <c>Prescription</c> of logged patient by parameter <c>Doctor</c>. </summary> /// /// <param name="prescriptions"><c>prescriptions</c> is List of presciptions that matches search fields. /// </param> /// /// <param name="prescriptionSearchDto"><c>prescriptionSearchDto</c> is Data Transfer Object of a <c>Prescription</c> that is being used to filter precriptions. /// </param> /// <returns> List of filtered patient prescriptions. </returns> private List <Prescription> SearchForDoctor(List <Prescription> prescriptions, PrescriptionSearchDto prescriptionSearchDto) { if (!UtilityMethods.CheckIfStringIsEmpty(prescriptionSearchDto.Doctor)) { prescriptions = prescriptions.FindAll(prescription => prescription.Doctor.firstName.Contains(prescriptionSearchDto.Doctor) || prescription.Doctor.secondName.Contains(prescriptionSearchDto.Doctor) || prescription.Doctor.DoctorFullName().Contains(prescriptionSearchDto.Doctor)); } return(prescriptions); }