1
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
# |
3
|
|
|
# This file is part of SENAITE.HEALTH. |
4
|
|
|
# |
5
|
|
|
# SENAITE.HEALTH is free software: you can redistribute it and/or modify it |
6
|
|
|
# under the terms of the GNU General Public License as published by the Free |
7
|
|
|
# Software Foundation, version 2. |
8
|
|
|
# |
9
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT |
10
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
11
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
12
|
|
|
# details. |
13
|
|
|
# |
14
|
|
|
# You should have received a copy of the GNU General Public License along with |
15
|
|
|
# this program; if not, write to the Free Software Foundation, Inc., 51 |
16
|
|
|
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
17
|
|
|
# |
18
|
|
|
# Copyright 2018-2019 by it's authors. |
19
|
|
|
# Some rights reserved, see README and LICENSE. |
20
|
|
|
|
21
|
|
|
from plone.indexer import indexer |
22
|
|
|
|
23
|
|
|
from bika.health.utils import get_field_value |
24
|
|
|
from bika.lims import api |
25
|
|
|
from bika.lims.interfaces import IBatch |
26
|
|
|
|
27
|
|
|
|
28
|
|
|
@indexer(IBatch) |
29
|
|
|
def getPatientID(instance): |
30
|
|
|
patient = get_field_value(instance, "Patient", default=None) |
31
|
|
|
return patient and patient.getPatientID() or "" |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
@indexer(IBatch) |
35
|
|
|
def getPatientUID(instance): |
36
|
|
|
patient = get_field_value(instance, "Patient", default=None) |
37
|
|
|
return patient and api.get_uid(patient) or "" |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
@indexer(IBatch) |
41
|
|
|
def getPatientTitle(instance): |
42
|
|
|
patient = get_field_value(instance, "Patient", default=None) |
43
|
|
|
return patient and patient.Title() or "" |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
@indexer(IBatch) |
47
|
|
|
def getClientPatientID(instance): |
48
|
|
|
patient = get_field_value(instance, "Patient", default=None) |
49
|
|
|
return patient and patient.getClientPatientID() or "" |
50
|
|
|
|
51
|
|
|
|
52
|
|
|
@indexer(IBatch) |
53
|
|
|
def getDoctorID(instance): |
54
|
|
|
doctor = get_field_value(instance, "DoctorID", default=None) |
55
|
|
|
return doctor and api.get_id(doctor) or "" |
56
|
|
|
|
57
|
|
|
|
58
|
|
|
@indexer(IBatch) |
59
|
|
|
def getDoctorUID(instance): |
60
|
|
|
doctor = get_field_value(instance, "Doctor", default=None) |
61
|
|
|
return doctor and api.get_uid(doctor) or "" |
62
|
|
|
|
63
|
|
|
|
64
|
|
|
@indexer(IBatch) |
65
|
|
|
def getDoctorTitle(instance): |
66
|
|
|
doctor = get_field_value(instance, "Doctor", default=None) |
67
|
|
|
return doctor and doctor.Title() or "" |
68
|
|
|
|