Exemplo n.º 1
0
def profile_view(request):
    # Authentication check.
    authentication_result = views.authentication_check(request)
    if authentication_result is not None: return authentication_result
    # Get the template data from the session
    template_data = views.parse_session(request)
    # Proceed with the rest of the view
    if request.user.account.role != Account.ACCOUNT_ADMIN:
        appointment.parse_appointment_cancel(
            request, template_data)  # Parse appointment cancelling
        template_data['events'] = appointment.parse_appointments(
            request)  # Build list of appointments
    else:
        template_data['total_logins'] = Action.objects.filter(
            description__icontains="Account login").count()
        template_data['total_logouts'] = Action.objects.filter(
            description__icontains="Account logout").count()
        template_data['total_admitted'] = Action.objects.filter(
            description__icontains="Admitted Patient").count()
        template_data['total_discharged'] = Action.objects.filter(
            description__icontains="Discharged Patient").count()
        template_data['total_appointments'] = Action.objects.filter(
            description__icontains="Appointment created").count()
        template_data['total_med_tests'] = Action.objects.filter(
            description__icontains="Medical Test created").count()
        template_data['total_registered'] = Action.objects.filter(
            description__icontains="registered").count()
    message.parse_message_archive(request, template_data)
    #template_data['messages'] = Message.objects.filter(target=request.user.account, target_deleted=False)
    template_data['messages'] = Score.objects.filter(
        owner=request.user.account)

    return render(request, 'healthnet/profile.html', template_data)
Exemplo n.º 2
0
def calendar_view(request):
    # Authentication check.
    authentication_result = views.authentication_check(
        request,
        [Account.ACCOUNT_PATIENT, Account.ACCOUNT_NURSE, Account.ACCOUNT_DOCTOR]
    )
    if authentication_result is not None: return authentication_result
    # Get the template data from the session
    template_data = views.parse_session(request)
    # Proceed with the rest of the view
    # Parse search sorting
    appointment.parse_appointment_cancel(request, template_data)  # Parse appointment cancelling
    template_data['events'] = appointment.parse_appointments(request)  # Build list of appointments
    return render(request, 'healthnet/appointment/appointment_calendar.html', template_data)
Exemplo n.º 3
0
def calendar_view(request):
    # Authentication check.
    authentication_result = views.authentication_check(
        request,
        [Account.ACCOUNT_PATIENT, Account.ACCOUNT_NURSE, Account.ACCOUNT_DOCTOR]
    )
    if authentication_result is not None: return authentication_result
    # Get the template data from the session
    template_data = views.parse_session(request)
    # Proceed with the rest of the view
    # Parse search sorting
    appointment.parse_appointment_cancel(request, template_data)  # Parse appointment cancelling
    template_data['events'] = appointment.parse_appointments(request)  # Build list of appointments
    return render(request, 'healthnet/appointment/calendar.html', template_data)
Exemplo n.º 4
0
def list_view(request):
    # Authentication check.
    authentication_result = views.authentication_check(
        request,
        [Account.ACCOUNT_PATIENT, Account.ACCOUNT_NURSE, Account.ACCOUNT_DOCTOR]
    )
    if authentication_result is not None: return authentication_result
    # Get the template data from the session
    template_data = views.parse_session(request)
    # Proceed with the rest of the view
    appointment.parse_appointment_cancel(request, template_data)  # Parse appointment cancelling
    if request.user.account.role == Account.ACCOUNT_PATIENT:
        template_data['query'] = Appointment.objects.filter(patient=request.user.account)
    elif request.user.account.role == Account.ACCOUNT_DOCTOR:
        template_data['query'] = Appointment.objects.filter(doctor=request.user.account)
    else:
        template_data['query'] = Appointment.objects.all()
    return render(request, 'healthnet/appointment/list.html', template_data)
Exemplo n.º 5
0
def list_view(request):
    # Authentication check.
    authentication_result = views.authentication_check(
        request,
        [Account.ACCOUNT_PATIENT, Account.ACCOUNT_NURSE, Account.ACCOUNT_DOCTOR]
    )
    if authentication_result is not None: return authentication_result
    # Get the template data from the session
    template_data = views.parse_session(request)
    # Proceed with the rest of the view
    appointment.parse_appointment_cancel(request, template_data)  # Parse appointment cancelling
    if request.user.account.role == Account.ACCOUNT_PATIENT:
        template_data['query'] = Appointment.objects.filter(patient=request.user.account)
    elif request.user.account.role == Account.ACCOUNT_DOCTOR:
        template_data['query'] = Appointment.objects.filter(doctor=request.user.account)
    else:
        template_data['query'] = Appointment.objects.all()
    return render(request, 'healthnet/appointment/list.html', template_data)
Exemplo n.º 6
0
def profile_view(request):
    # Authentication check.
    authentication_result = views.authentication_check(request)
    if authentication_result is not None: return authentication_result
    # Get the template data from the session
    template_data = views.parse_session(request)
    # Proceed with the rest of the view
    if request.user.account.role != Account.ACCOUNT_ADMIN:
        appointment.parse_appointment_cancel(request, template_data)  # Parse appointment cancelling
        template_data['events'] = appointment.parse_appointments(request)  # Build list of appointments
    else:
        template_data['total_logins'] = Action.objects.filter(description__icontains="Account login").count()
        template_data['total_logouts'] = Action.objects.filter(description__icontains="Account logout").count()
        template_data['total_admitted'] = Action.objects.filter(description__icontains="Admitted Patient").count()
        template_data['total_discharged'] = Action.objects.filter(description__icontains="Discharged Patient").count()
        template_data['total_appointments'] = Action.objects.filter(description__icontains="Appointment created").count()
        template_data['total_med_tests'] = Action.objects.filter(description__icontains="Medical Test created").count()
        template_data['total_registered'] = Action.objects.filter(description__icontains="registered").count()
    message.parse_message_archive(request, template_data)
    template_data['messages'] = Message.objects.filter(target=request.user.account, target_deleted=False)
    return render(request, 'healthnet/profile.html', template_data)