Exemplo n.º 1
0
 public IActionResult AdvancedSearchPrescriptions(PrescriptionAdvancedSearchDto dto)
 {
     return(Ok(PrescriptionService.AdvancedSearchPrescriptions(dto)));
 }
Exemplo n.º 2
0
 /// <summary> This method is calling searchForFirstParameter, searchForOtherParameters to get list of filtered <c>Prescription</c> of logged patient. </summary>
 /// /// <param name="dto"><c>PrescriptionAdvancedSearchDto</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> AdvancedSearchPrescriptions(PrescriptionAdvancedSearchDto dto)
 {
     return(SearchForOtherParameters(GetPrescriptionsForPatient(1), dto, SearchForFirstParameter(GetPrescriptionsForPatient(1), dto)));
 }
Exemplo n.º 3
0
        /// <summary> This method is getting list of filtered <c>Prescription</c> that match list of parameters in <c>PrescriptionAdvnacedSearchDto</c></summary>
        /// <param name="prescriptions"> List of all <c>Prescription</c> of logged user.
        /// </param>
        /// <param name="dto"><c>PrescriptionAdvancedSearchDto</c> is Data Transfer Object of a <c>Prescription</c> that is beomg used to filter precriptions.
        /// </param>
        /// <param name="firstPrescriptions"> List of <c>Prescription</c> that contains prescriptions that matches first parameter.
        /// </param>
        /// <returns> List of filtered patient prescriptions. </returns>
        private List <Prescription> SearchForOtherParameters(List <Prescription> prescriptions, PrescriptionAdvancedSearchDto dto, List <Prescription> firstPrescriptions)
        {
            for (int i = 0; i < dto.RestRoles.Length; i++)
            {
                List <Prescription> othersPrescriptions = SearchForOtherParametersValues(dto.RestRoles[i], dto.Rest[i], prescriptions);

                firstPrescriptions = SearchForLogicOperators(dto.LogicOperators[i], othersPrescriptions, firstPrescriptions);
            }

            return(firstPrescriptions);
        }
Exemplo n.º 4
0
 /// <summary> This method is calling function for getting list of filtered <c>Prescription</c> of logged patient by sent parameter. </summary>
 /// /// <param name="prescriptions"><c>prescriptions</c> is List of presciptions that matches search fields.
 /// </param>
 /// /// <param name="dto"><c>PrescriptionAdvancedSearchDto</c> is Data Transfer Object of <c>Prescription</c> and is being used to filter precriptions depending on sent value.
 /// </param>
 /// <returns> List of filtered patient prescriptions. </returns>
 private List <Prescription> SearchForFirstParameter(List <Prescription> prescriptions, PrescriptionAdvancedSearchDto dto)
 {
     return(dto.FirstRole.Equals("medicines") || UtilityMethods.CheckIfStringIsEmpty(dto.FirstRole) ? SearchForMedicinesAdvanced(prescriptions, dto.First) :
            dto.FirstRole.Equals("comment") ? SearchForCommentsAdvanced(prescriptions, dto.First) :
            dto.FirstRole.Equals("isUsed") ? SearchForUsedAdvanced(prescriptions, dto.First) : SearchForDoctorAdvanced(prescriptions, dto.First));
 }