|
1
|
|
|
from typing import Optional, List |
|
2
|
|
|
|
|
3
|
|
|
from kerapu import clean_code, LEN_ZORG_ACTIVITEIT_CODE, LEN_ZORG_PRODUCT_GROEP_CODE, LEN_ZORG_PRODUCT_CODE |
|
4
|
1 |
|
from kerapu.lbz.Diagnose import Diagnose |
|
5
|
|
|
from kerapu.lbz.Patient import Patient |
|
6
|
1 |
|
from kerapu.lbz.Specialisme import Specialisme |
|
7
|
1 |
|
from kerapu.lbz.ZorgActiviteit import ZorgActiviteit |
|
8
|
1 |
|
from kerapu.lbz.ZorgInstelling import ZorgInstelling |
|
9
|
1 |
|
from kerapu.lbz.ZorgType import ZorgType |
|
10
|
1 |
|
from kerapu.lbz.ZorgVraag import ZorgVraag |
|
11
|
1 |
|
|
|
12
|
1 |
|
|
|
13
|
1 |
|
class Subtraject: |
|
14
|
|
|
""" |
|
15
|
|
|
Klasse voor subtrajecten. |
|
16
|
1 |
|
""" |
|
17
|
|
|
|
|
18
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
19
|
|
|
def __init__(self, |
|
20
|
|
|
subtraject_nummer: str, |
|
21
|
|
|
specialisme_code: str, |
|
22
|
1 |
|
diagnose_code: str, |
|
23
|
|
|
zorg_type_code: str, |
|
24
|
|
|
zorg_vraag_code: str, |
|
25
|
|
|
begin_datum: str, |
|
26
|
|
|
geboorte_datum: str, |
|
27
|
|
|
geslacht_code: str, |
|
28
|
|
|
zorg_instelling_code: str) -> None: |
|
29
|
|
|
""" |
|
30
|
|
|
Object constructor. |
|
31
|
|
|
|
|
32
|
|
|
:param str subtraject_nummer: Het substrajectnummer. |
|
33
|
|
|
:param str specialisme_code: Het (uitvoerend)specialismecode. |
|
34
|
|
|
:param str diagnose_code: De Diagnosecode. |
|
35
|
|
|
:param str zorg_type_code: Het zorgtypecode. |
|
36
|
|
|
:param str zorg_vraag_code: De zorgvraagcode. |
|
37
|
|
|
:param str begin_datum: De begindatum van het subtraject. |
|
38
|
|
|
:param str geboorte_datum: De geboortedatum van de patient. |
|
39
|
|
|
:param str geslacht_code: De code voor het geslacht van de patient. |
|
40
|
|
|
:param str zorg_instelling_code: De AGB-code van de uitvoerende zorginstelling. |
|
41
|
|
|
""" |
|
42
|
|
|
self.__subtraject_nummer: str = subtraject_nummer |
|
43
|
|
|
""" |
|
44
|
|
|
Het subtrajectnummer. |
|
45
|
1 |
|
""" |
|
46
|
|
|
|
|
47
|
|
|
self.__specialisme: Specialisme = Specialisme(specialisme_code) |
|
48
|
|
|
""" |
|
49
|
|
|
Het uitvoerend specialisme. |
|
50
|
1 |
|
""" |
|
51
|
|
|
|
|
52
|
|
|
self.__begin_datum: str = begin_datum |
|
53
|
|
|
""" |
|
54
|
|
|
De begindatum van het subtraject. |
|
55
|
1 |
|
""" |
|
56
|
|
|
|
|
57
|
|
|
self.__patient: Patient = Patient(geboorte_datum, geslacht_code) |
|
58
|
|
|
""" |
|
59
|
|
|
De patient. |
|
60
|
1 |
|
""" |
|
61
|
|
|
|
|
62
|
|
|
self.__zorg_instelling: ZorgInstelling = ZorgInstelling(zorg_instelling_code) |
|
63
|
|
|
""" |
|
64
|
|
|
De zorginstelling. |
|
65
|
1 |
|
""" |
|
66
|
|
|
|
|
67
|
|
|
self.__zorg_type: ZorgType = ZorgType(specialisme_code, zorg_type_code) |
|
68
|
|
|
""" |
|
69
|
|
|
Het zorgtype. |
|
70
|
1 |
|
""" |
|
71
|
|
|
|
|
72
|
|
|
self.__zorg_vraag: ZorgVraag = ZorgVraag(specialisme_code, zorg_vraag_code) |
|
73
|
|
|
""" |
|
74
|
|
|
De zorgvraag. |
|
75
|
1 |
|
""" |
|
76
|
|
|
|
|
77
|
|
|
self.__diagnose: Diagnose = Diagnose(specialisme_code, diagnose_code) |
|
78
|
|
|
""" |
|
79
|
|
|
De diagnose. |
|
80
|
1 |
|
""" |
|
81
|
|
|
|
|
82
|
|
|
self.__zorg_activiteiten: List[ZorgActiviteit] = [] |
|
83
|
|
|
""" |
|
84
|
|
|
De zorgactiviteiten. |
|
85
|
1 |
|
""" |
|
86
|
|
|
|
|
87
|
|
|
self.__zorg_product_code: Optional[str] = None |
|
88
|
|
|
""" |
|
89
|
|
|
De zorgproductcode (zoals afgeleid door Kerapu). |
|
90
|
|
|
""" |
|
91
|
|
|
|
|
92
|
1 |
|
self.__zorg_product_groep_code: Optional[str] = None |
|
93
|
|
|
""" |
|
94
|
|
|
De zorgproductgroepcode (zoals afgeleid door Kerapu). |
|
95
|
|
|
""" |
|
96
|
|
|
|
|
97
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
98
|
|
|
def add_zorg_activiteit(self, zorg_activiteit_code: str, aantal: int) -> None: |
|
99
|
1 |
|
""" |
|
100
|
1 |
|
Voegt een zorgactiviteit toe and dit subtraject. |
|
101
|
|
|
|
|
102
|
|
|
:param str zorg_activiteit_code: De zorgactiviteitcode. |
|
103
|
|
|
:param int aantal: Het aantal malen (of eenheden) dat de zorgactiviteit is uitgevoerd. |
|
104
|
|
|
""" |
|
105
|
|
|
self.__zorg_activiteiten.append(ZorgActiviteit(zorg_activiteit_code, aantal)) |
|
106
|
|
|
|
|
107
|
1 |
|
# ------------------------------------------------------------------------------------------------------------------ |
|
108
|
|
|
@property |
|
109
|
|
|
def begin_datum(self) -> str: |
|
110
|
|
|
""" |
|
111
|
|
|
Geeft de begindatum van dit subtraject. |
|
112
|
|
|
|
|
113
|
|
|
:rtype: str |
|
114
|
1 |
|
""" |
|
115
|
|
|
return self.__begin_datum |
|
116
|
|
|
|
|
117
|
1 |
|
# ------------------------------------------------------------------------------------------------------------------ |
|
118
|
1 |
|
@property |
|
119
|
|
|
def leeftijd(self) -> int: |
|
120
|
|
|
""" |
|
121
|
|
|
Geeft de leeftijd van de patient van dit subtraject. |
|
122
|
|
|
|
|
123
|
|
|
:rtype: int |
|
124
|
1 |
|
""" |
|
125
|
|
|
return self.__patient.leeftijd(self.__begin_datum) |
|
126
|
|
|
|
|
127
|
1 |
|
# ------------------------------------------------------------------------------------------------------------------ |
|
128
|
1 |
|
@property |
|
129
|
|
|
def subtraject_nummer(self) -> str: |
|
130
|
|
|
""" |
|
131
|
|
|
Geeft het subtrajectnummer van dit subtraject. |
|
132
|
|
|
|
|
133
|
|
|
:rtype: str |
|
134
|
1 |
|
""" |
|
135
|
|
|
return self.__subtraject_nummer |
|
136
|
|
|
|
|
137
|
1 |
|
# ------------------------------------------------------------------------------------------------------------------ |
|
138
|
1 |
|
def telling_behandel_klasse(self, behandel_klasse_code: str, weeg_factor_nummer: int) -> int: |
|
139
|
|
|
""" |
|
140
|
|
|
Geeft het aantal zorgactiviteiten (met inachtneming van weegfactor) dat in dit subtraject voorkomt in een |
|
141
|
|
|
behandelklasse. |
|
142
|
|
|
|
|
143
|
|
|
:param str behandel_klasse_code: De behandelklassecode waartegen getest moet worden. |
|
144
|
1 |
|
:param int weeg_factor_nummer: Het weegfactornummer (0..2). |
|
145
|
|
|
|
|
146
|
|
|
:rtype: int |
|
147
|
1 |
|
""" |
|
148
|
|
|
aantal = 0 |
|
149
|
|
|
for zorg_activiteit in self.__zorg_activiteiten: |
|
150
|
|
|
aantal += zorg_activiteit.behandel_klasse_aantal(self.__zorg_product_groep_code, |
|
151
|
|
|
behandel_klasse_code, |
|
152
|
|
|
weeg_factor_nummer, |
|
153
|
|
|
self.__begin_datum) |
|
154
|
|
|
|
|
155
|
|
|
return aantal |
|
156
|
|
|
|
|
157
|
1 |
|
# ------------------------------------------------------------------------------------------------------------------ |
|
158
|
1 |
|
def telling_diagnose_attribuut(self, diagnose_attribuut_code: str) -> int: |
|
159
|
1 |
|
""" |
|
160
|
|
|
Geeft het aantal malen (d.w.z. 0 of 1) dat de diagnose van dit subtraject voldoet aan een |
|
161
|
|
|
(specialismecode, diagnosecode) combinatie. |
|
162
|
|
|
|
|
163
|
|
|
:param str diagnose_attribuut_code: De attribuutcode voor de (specialismecode, diagnosecode) combinatie. |
|
164
|
1 |
|
|
|
165
|
|
|
:rtype: int |
|
166
|
|
|
""" |
|
167
|
1 |
|
return self.__diagnose.diagnose_attribute_aantal(diagnose_attribuut_code, self.__begin_datum) |
|
168
|
|
|
|
|
169
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
170
|
|
|
def telling_diagnose_cluster(self, cluster_code: str, cluster_nummer: int) -> int: |
|
171
|
|
|
""" |
|
172
|
|
|
Geeft het aantal malen (d.w.z. 0 of 1) dat in dit subtraject voldoet aan een diagnoseclustercode. |
|
173
|
|
|
|
|
174
|
|
|
:param str cluster_code: De cluster_code waartegen getest moet worden. |
|
175
|
|
|
:param int cluster_nummer: Het clusternummer (1..6). |
|
176
|
1 |
|
|
|
177
|
|
|
:rtype: int |
|
178
|
|
|
""" |
|
179
|
1 |
|
return self.__diagnose.diagnose_cluster_aantal(cluster_code, cluster_nummer, self.__begin_datum) |
|
180
|
|
|
|
|
181
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
182
|
|
|
def telling_geslacht_code(self, geslacht_code: str) -> int: |
|
183
|
|
|
""" |
|
184
|
|
|
Geeft het aantal malen (d.w.z. 0 of 1) dat de patient van dit subtraject voldoet aan een geslacht. |
|
185
|
|
|
|
|
186
|
|
|
:param str geslacht_code: De geslachtscode waartegen getest moet worden. |
|
187
|
|
|
|
|
188
|
1 |
|
:rtype: int |
|
189
|
|
|
""" |
|
190
|
|
|
if self.__patient.geslacht_code == geslacht_code: |
|
191
|
1 |
|
return 1 |
|
192
|
|
|
|
|
193
|
|
|
return 0 |
|
194
|
|
|
|
|
195
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
196
|
|
|
def telling_specialisme(self, specialisme_code: str) -> int: |
|
197
|
|
|
""" |
|
198
|
|
|
Geeft het aantal malen (d.w.z. 0 of 1) dat het uitvoerend specialisme van dit subtraject voldoet aan een |
|
199
|
1 |
|
specialismecode. |
|
200
|
1 |
|
|
|
201
|
|
|
:param str specialisme_code: De specialismecode. |
|
202
|
1 |
|
|
|
203
|
|
|
:rtype: int |
|
204
|
|
|
""" |
|
205
|
1 |
|
return self.__specialisme.specialisme_aantal(specialisme_code, self.__begin_datum) |
|
206
|
|
|
|
|
207
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
208
|
|
|
def telling_specialisme_cluster(self, cluster_code: str, cluster_nummer: int) -> int: |
|
209
|
|
|
""" |
|
210
|
|
|
Geeft het aantal malen (d.w.z. 0 of 1) dat het uitvoerend specialisme van dit subtraject voldoet aan een |
|
211
|
|
|
specialismecluster. |
|
212
|
|
|
|
|
213
|
|
|
:param str cluster_code: De clustercode waartegen getest moet worden. |
|
214
|
1 |
|
:param int cluster_nummer: Het clusternummer (1..2). |
|
215
|
|
|
|
|
216
|
|
|
:rtype: int |
|
217
|
1 |
|
""" |
|
218
|
|
|
return self.__specialisme.specialisme_cluster_aantal(cluster_code, cluster_nummer, self.__begin_datum) |
|
219
|
|
|
|
|
220
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
221
|
|
|
def telling_zorg_activiteit(self, zorg_activiteit_code: str, weeg_factor_nummer: int) -> int: |
|
222
|
|
|
""" |
|
223
|
|
|
Geeft het aantal zorgactiviteiten (met inachtneming van weegfactor) dat in dit subtraject voldoet aan een |
|
224
|
|
|
zorgactiviteitcode. |
|
225
|
|
|
|
|
226
|
|
|
:param str zorg_activiteit_code: De zorgactiviteitcode. |
|
227
|
1 |
|
:param int weeg_factor_nummer: Het weegfactornummer (0..2). |
|
228
|
|
|
|
|
229
|
|
|
:rtype: int |
|
230
|
1 |
|
""" |
|
231
|
|
|
aantal = 0 |
|
232
|
|
|
zorg_activiteit_code = clean_code(zorg_activiteit_code, LEN_ZORG_ACTIVITEIT_CODE) |
|
233
|
|
|
for zorg_activiteit in self.__zorg_activiteiten: |
|
234
|
|
|
aantal += zorg_activiteit.zorg_activiteit_aantal(zorg_activiteit_code, |
|
235
|
|
|
weeg_factor_nummer, |
|
236
|
|
|
self.__begin_datum) |
|
237
|
|
|
|
|
238
|
|
|
return aantal |
|
239
|
|
|
|
|
240
|
1 |
|
# ------------------------------------------------------------------------------------------------------------------ |
|
241
|
1 |
|
def telling_zorg_activiteit_cluster(self, |
|
242
|
1 |
|
cluster_code: str, |
|
243
|
1 |
|
cluster_nummer: int, |
|
244
|
|
|
weeg_factor_nummer: int) -> int: |
|
245
|
|
|
""" |
|
246
|
|
|
Geeft het aantal zorgactiviteiten (met inachtneming van weegfactor) dat in dit subtraject voorkomt in een |
|
247
|
1 |
|
zorgactiviteitcluster. |
|
248
|
|
|
|
|
249
|
|
|
:param str cluster_code: De zorgactiviteitclustercode. |
|
250
|
1 |
|
:param int cluster_nummer: Het clusternummer (1..10). |
|
251
|
|
|
:param int weeg_factor_nummer: Het weegfactornummer (0..2). |
|
252
|
|
|
|
|
253
|
|
|
:rtype: int |
|
254
|
|
|
""" |
|
255
|
|
|
aantal = 0 |
|
256
|
|
|
for zorg_activiteit in self.__zorg_activiteiten: |
|
257
|
|
|
aantal += zorg_activiteit.zorg_activiteit_cluster_aantal(cluster_code, |
|
258
|
|
|
cluster_nummer, |
|
259
|
|
|
weeg_factor_nummer, |
|
260
|
|
|
self.__begin_datum) |
|
261
|
|
|
|
|
262
|
|
|
return aantal |
|
263
|
|
|
|
|
264
|
1 |
|
# ------------------------------------------------------------------------------------------------------------------ |
|
265
|
1 |
|
def telling_zorg_instelling(self, agb_code: str) -> int: |
|
266
|
1 |
|
""" |
|
267
|
|
|
Geeft het aantal malen (d.w.z. 0 of 1) dat de zorginstelling van dit subtraject voldoet aan AGB-code. |
|
268
|
|
|
|
|
269
|
|
|
:param str agb_code: De AGB-code waaraan de zorginstelling moet voldoen. |
|
270
|
|
|
|
|
271
|
1 |
|
:rtype: int |
|
272
|
|
|
""" |
|
273
|
|
|
return self.__zorg_instelling.zorg_instelling_aantal(agb_code) |
|
274
|
1 |
|
|
|
275
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
276
|
|
|
def telling_zorg_type_attribuut(self, zorg_type_attribuut_code: str) -> int: |
|
277
|
|
|
""" |
|
278
|
|
|
Geeft het aantal malen (d.w.z. 0 of 1) dat de zorgtype van dit subtraject voldoet aan een |
|
279
|
|
|
(specialismecode, zorgtypecode) combinatie. |
|
280
|
|
|
|
|
281
|
|
|
:param str zorg_type_attribuut_code: De attribuutcode voor de (specialismecode, zorgtypecode) combinatie. |
|
282
|
1 |
|
|
|
283
|
|
|
:rtype: int |
|
284
|
|
|
""" |
|
285
|
1 |
|
return self.__zorg_type.zorg_type_attribute_aantal(zorg_type_attribuut_code, self.__begin_datum) |
|
286
|
|
|
|
|
287
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
288
|
|
|
def telling_zorg_vraag_attribuut(self, zorg_vraag_attribuut_code: str) -> int: |
|
289
|
|
|
""" |
|
290
|
|
|
Geeft het aantal malen (d.w.z. 0 of 1) dat de zorgvraag van dit subtraject voldoet aan een |
|
291
|
|
|
(specialismecode, zorgvraagcode) combinatie. |
|
292
|
|
|
|
|
293
|
|
|
:param str zorg_vraag_attribuut_code: De attribuutcode voor de (specialismecode, zorgvraagcode) combinatie. |
|
294
|
1 |
|
|
|
295
|
|
|
:rtype: int |
|
296
|
|
|
""" |
|
297
|
1 |
|
return self.__zorg_vraag.zorg_vraag_attribute_aantal(zorg_vraag_attribuut_code, self.__begin_datum) |
|
298
|
|
|
|
|
299
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
300
|
|
|
def telling_zorg_vraag_cluster(self, cluster_code: str, cluster_nummer: int) -> int: |
|
301
|
|
|
""" |
|
302
|
|
|
Geeft het aantal malen (d.w.z. 0 of 1) dat de zorgvraag van een subtraject voorkomt in een zorgvraagcluster. |
|
303
|
|
|
|
|
304
|
|
|
:param str cluster_code: De cluster_code waartegen getest moet worden. |
|
305
|
|
|
:param int cluster_nummer: Het clusternummer (1..2). |
|
306
|
1 |
|
|
|
307
|
|
|
:rtype: int |
|
308
|
|
|
""" |
|
309
|
1 |
|
return self.__zorg_vraag.zorg_vraag_cluster_aantal(cluster_code, cluster_nummer, self.__begin_datum) |
|
310
|
|
|
|
|
311
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
312
|
|
|
@property |
|
313
|
|
|
def zorg_product_code(self) -> Optional[str]: |
|
314
|
|
|
""" |
|
315
|
|
|
Geeft de zorgproductcode van dit subtraject. |
|
316
|
|
|
|
|
317
|
|
|
:rtype: str|None |
|
318
|
1 |
|
""" |
|
319
|
|
|
return self.__zorg_product_code |
|
320
|
|
|
|
|
321
|
1 |
|
# ------------------------------------------------------------------------------------------------------------------ |
|
322
|
1 |
|
@zorg_product_code.setter |
|
323
|
|
|
def zorg_product_code(self, zorg_product_code: Optional[str]) -> None: |
|
324
|
|
|
""" |
|
325
|
|
|
Zet de zorgproductcode van dit subtraject. |
|
326
|
|
|
|
|
327
|
|
|
:param str zorg_product_code: De zorgproductcode. |
|
328
|
1 |
|
""" |
|
329
|
|
|
if zorg_product_code != '' and zorg_product_code is not None: |
|
330
|
|
|
self.__zorg_product_code = clean_code(zorg_product_code, LEN_ZORG_PRODUCT_CODE) |
|
331
|
1 |
|
else: |
|
332
|
1 |
|
self.__zorg_product_groep_code = None |
|
333
|
|
|
|
|
334
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
335
|
|
|
@property |
|
336
|
|
|
def zorg_product_groep_code(self) -> Optional[str]: |
|
337
|
|
|
""" |
|
338
|
1 |
|
Geeft de zorgproductgroepcode van dit subtraject. |
|
339
|
1 |
|
|
|
340
|
|
|
:rtype: str|None |
|
341
|
|
|
""" |
|
342
|
|
|
return self.__zorg_product_groep_code |
|
343
|
|
|
|
|
344
|
1 |
|
# ------------------------------------------------------------------------------------------------------------------ |
|
345
|
1 |
|
@zorg_product_groep_code.setter |
|
346
|
|
|
def zorg_product_groep_code(self, zorg_product_groep_code: Optional[str]) -> None: |
|
347
|
|
|
""" |
|
348
|
|
|
Zet de zorgproductgroepcode van dit subtraject. |
|
349
|
|
|
|
|
350
|
|
|
:param str zorg_product_groep_code: De zorgproductgroepcode. |
|
351
|
1 |
|
""" |
|
352
|
|
|
if zorg_product_groep_code != '' and zorg_product_groep_code is not None: |
|
353
|
|
|
self.__zorg_product_groep_code = clean_code(zorg_product_groep_code, LEN_ZORG_PRODUCT_GROEP_CODE) |
|
354
|
1 |
|
else: |
|
355
|
1 |
|
self.__zorg_product_groep_code = None |
|
356
|
|
|
|
|
357
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
|
358
|
|
|
|