| 1 | == Релациско Мапирање == |
| 2 | |
| 3 | === Ознаки === |
| 4 | |
| 5 | * Примарните кличеви се болдирани и подвлечени. |
| 6 | * Надворешните кличеви се означени со * до името на надворешниот клуч и во заградата () е името на ентитетот кој го референцираат |
| 7 | * Задолжителните атрибути се болдирани |
| 8 | |
| 9 | === Табели === |
| 10 | |
| 11 | 1. Company (**__id__**, **company_name**, description, **registration_number**) |
| 12 | 2. Medicine (**__id__**, **medicine_name**, **active_ingredient**) |
| 13 | 3. PaymentMethod (**__id__**, **method_name**) |
| 14 | 4. Users (**__id__**, **first_name**, **last_name**, **username**, **hashed_password**, **e_mail**, gender, **date_created**) |
| 15 | 5. Admins (**__user_id*(Users)__**) |
| 16 | 6. DeliveryCompany (**__company_id*(Company)__**) |
| 17 | 7.Distributor (**__company_id*(Company)__**) |
| 18 | 8. Facility (**__id__**, **__company_id*(Company)__**, **facility_name**, **code**) |
| 19 | 9. Inventory (**__facility_id*(Facility)__**) |
| 20 | 10. Manufacturer (**__company_id*(Company)__**) |
| 21 | 11. MedicineInteraction (**__medicine_id_1*(Medicine)__**, **__medicine_id_2*(Medicine)__**, **type**, description, **severity**) |
| 22 | 12. Patient (**__user_id*(Users)__**, **is_verified**) |
| 23 | 13. Payment (**__id__**, **__patient_id*(Patient)__**, **__payment_method_id*(PaymentMethod)__**, **payment_date**, **amount**, **status**) |
| 24 | 14. Pharmacist (**__user_id*(Users)__**) |
| 25 | 15. Pharmacy (**__company_id*(Company)__**) |
| 26 | 16. Prescription (**__id__**, patient_id*(Patient), **__medicine_id*(Medicine)__**, **issued_by**, **issued_at**, **valid_to**, **embg**) |
| 27 | 17. SensitivePatientData (**__id__**, **__patient_id*(Patient)__**, pharmacist_id*(Pharmacist), **embg**, **portrait_photo**) |
| 28 | 18.ShoppingCart (**__id__**, **__patient_id*(Patient)__**) |
| 29 | 19.SupplyOrder (**__id__**, **__distributor_id*(Distributor)__**, **__pharmacy_id*(Pharmacy)__**, **order_date**, **expected_arrival_date**) |
| 30 | 20.BrandedMedicine (**__id__**, **__manufacturer_id*(Manufacturer)__**, **price**, description, **dosage_form**, **strength**, origin_country) |
| 31 | 21.BrandedMedicineImage (**__id__**, **__branded_medicine_id*(BrandedMedicine)__**, **image**) |
| 32 | 22. ClubCard (**__id__**, **__user_id*(Patient)__**, **club_program**, **points**) |
| 33 | 23. ContactInformation (**__id__**, phone, address, user_id*(User), facility_id*(Facility)) |
| 34 | 24. Distributor_BrandedMedicine (**__id__**, **__distributor_id*(Distributor)__**, **__branded_medicine_id*(BrandedMedicine)__**) |
| 35 | 25. HealthProfile (**__id__**, **__patient_id*(Patient)__**, blood_type) |
| 36 | 26. Inventory_BrandedMedicine (**__inventory_id*(Inventory)__**, **__branded_medicine_id*(BrandedMedicine)__**, **quantity**, **last_changed**) |
| 37 | 27. PatientOrder (**__id__**, **__patient_id*(Patient)__**, **__delivery_company_id*(DeliveryCompany)__**, **__payment_id*(Payment)__**, **order_date**, **expected_arrival_date**, **status**, **total_price**) |
| 38 | 28. PatientOrder_BrandedMedicine (**__id__**, **order_id*(Order)**, **__branded_medicine_id*(BrandedMedicine)__**, **quantity**) |
| 39 | 29. Pharmacy_Catalog (**__pharmacy_id*(Pharmacy)__**, **__branded_medicine_id*(BrandedMedicine)__**) |
| 40 | 30. ShoppingCart_BrandedMedicine (**__shopping_cart_id*(ShoppingCart)__**, **__branded_medicine_id*(BrandedMedicine)__**, **quantity**) |
| 41 | 31. SupplyOrder_BrandedMedicine (**__supply_order_id*(SupplyOrder)__**, **__branded_medicine_id*(BrandedMedicine)__**, **quantity**) |
| 42 | 32. AllergicReaction_HealthProfile_Medicine (**__health_profile_id*(HealthProfile)__**, **__medicine_id*(Medicine)__**, date_diagnosed, description, severity) |
| 43 | 33. Branded_Medicine_InstanceOf_Medicine (**__branded_medicine_id*(BrandedMedicine)__**, **__medicine_id*(Medicine)__**) |
| 44 | |
| 45 | === DDL скрипта за бришење и креирање на табелите === |
| 46 | |
| 47 | |
| 48 | === DDL скрипта за полнење на табелите со податоци === |
| 49 | |
| 50 | |
| 51 | == Релациски Дијаграм == |