def folder_item(self, obj, item, index): batch = api.get_object(obj) # Doctor doctor = get_field_value(batch, "Doctor", None) item["Doctor"] = doctor and doctor.Title() or "" item["replace"]["Doctor"] = doctor and get_link(api.get_url(doctor), doctor.Title()) # Onset Date onset = get_field_value(batch, "OnsetDate", None) item["OnsetDate"] = onset and self.listing.ulocalized_time(onset) or "" # Patient item["Patient"] = "" item["getPatientID"] = "" item["getClientPatientID"] = "" patient = get_field_value(batch, "Patient", None) if patient: url = api.get_url(patient) item["Patient"] = patient.Title() item["replace"]["Patient"] = get_link(url, patient.Title()) item["getPatientID"] = patient.id item["replace"]["getPatientID"] = get_link(url, patient.id) pid = patient.getClientPatientID() pid_link = pid and get_link(url, pid) or "" item["getClientPatientID"] = pid or "" item["replace"]["getClientPatientID"] = pid_link return item
def folder_item(self, obj, item, index): batch = api.get_object(obj) # Doctor doctor = get_field_value(batch, "Doctor", None) item["Doctor"] = doctor and doctor.Title() or "" item["replace"]["Doctor"] = doctor and get_link( api.get_url(doctor), doctor.Title()) # Onset Date onset = get_field_value(batch, "OnsetDate", None) item["OnsetDate"] = onset and self.listing.ulocalized_time(onset) or "" # Patient item["Patient"] = "" item["getPatientID"] = "" item["getClientPatientID"] = "" patient = get_field_value(batch, "Patient", None) if patient: url = api.get_url(patient) item["Patient"] = patient.Title() item["replace"]["Patient"] = get_link(url, patient.Title()) item["getPatientID"] = patient.id item["replace"]["getPatientID"] = get_link(url, patient.id) pid = patient.getClientPatientID() pid_link = pid and get_link(url, pid) or "" item["getClientPatientID"] = pid or "" item["replace"]["getClientPatientID"] = pid_link return item
def folder_item(self, obj, item, index): batch = api.get_object(obj) # Doctor doctor = get_field_value(batch, "Doctor", None) item["Doctor"] = doctor and doctor.Title() or "" item["replace"]["Doctor"] = doctor and get_link( api.get_url(doctor), doctor.Title()) # Onset Date onset = get_field_value(batch, "OnsetDate", None) item["OnsetDate"] = onset and self.listing.ulocalized_time(onset) or "" # Patient item["Patient"] = "" item["getPatientID"] = "" item["getClientPatientID"] = "" item["PatientAgeOnsetDate"] = "" patient = get_field_value(batch, "Patient", None) if patient: url = api.get_url(patient) item["Patient"] = patient.Title() item["replace"]["Patient"] = get_link(url, patient.Title()) item["getPatientID"] = patient.id item["replace"]["getPatientID"] = get_link(url, patient.id) pid = patient.getClientPatientID() pid_link = pid and get_link(url, pid) or "" item["getClientPatientID"] = pid or "" item["replace"]["getClientPatientID"] = pid_link dob = patient.getBirthDate() if onset and dob: try: age_ymd = get_age_ymd(patient.getBirthDate(), onset) item["replace"]["PatientAgeOnsetDate"] = age_ymd except: # Wrong date?? msg = _("Date of Birth or Case Onset Date are wrong") img = get_image("exclamation.png", title=msg) item["replace"]["PatientAgeOnsetDate"] = img # Display the internal/external icons, but only if the logged-in user # does not belong to an external client if not self.is_external_user: item["before"]["BatchID"] = get_client_aware_html_image(obj) return item
def fiddle(self, schema): schema['title'].required = False schema['title'].widget.visible = False schema['description'].required = False schema['description'].widget.visible = False schema['BatchLabels'].widget.visible = False schema['ClientBatchID'].widget.label = _("Client Case ID") schema['BatchDate'].widget.visible = False schema['Remarks'].widget.visible = False setup = api.get_setup() doctor_required = get_field_value(setup, "CaseDoctorIsMandatory", default=False) schema['Doctor'].required = doctor_required schema['Client'].required = True return schema
def insurance_number(self): """Returns the Patient's insurance number """ return utils.get_field_value(self.context, "InsuranceNumber", "")
def getDoctorTitle(instance): doctor = get_field_value(instance, "Doctor", default=None) return doctor and doctor.Title() or ""
def getDoctorUID(instance): doctor = get_field_value(instance, "Doctor", default=None) return doctor and api.get_uid(doctor) or ""
def getClientPatientID(instance): patient = get_field_value(instance, "Patient", default=None) return patient and patient.getClientPatientID() or ""
def getPatientTitle(instance): patient = get_field_value(instance, "Patient", default=None) return patient and patient.Title() or ""
def getPatientUID(instance): patient = get_field_value(instance, "Patient", default=None) return patient and api.get_uid(patient) or ""