def display_case_list(request): ''' Displays the list of cases.''' user = request.user case_attributes = create_case_attributes(Case.objects) return render_to_response('caselist.html', { 'viewer': user, 'cases': case_attributes}, context_instance=RequestContext(request))
def display_field_worker(request): ''' Load worker information to worker's display page. ''' try: user = request.user worker = request.user.worker except ObjectDoesNotExist: return HttpResponseRedirect("/") case_attributes = create_case_attributes(Case.objects) return render_to_response('fieldworker.html', { 'viewer': user, 'user': user, 'phone_number': worker.phone, 'address': worker.address, 'registration_time': worker.registration_time, 'comments': worker.comments, 'id': worker.id, 'cases': case_attributes }, context_instance=RequestContext(request))
def display_doctor(request): ''' Load doctor information to doctor's display page. ''' try: user = request.user doctor = request.user.doctor except ObjectDoesNotExist: return HttpResponseRedirect("/") case_attributes = create_case_attributes(Case.objects) return render_to_response('doctor.html', { 'viewer': user, 'user': user, 'phone_number': doctor.phone, 'address': doctor.address, 'registration_time': doctor.registration_time, 'specialties': doctor.specialties.all(), 'schedule': 'hohoho', 'comments': doctor.comments, 'id': doctor.id, 'cases': case_attributes }, context_instance=RequestContext(request))
def display_patient(request, patient_id): ''' Display patient information. ''' user = request.user patient = Patient.objects.filter(id=patient_id)[0] case_attributes = create_case_attributes(Case.objects) # Define the filter function for patient cases def filter_function(x): return x.patient_ref == patient case_attributes = filter(filter_function, case_attributes) date_of_birth = patient.date_of_birth if date_of_birth is None: date_of_birth = "" return render_to_response('patient.html', { 'viewer': user, 'user': user, 'photo_link': patient.photo_link, 'firstName': patient.first_name, 'lastName': patient.last_name, 'patient_id': patient.id, 'gender': patient.gender, 'date_of_birth': date_of_birth, 'gps_coordinates': patient.gps_coordinates, 'health_id': patient.health_id, 'address': patient.address, 'phone': patient.phone, 'email': patient.email, 'cases': case_attributes, 'patient_pic': patient.patient_pic }, context_instance=RequestContext(request))