from childmonitoring.models import (
    SunChild, Outpatient, School, Region, Leisure, Case, DayHospital, SurgicalMedicalHistory, FamilyMedicalHistory,
    IdentifiedAllergy, IdentifiedPathology, BaseMedicalHistory, Speciality, SpecialistReport
)


def list_sunchild():
    try:
        children = SunChild.objects.all()
        context = {
            'children': children,
        }
        return context
    except SunChild.DoesNotExist:
        return 'error'


# List for School
def list_schools():
    school = School.objects.all()
    return school


# List for Region
def list_regions():
    region = Region.objects.all()
    return region


# List for Leisure
def list_leisure():
    leisure = Leisure.objects.all()
    return leisure


# List for Case
def list_case():
    case = Case.objects.all()
    return case


# List for DayHospital
def list_day_hospitals():
    day_hospitals = DayHospital.objects.all().order_by('-id')  # List DayHospitals
    return day_hospitals


# List for SurgicalMedicalHistory
def surgical_medical_history():
    list_surgical_medical_history = SurgicalMedicalHistory.objects.all()
    return list_surgical_medical_history


# List for FamilyMedicalHistory
def family_medical_history():
    list_family_medical_history = FamilyMedicalHistory.objects.all()
    return list_family_medical_history


def list_outpatients():
    outpatients = Outpatient.objects.all()
    return outpatients


def list_identified_allergy():
    identified_allergy = IdentifiedAllergy.objects.all()
    return identified_allergy


def list_identified_pathology():
    identified_pathology = IdentifiedPathology.objects.all()
    return identified_pathology


def list_base_medical_history():
    base_medical_history = BaseMedicalHistory.objects.all()
    return base_medical_history


def list_reporting():
    try:
        context = {}
        return context
    except ValueError:
        pass


def list_specialist_report():
    specialist_report = SpecialistReport.objects.all()
    return specialist_report


def list_speciality():
    speciality = Speciality.objects.all()
    return speciality
