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 AccessControl import ClassSecurityInfo
|
22
|
|
|
from Products.ATExtensions.ateapi import RecordsField
|
23
|
|
|
from DateTime import DateTime
|
24
|
|
|
from Products.ATExtensions.ateapi import DateTimeField, DateTimeWidget
|
25
|
|
|
from Products.Archetypes.public import *
|
26
|
|
|
from Products.CMFCore.permissions import View, ModifyPortalContent
|
27
|
|
|
from bika.lims import bikaMessageFactory as _b
|
28
|
|
|
from bika.health import bikaMessageFactory as _
|
29
|
|
|
from bika.lims.content.bikaschema import BikaSchema
|
30
|
|
|
from bika.health.config import PROJECTNAME
|
31
|
|
|
from bika.lims.browser.widgets import RecordsWidget
|
32
|
|
|
from zope.interface import implements
|
33
|
|
|
|
34
|
|
|
schema = BikaSchema.copy() + Schema((
|
|
|
|
|
35
|
|
|
|
36
|
|
|
StringField('Type',
|
|
|
|
|
37
|
|
|
vocabulary = "getTreatmentTypesList",
|
38
|
|
|
widget = ReferenceWidget(
|
|
|
|
|
39
|
|
|
checkbox_bound = 1,
|
40
|
|
|
label = _("Treatment type",
|
41
|
|
|
"Type"),
|
42
|
|
|
description = _("Select a type of treatment."),
|
43
|
|
|
),
|
44
|
|
|
),
|
45
|
|
|
|
46
|
|
|
TextField('Procedure',
|
|
|
|
|
47
|
|
|
default_content_type = 'text/x-web-intelligent',
|
48
|
|
|
allowable_content_types = ('text/x-web-intelligent',),
|
49
|
|
|
default_output_type="text/plain",
|
50
|
|
|
widget = TextAreaWidget(
|
|
|
|
|
51
|
|
|
label = _("Treatment procedure",
|
52
|
|
|
"Procedure"),
|
53
|
|
|
),
|
54
|
|
|
),
|
55
|
|
|
|
56
|
|
|
TextField('Care',
|
57
|
|
|
default_content_type = 'text/x-web-intelligent',
|
58
|
|
|
allowable_content_types = ('text/x-web-intelligent',),
|
59
|
|
|
default_output_type="text/plain",
|
60
|
|
|
widget = TextAreaWidget(
|
61
|
|
|
label = _("Treatment care"),
|
62
|
|
|
),
|
63
|
|
|
),
|
64
|
|
|
|
65
|
|
|
TextField('SubjectiveClinicalFindings',
|
66
|
|
|
default_content_type = 'text/x-web-intelligent',
|
67
|
|
|
allowable_content_types = ('text/x-web-intelligent',),
|
68
|
|
|
default_output_type="text/plain",
|
69
|
|
|
widget = TextAreaWidget(
|
70
|
|
|
label = _("Subjective clinical findings"),
|
71
|
|
|
),
|
72
|
|
|
),
|
73
|
|
|
|
74
|
|
|
TextField('ObjectiveClinicalFindings',
|
75
|
|
|
default_content_type = 'text/x-web-intelligent',
|
76
|
|
|
allowable_content_types = ('text/x-web-intelligent',),
|
77
|
|
|
default_output_type="text/plain",
|
78
|
|
|
widget = TextAreaWidget(
|
79
|
|
|
label = _("Objective clinical findings"),
|
80
|
|
|
),
|
81
|
|
|
),
|
82
|
|
|
|
83
|
|
|
FileField('TreatmentDocument',
|
|
|
|
|
84
|
|
|
widget = FileWidget(
|
|
|
|
|
85
|
|
|
label = _("Treatment Document"),
|
86
|
|
|
)
|
87
|
|
|
),
|
88
|
|
|
|
89
|
|
|
))
|
90
|
|
|
|
91
|
|
|
schema['description'].widget.visible = True
|
92
|
|
|
schema['description'].schemata = 'default'
|
93
|
|
|
|
94
|
|
|
def getTreatmentTypes(context):
|
95
|
|
|
""" Return the current list of treatment types
|
96
|
|
|
"""
|
97
|
|
|
# From Dorland's Medical Dictionary for Health Consumers. © 2007 by Saunders.
|
98
|
|
|
types = [
|
99
|
|
|
('active', context.translate(_('Active treatment'))),
|
100
|
|
|
('causal', context.translate(_('Causal treatment'))),
|
101
|
|
|
('conservative', context.translate(_('Conservative treatment'))),
|
102
|
|
|
('empirical', context.translate(_('Empirical treatment'))),
|
103
|
|
|
('expectant', context.translate(_('Expectant/Symptomatic treatment'))),
|
104
|
|
|
('palliative', context.translate(_('Palliative treatment'))),
|
105
|
|
|
('preventive', context.translate(_('Preventive/Prophylactic treatment'))),
|
106
|
|
|
('rational', context.translate(_('Rational treatment'))),
|
107
|
|
|
('shock', context.translate(_('Shock treatment'))),
|
108
|
|
|
('specific', context.translate(_('Specific treatment'))),
|
109
|
|
|
('supporting', context.translate(_('Supporting treatment'))),
|
110
|
|
|
]
|
111
|
|
|
return DisplayList(types)
|
|
|
|
|
112
|
|
|
|
113
|
|
|
class Treatment(BaseContent):
|
|
|
|
|
114
|
|
|
security = ClassSecurityInfo()
|
115
|
|
|
displayContentsTab = False
|
116
|
|
|
schema = schema
|
|
|
|
|
117
|
|
|
|
118
|
|
|
_at_rename_after_creation = True
|
119
|
|
|
def _renameAfterCreation(self, check_auto_id=False):
|
120
|
|
|
from bika.lims.idserver import renameAfterCreation
|
121
|
|
|
renameAfterCreation(self)
|
122
|
|
|
|
123
|
|
|
def getTreatmentTypesList(self):
|
124
|
|
|
return getTreatmentTypes(self)
|
125
|
|
|
|
126
|
|
|
registerType(Treatment, PROJECTNAME)
|
|
|
|
|
127
|
|
|
|