Beispiel #1
0
def parse_appointments(request):
    if request.user.account.role == Account.ACCOUNT_PATIENT:
        appointments = Appointment.objects.filter(status="Active", patient=request.user.account)
    elif request.user.account.role == Account.ACCOUNT_DOCTOR:
        appointments = Appointment.objects.filter(status="Active", doctor=request.user.account)
    else:
        appointments = Appointment.objects.filter(status="Active")
    body = []
    if appointments.count() > 0:
        for appointment in appointments:
            body.append("{")
            body.append("id: {0},".format(appointment.pk))
            body.append("formatted_start: '{0}',".format(timezone.localtime(appointment.startTime).strftime(datetime_strftime)))
            body.append("formatted_end: '{0}',".format(timezone.localtime(appointment.endTime).strftime(datetime_strftime)))
            body.append("hospital: '{0}',".format(sanitize_js(appointment.hospital.name)))
            body.append("patient: '{0}',".format(sanitize_js(appointment.doctor.__str__())))
            body.append("doctor: '{0}',".format(sanitize_js(appointment.patient.__str__())))
            if request.user.account.role == Account.ACCOUNT_PATIENT:
                message = "{0}, {1}".format(appointment.doctor.profile, appointment.description)
            else:
                message = "{0}, {1}".format(appointment.patient.profile, appointment.description)
            body.append("title: '{0}',".format(sanitize_js(message)))
            stime = timezone.localtime(appointment.startTime)
            sdate = stime.date()
            stime = stime.time()
            body.append("start: new Date({0},{1},{2},{3},{4}),".format(sdate.year, sdate.month - 1, sdate.day, stime.hour, stime.minute))
            stime = timezone.localtime(appointment.endTime)
            sdate = stime.date()
            stime = stime.time()
            body.append("end: new Date({0},{1},{2},{3},{4})".format(sdate.year, sdate.month - 1, sdate.day, stime.hour, stime.minute))
            body.append("},")
        return mark_safe('\n'.join(body)[:-1])
    return mark_safe("")
Beispiel #2
0
def parse_appointments(request):
    if request.user.account.role == Account.ACCOUNT_PATIENT:
        appointments = Appointment.objects.filter(status="Active",
                                                  patient=request.user.account)
    elif request.user.account.role == Account.ACCOUNT_DOCTOR:
        appointments = Appointment.objects.filter(status="Active",
                                                  doctor=request.user.account)
    else:
        appointments = Appointment.objects.filter(status="Active")
    body = []
    if appointments.count() > 0:
        for appointment in appointments:
            body.append("{")
            body.append("id: {0},".format(appointment.pk))
            body.append("formatted_start: '{0}',".format(
                timezone.localtime(
                    appointment.startTime).strftime(datetime_strftime)))
            body.append("formatted_end: '{0}',".format(
                timezone.localtime(
                    appointment.endTime).strftime(datetime_strftime)))
            body.append("hospital: '{0}',".format(
                sanitize_js(appointment.hospital.name)))
            body.append("patient: '{0}',".format(
                sanitize_js(appointment.doctor.__str__())))
            body.append("doctor: '{0}',".format(
                sanitize_js(appointment.patient.__str__())))
            if request.user.account.role == Account.ACCOUNT_PATIENT:
                message = "{0}, {1}".format(appointment.doctor.profile,
                                            appointment.description)
            else:
                message = "{0}, {1}".format(appointment.patient.profile,
                                            appointment.description)
            body.append("title: '{0}',".format(sanitize_js(message)))
            stime = timezone.localtime(appointment.startTime)
            sdate = stime.date()
            stime = stime.time()
            body.append("start: new Date({0},{1},{2},{3},{4}),".format(
                sdate.year, sdate.month - 1, sdate.day, stime.hour,
                stime.minute))
            stime = timezone.localtime(appointment.endTime)
            sdate = stime.date()
            stime = stime.time()
            body.append("end: new Date({0},{1},{2},{3},{4})".format(
                sdate.year, sdate.month - 1, sdate.day, stime.hour,
                stime.minute))
            body.append("},")
        return mark_safe('\n'.join(body)[:-1])
    return mark_safe("")
Beispiel #3
0
def list_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
    # Parse search sorting
    message.parse_message_archive(request, template_data)
    template_data['messages'] = Message.objects.filter(Q(target=request.user.account) | Q(sender=request.user.account))
    template_data['account'] = sanitize_js(request.user.account.profile.__str__())
    return render(request, 'healthnet/message/list.html', template_data)
Beispiel #4
0
def list_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
    # Parse search sorting
    message.parse_message_archive(request, template_data)
    template_data['messages'] = Message.objects.filter(
        Q(target=request.user.account) | Q(sender=request.user.account))
    template_data['account'] = sanitize_js(
        request.user.account.profile.__str__())
    return render(request, 'healthnet/message/list.html', template_data)
Beispiel #5
0
def sanitizeJS(string):
    return sanitize_js(string.__str__())
Beispiel #6
0
def sanitizeJS(string):
    return sanitize_js(string.__str__())