forked from dannecker/report.api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreporting.erd
326 lines (293 loc) · 8.18 KB
/
reporting.erd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
[declarations]
id | uuid | not null
declaration_signed_id | uuid | not null
employee_id | uuid | not null
person_id | uuid | not null
start_date | date | not null
end_date | date | not null
status | enum('') | not null
signed_at | timestamp | not null
inserted_at | timestamp | not null
inserted_by | uuid | not null
updated_at | timestamp | not null
updated_by | uuid | not null
is_active | boolean
scope | enum('') | not null
division_id | uuid | not null
legal_entity_id | uuid | not null
[declarations_status_hstr]
id | integer | not null
declaration_id | UUID | not null
status | enum('') | not null
inserted_at | timestamp | not null
[divisions]
id | uuid | not null
legal_entity_id | uuid | not null
name | varchar | not null
addresses | jsonb | not null
external_id | varchar
phones | jsonb[] | not null
email | varchar
mountain_group | varchar
type | varchar | not null
status | varchar | not null
is_active | boolean | not null
inserted_at | timestamp | not null
updated_at | timestamp | not null
location | geometry
[employees]
id | uuid | not null
legal_entity_id | uuid | not null
party_id | uuid | not null
division_id | uuid
position | varchar | not null
start_date | date | not null
end_date | date
inserted_at | timestamp | not null
inserted_by | uuid | not null
updated_by | uuid | not null
updated_at | timestamp | not null
status | enum('') | not null
employee_type | enum('doctor','hr','owner','accountant') | not null
is_active | boolean | not null
status_reason | string
[employee_doctors]
id | uuid | not null
education | jsonb[] | not null
qualification | jsonb[]
specialities | jsonb[] | not null
science_degree | jsonb
employee_id | uuid | not null
inserted_at | timestamp | not null
updated_at | timestamp | not null
[legal_entities]
id | uuid | not null
name | varchar | not null
short_name | varchar
public_name | varchar
type | enum('msp','mis','drug_store') | not null
edrpou | varchar(8) | not null unique
addresses | jsonb[] | not null
phones | jsonb[]
email | varchar
inserted_at | timestamp | not null
inserted_by | uuid | not null
updated_at | timestamp
updated_by | uuid | not null
is_active | boolean | not null
kveds | jsonb | not null
status | enum('new','verified') | not null
owner_property_type | enum('state','private') | not null
legal_form | enum('тов','фоп') | not null
created_via_mis_client_id | uuid | not null
nhs_verified | boolean | not null
mis_verified | enum('verified','not_verified') | not null
[medical_service_providers]
id | uuid | not null
accreditation | jsonb | not null
licenses | jsonb[]
inserted_at | timestamp | not null
updated_at | timestamp | not null
legal_entity_id | uuid | not null
[parties]
id | uuid | not null
last_name | varchar | not null
first_name | varchar | not null
second_name | varchar
[party_users]
id | uuid | not null
party_id | uuid | not null
user_id | uuid | not null
[medications]
id | uuid | not null
name | varchar | not null
type | varchar | not null
manufacturer | jsonb
code_atc | varchar
is_active | boolean | not null
form | varchar | not null
container | jsonb
package_qty | number
package_min_qty | number
certificate | varchar
certificate_expired_at | date
inserted_at | timestamp | not null
inserted_by | uuid | not null
updated_at | timestamp | not null
updated_by | uuid | not null
[medical_programs]
id | uuid | not null
name | varchar | not null
is_active | boolean | not null
inserted_at | timestamp | not null
inserted_by | uuid | not null
updated_at | timestamp | not null
updated_by | uuid | not null
[medication_requests]
id | uuid | not null
request_number | varchar | not null
verification_code | varchar
created_at | date | not null
started_at | date| not null
ended_at | date| not null
dispense_valid_from | date| not null
dispense_valid_to | date| not null
person_id | uuid | not null
employee_id | uuid | not null
division_id | uuid | not null
medication_id | uuid | not null
medication_qty | number | not null
status | varchar | not null
is_active | boolean | not null
rejected_at | date
rejected_by | uuid
reject_reason | varchar
medication_request_requests_id | uuid | not null
medical_program_id | uuid
inserted_at | timestamp | not null
inserted_by | uuid | not null
updated_at | timestamp | not null
updated_by | uuid | not null
[medication_dispenses]
id | uuid | not null
medication_request_id | uuid | not null
dispensed_at | date | not null
party_id | uuid | not null
legal_entity_id | uuid | not null
division_id | uuid | not null
medical_program_id | uuid
payment_id | varchar
status | varchar | not null
is_active | boolean | not null
inserted_at | timestamp | not null
inserted_by | uuid | not null
updated_at | timestamp | not null
updated_by | uuid | not null
[medication_dispense_details]
id | uuid | not null
medication_dispense_id | uuid | not null
medication_id | uuid | not null
medication_qty | number | not null
sell_price | number | not null
sell_amount | number | not null
discount_amount | number | not null
reimbursement_amount | number | not null
[medication_dispense_status_hstr]
id | integer | not null
medication_dispense_id | uuid | not null
status | varchar | not null
inserted_at | timestamp | not null
[medication_requests_status_hstr]
id | integer | not null
medication_request_id | uuid | not null
status | varchar | not null
inserted_at | timestamp | not null
[regions]
id | UUID | NOT NULL
koatuu | VARCHAR('10')
name | VARCHAR('50') | NOT NULL
[districts]
id | UUID | NOT NULL
koatuu | VARCHAR('10')
region_id | UUID | NOT NULL
name | VARCHAR('100') | NOT NULL
[settlements]
id | UUID | NOT NULL
type | VARCHAR(1)
koatuu | VARCHAR('10')
name | VARCHAR | NOT NULL
district_id | UUID
region_id | UUID | NOT NULL
mountain_group | VARCHAR(150)
parent_settlement | UUID
[streets]
id | UUID | NOT NULL
settlement_id | UUID | NOT NULL
type | VARCHAR(255) | NOT NULL
name | VARCHAR(150) | NOT NULL
inserted_at | timestamp | not null
updated_at | timestamp
[streets_aliases]
id | UUID | NOT NULL
street_id | UUID | NOT NULL
name | VARCHAR(150) | NOT NULL
[billings]
id | UUID | NOT NULL
billing_date | date
declaration_id | uuid
legal_entity_id | uuid
division_id | uuid
mountain_group | boolean
person_age | integer
inserted_at | timestamp | not null
updated_at | timestamp | not null
compensation_group | string | not null
decision_id | string | not null
red_msp_id | uuid | not null
is_valid | boolean | not null
[billing_logs]
id | UUID | NOT NULL
billing_date | date | NOT NULL
legal_entity_id | uuid
declaration_id| uuid
person_id | uuid
division_id | uuid
message | ARCHAR(255)
person_age | integer
inserted_at | timestamp | not null
[report_logs]
id | UUID | NOT NULL
type | VARCHAR(255)
public_url | VARCHAR(255)
inserted_at | timestamp | not null
[red_msps]
id | uuid | not null
name | varchar | not null
edrpou | varchar(8) | not null unique
inserted_at | timestamp | not null
updated_at | timestamp
is_active | boolean | not null
type | enum('child','general') | not null
population_count | integer| not null
[red_msps_territories]
id | uuid | not null
red_msp_id | uuid | not null
settlement_id | uuid | not null
street_type | VARCHAR(250)
street_name | VARCHAR(250)
postal_code | VARCHAR(5)
buildings | VARCHAR(2000)
employees 1--* declarations
divisions *--1 legal_entities
employees *--1 legal_entities
parties 1--+ employees
parties 1--* party_users
employees *--1 divisions
employees 1--? employee_doctors
medical_service_providers 1--1 legal_entities
parties 1--? doctors
declarations 1--* declarations_status_hstr
medication_requests *--1 legal_entities
medication_requests *--1 divisions
medication_requests *--1 employees
medication_requests *--1 medications
medication_requests 1--* medication_dispenses
medication_requests *--1 medication_requests_status_hstr
medication_dispenses *--1 legal_entities
medication_dispenses *--1 divisions
medication_dispenses *--1 employees
medication_dispenses *--1 medication_dispense_status_hstr
medication_dispenses 1--* medication_dispense_details
medication_dispense_details 1--1 medications
regions 1--+ districts
regions 1--+ settlements
districts 1--+ settlements
settlements 1--+ streets
regions 1--+ streets
districts 1--+ streets
streets 1--+ streets_aliases
billings 1--* declarations
billings *--1 legal_entities
billings *--1 divisions
billings 1--* red_msps
red_msps 1--* red_msps_territories