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 Products.CMFCore.utils import getToolByName |
22
|
|
|
from bika.health import bikaMessageFactory as _ |
23
|
|
|
from bika.lims import bikaMessageFactory as _b |
24
|
|
|
from bika.lims.browser import BrowserView |
25
|
|
|
from bika.lims.permissions import * |
26
|
|
|
import json |
27
|
|
|
import plone |
28
|
|
|
|
29
|
|
|
|
30
|
|
|
class ajaxGetBatchInfo(BrowserView): |
31
|
|
|
""" Grab the details for Doctor, Patient, Hospital (Titles). |
32
|
|
|
""" |
33
|
|
|
def __call__(self): |
34
|
|
|
plone.protect.CheckAuthenticator(self.request) |
35
|
|
|
batch = self.context |
36
|
|
|
client = batch.getClient() |
37
|
|
|
doctor = batch.Schema()['Doctor'].get(batch) |
38
|
|
|
patient = batch.Schema()['Patient'].get(batch) |
39
|
|
|
|
40
|
|
|
ret = {'ClientID': client and client.getClientID() or '', |
41
|
|
|
'ClientSysID': client and client.id or '', |
42
|
|
|
'ClientUID': client and client.UID() or '', |
43
|
|
|
'ClientTitle': client and client.Title() or '', |
44
|
|
|
'PatientID': patient and patient.getPatientID() or '', |
45
|
|
|
'PatientUID': patient and patient.UID() or '', |
46
|
|
|
'PatientTitle': patient and patient.Title() or '', |
47
|
|
|
'ClientPatientID': patient and patient.getClientPatientID() or '', |
48
|
|
|
'DoctorID': doctor and doctor.getDoctorID(), |
49
|
|
|
'DoctorUID': doctor and doctor.UID() or '', |
50
|
|
|
'DoctorTitle': doctor and doctor.Title() or ''} |
51
|
|
|
|
52
|
|
|
return json.dumps(ret) |
53
|
|
|
|