Beispiel #1
0
 def _get_breadcrumbs(self):
     patient = self.get_patient()
     breadcrumbs = get_patient_breadcrumbs(patient, self.request.user)
     breadcrumbs.append(
         Breadcrumb('Orders',
                    reverse('accounts:patient-orders', args=[patient.pk])))
     return breadcrumbs
Beispiel #2
0
def edit(request, patient_id, group_id=None):
    try:
        if group_id:
            assert request.user.is_admin()
            group = GenesisGroup.objects.get(pk=group_id)
            patient = group.get_patients().get(pk=patient_id)
        else:
            if request.user.is_professional():
                group = request.user.professional_profile.parent_group
                patient = request.user.professional_profile.get_patients(
                    ['edit-patient-profile']).get(pk=patient_id)
            else:
                patient = PatientProfile.myghr_patients.get_users().get(
                    pk=patient_id)
                group = patient.patient_profile.get_group()
    except (GenesisGroup.DoesNotExist, User.DoesNotExist, AssertionError) as e:
        return debug_response(e)

    breadcrumbs = get_patient_breadcrumbs(patient, request.user)

    return generic_form(
        request,
        form_class=PatientForm,
        page_title='Edit Patient {}'.format(patient.get_reversed_name()),
        system_message="The patient has been updated.",
        form_kwargs={'initial_group': group, 'instance': patient},
        breadcrumbs=breadcrumbs)
Beispiel #3
0
 def _get_breadcrumbs(self):
     user = self.get_patient()
     breadcrumbs = get_patient_breadcrumbs(user, self.request.user)
     breadcrumbs.append(
         Breadcrumb('Reports',
                    reverse('reports:patient-index', args=[user.pk])))
     return breadcrumbs
Beispiel #4
0
 def _get_breadcrumbs(self):
     patient = self.get_order().epc_member.user
     breadcrumbs = get_patient_breadcrumbs(patient,
                                           self.request.user,
                                           include_detail=True)
     breadcrumbs.append(
         Breadcrumb('EPC Orders',
                    reverse('epc:patient-orders', args=[patient.pk])))
     return breadcrumbs
Beispiel #5
0
 def _get_breadcrumbs(self):
     patient = self.get_patient()
     requester = self.request.user
     breadcrumbs = get_patient_breadcrumbs(patient, requester)
     breadcrumbs.append(
         Breadcrumb('Communications',
                    reverse('accounts:patient-communications',
                            args=[patient.pk]))
     )
     return breadcrumbs
def get_device_breadcrumbs(device, requester, include_detail=True):
    patient = device.get_patient()
    if patient:
        breadcrumbs = get_patient_breadcrumbs(patient, requester)
        breadcrumbs.append(
            Breadcrumb('Devices',
                       reverse('gdrives:patient-details', args=[patient.pk])))
    else:
        breadcrumbs = []
    if include_detail:
        breadcrumbs.append(
            Breadcrumb('Device: {0}'.format(device.meid),
                       reverse('gdrives:detail', args=[device.pk])))
    return breadcrumbs
Beispiel #7
0
 def _get_breadcrumbs(self):
     order = self.get_shipment().order
     if order.is_patient_order():
         patient = order.patient
         breadcrumbs = get_patient_breadcrumbs(patient, self.request.user)
         breadcrumbs.append(
             Breadcrumb(
                 'Orders',
                 reverse('accounts:patient-orders', args=[patient.pk])))
     else:
         rx_partner = order.rx_partner
         breadcrumbs = get_rx_partner_breadcrumbs(rx_partner,
                                                  self.request.user)
     return breadcrumbs
Beispiel #8
0
 def get_breadcrumbs(self):
     patient = self.get_patient()
     return get_patient_breadcrumbs(
         patient, self.request.user, include_detail=False)
Beispiel #9
0
 def _get_breadcrumbs(self) -> List[Breadcrumb]:
     breadcrumbs = get_patient_breadcrumbs(
         self.get_patient(),
         self.request.user
     )
     return breadcrumbs
Beispiel #10
0
 def get_breadcrumbs(self):
     return get_patient_breadcrumbs(self.get_patient(), self.request.user)