예제 #1
0
        public static List <Prescription> GetPrescriptionsByMedicationName(string name)
        {
            DatabaseQuery nestedQuery = new DatabaseQuery(Database.Tables.PRESCRIPTION_MEDICATIONS)
            {
                Comparator = ManagerHelper.GetInLikeComparator
                             (
                    Database.Tables.PrescriptionMedications.MedicationId,
                    Database.Tables.MEDICATIONS,
                    Database.Tables.Medications.Name,
                    name
                             )
            };

            nestedQuery.Add(Database.Tables.PrescriptionMedications.PrescriptionId);

            return(PrescriptionManager.Merge
                   (
                       Database.Tables.PRESCRIPTIONS,
                       ManagerHelper.GetInComparator
                       (
                           Database.Tables.Generic.ID,
                           nestedQuery
                       )
                   ));
        }
예제 #2
0
        public static List <Patient> GetPatientsByPostcode(string code)
        {
            DatabaseQuery nestedQuery = new DatabaseQuery(Database.Tables.PERSONAL_DETAILS)
            {
                Comparator = new QueryComparator()
                {
                    Source  = new QueryElement(Database.Tables.PersonalDetails.PostcodeId),
                    Operand = new QueryElement
                              (
                        ManagerHelper.GetInEqualQuery
                        (
                            Database.Tables.POSTAL_CODES,
                            Database.Tables.PostalCodes.Code,
                            code
                        )
                              )
                }
            };

            nestedQuery.Add(Database.Tables.Generic.ID);

            return(PatientManager.Merge
                   (
                       Database.Tables.PATIENTS,
                       ManagerHelper.GetInComparator
                       (
                           Database.Tables.Patients.DetailsId,
                           nestedQuery
                       )
                   ));
        }
예제 #3
0
        // Getting leave dates within a set range through the staff ID.
        public static List <MedicalStaff> GetMedicalStaffLeavesFrom(DateTime start, DateTime end, bool not)
        {
            DatabaseQuery nestedQuery = new DatabaseQuery(Database.Tables.LEAVE_DATES);

            if (start.Date.Equals(end.Date))
            {
                nestedQuery.Comparator = new QueryComparator
                {
                    Source  = new QueryElement(Database.Tables.LeaveDates.Date),
                    Operand = new QueryElement(null, QueryElement.DateOf(start))
                };
            }
            else
            {
                nestedQuery.Comparator = new QueryComparator
                {
                    Source = new QueryComparator()
                    {
                        Source  = new QueryElement(Database.Tables.LeaveDates.Date),
                        Operand = new QueryElement(null, QueryElement.DateOf(start)),
                        Equal   = !not,
                        More    = !not,
                        Less    = not
                    },

                    Operand = new QueryComparator()
                    {
                        Source  = new QueryElement(Database.Tables.LeaveDates.Date),
                        Operand = new QueryElement(null, QueryElement.DateOf(end)),
                        Equal   = !not,
                        Less    = !not,
                        More    = not
                    },

                    And = !not,
                    Or  = not
                };
            }

            nestedQuery.Add(Database.Tables.LeaveDates.StaffId);

            return(ManagerHelper.FilterType <MedicalStaff>
                   (
                       StaffManager.Merge
                       (
                           Database.Tables.STAFFS,
                           ManagerHelper.GetInComparator
                           (
                               Database.Tables.Generic.ID,
                               nestedQuery
                           )
                       )
                   ));
        }
예제 #4
0
 public static List <Prescription> GetPrescriptionsByMedication(int id)
 {
     return(PrescriptionManager.Merge
            (
                Database.Tables.PRESCRIPTIONS,
                ManagerHelper.GetInComparator
                (
                    Database.Tables.Generic.ID,
                    ManagerHelper.GetInEqualQuery
                    (
                        Database.Tables.PRESCRIPTION_MEDICATIONS,
                        Database.Tables.PrescriptionMedications.MedicationId,
                        id
                    )
                )
            ));
 }
예제 #5
0
        public static List <TestResult> GetTestResultsByStaff(int id)
        {
            DatabaseQuery nestedQuery = new DatabaseQuery(Database.Tables.MEDICAL_STAFFS)
            {
                Comparator = new QueryComparator()
                {
                    Source  = new QueryElement(Database.Tables.MedicalStaffs.StaffId),
                    Operand = new QueryElement(null, id)
                }
            };

            nestedQuery.Add(Database.Tables.MedicalStaffs.LicenseNo);

            return(TestResultManager.Merge
                   (
                       Database.Tables.TEST_RESULTS,
                       ManagerHelper.GetInComparator
                       (
                           Database.Tables.TestResults.MedicalLicenseNo,
                           nestedQuery
                       )
                   ));
        }