Development of A Medical Record Databse System
Development of A Medical Record Databse System
Development of A Medical Record Databse System
GROUP 1
NAME AMUDA TOSIN MATTHEW OMOLABAKE OPEOLUWA JOSEPH OLATUNJI MICHAEL FAPOUNDA OLUWASEUN SALAMI SHEHU TIJANI OSINUGA OLUWASEUN
CONTENTS
CONTENTS ...................................................................................................................................................... i ACKNOWLEDGEMENT ................................................................................................................................... ii INTRODUCTION ............................................................................................................................................. 1 PROBLEM STATEMENT.............................................................................................................................. 1 BUSINESS RULE ......................................................................................................................................... 2 CONCEPTUAL SCHEMA ................................................................................................................................. 3 ER DIAGRAM ............................................................................................................................................. 3 RELATIONAL MODEL ..................................................................................................................................... 5 Functional Dependencies .......................................................................................................................... 5 Relations ................................................................................................................................................... 6 KEYS DEFINITION ........................................................................................................................................... 7 CANDIDATE KEYS DEFINITION ................................................................................................................... 7 FOREIGN KEYS DEFINITION ....................................................................................................................... 7 Domain Key Normal Form Definitions .......................................................................................................... 9 POPULATING THE TABLES ........................................................................................................................... 13 QUERIES ...................................................................................................................................................... 18 1. 2. 3. JOINING TWO RELATIONS ............................................................................................................... 18 JOINING THREE RELATIONS............................................................................................................. 19 JOINING FIVE RELATIONS ................................................................................................................ 20
ACKNOWLEDGEMENT
We wish to acknowledge to excellent support that we have received to complete this paper. We would like to thank our instructor, Professor H.O.D Longe for your labour of love as you toil to bequeath us knowledge and introduce us into the field of Database. Our heartfelt gratitude goes to Google.Com which gave answers to every possible question. Finally our deepest gratitude however, goes out to the Almighty God who has been very good to us throughout from the beginning to the end of this project.
ii
INTRODUCTION
PROBLEM STATEMENT
The medical record system is a database management system that uses database technology to construct, maintain and manipulate various ki ds of data a out a perso s edi al history a d care across time. The DBMS can track and update all the information of registered patients in the medical Centre during a particular time span. Medical records are created when a patient receive treatment from a health professional. Records may include the patients: personal information medical history details about lifestyle and family medical history laboratory test results medications prescribed reports that indicate the results of operations and other medical procedures disabilities, allergies and; life or accidental insurance with private insurers or government programs.
The medical record serves a variety of purposes and is essential to the proper functioning of the medical practiceespe ially i todays o pli ated health are e viro e t. The edi al record is a key instrument used in planning, evaluating, and coordinating patient care in both the inpatient and the outpatient settings. The content of the medical record is essential for patient care, accreditation (if applicable to the practitioner), and reimbursement purposes. The medical record administrator may be a clinician, billing manager, coder, or anyone assigned the responsibility in the medical office. The medical record administrator is responsible for filing patient information in the medical record. He or she is also responsible for knowing medical insurance contract requirements, legal requirements pertaining to privacy and confidentiality of the patient.
BUSINESS RULE
The business rule for a medical record database: A patient medical record is registered on the first visit to the doctor. A patient can make many appointments with one or more doctors. A doctor can accept appointments with many patients. However, each appointment is made with only one doctor, and each appointment references a single patient If an appointment yields a visit with a doctor, the visit yields a diagnosis and, when appropriate treatment. With each visit, the patie ts history is updated. Each visit creates a bill. Each patient visit is billed by one doctor, and each doctor can bill many patients. Each bill must be paid. However, a bill may be paid in many installments, and a payment may cover more than one bill. A patient may pay the bill directly, or the bill may be the basis for a claim submitted to an insurance company. If a bill is paid by an insurance company, the deductible is submitted to the patient for payment.
CONCEPTUAL SCHEMA
ER DIAGRAM
Entity
Doctor Patient City Gender Visit History Insurance Bill Payment Diagnosis Prescription Record Medicine Manufacturer
Attributes
D_name, D_SSn, Age, Phone, address, Office P_Name, P_Ssn, BirthDate, Phone, address ZIP, city_name Gender_id, Gender_type Visit_id, date, time, complaint , Diagnosis_Id, D_Ssn, Prescription_id P_Ssn, Visit_id InsCo_Id, InsCo_Name, Category, Phone, Address, City, Zip Bill_Num, Amount, Bill_Date, Due_Date Bill_Num, PayTrans_Num, Pay_Method, Pay_Status, Paid_Date Diagnosis_Id, category Prescription_Id, medicine_Quantity record_id, record_type MInventory_Id, M_name, Price, Quantity, Exp_Date Manufacturer_id, Manufacturer_name
RELATIONAL MODEL
Functional Dependencies Relation
Doctor
Funtional dependencies
Patient
D_SSnD_name, Age, Phone, address, Office ZIP, D_Ssn city_name Gender_id, D_Ssn Gender_type P_Ssn P_Name, Age, BirthDate, Phone, address ZIP, P_Ssn city_name Gender_id, P_Ssn Gender_type ZIP city_name Gender_id Gender_type Visit_iddate, time, complaint , Diagnosis_Id, D_Ssn, Prescription_id P_Ssn, Visit_iddate, time, complaint , Diagnosis_Id, D_Ssn, Prescription_id InsCo_Id, InsCo_Name, Phone, Address InsCo_Id, P_Ssn InsCo_Name, Phone, Address ZIP, InsCo_Id city_name Bill_NumAmount, Bill_Date, Due_Date Bill_Num, P_Ss, Diagnosis_Id, Prescription_IdAmount, Bill_Date, Due_Date PayTrans_Num Pay_Method, Pay_Status, Paid_Date Bill_Num, PayTrans_Num Pay_Method, Pay_Status, Paid_Date Diagnosis_Id category Prescription_Id medicine_Quantity Record_idRecord_type Record_id, P_Ssn Record_type MInventory_Id M_name, Manufacturer, Price, Quantity, Exp_Date MInventory_Id, prescription_IdM_name, Price, Quantity, Exp_Date Manufacturer_IdManufacturer_name
Relations
Based on the functional dependencies above, we normalized all relations and converted the ER model into a relational model: Doctor (D_Ssn,D_name, Age, Phone, address, Office) Patient (P_Ssn, P_Name, BirthDate, Phone, address) Gender (Gender_id, Gender_name) City (ZIP, city_name) DoctorGender (Gender_id, D_Ssn) DoctorCity (ZIP, D_SSn) PatientGender (Gender_id, P_Ssn) PatientCity (ZIP, P_Ssn) Visit (Visit_id, date, time, complaint, Diagnosis_Id, D_Ssn, Prescription_id) History (P_Ssn, Visit_id) Insurance (InsCo_Id, InsCo_Name, Phone, Address) Patient_Insurance (InsCo_Id, P_Ssn) InsuranceCity (InsCo_Id, ZIP) Bill (Bill_Num,Amount, Bill_Date, Due_Date) PatientBill (Bill_Num, P_Ssn, Diagnosis_Id, Prescription_Id) Payment (PayTrans_Num, Pay_Method, Pay_Status, Paid_Date) BillPayment (Bill_Num, PayTrans_Num) Diagnosis (Diagnosis_Id, category) Prescription (Prescription_Id, medicine_Quantity) Record (record_id,record_type) PatientRecord (record_id, P_Ssn) Medicine (MInventory_Id, Manufacturer_id, M_name, Price, Quantity, Exp_Date) Manufacturer (Manufacturer_Id, Manufacturer_name) PrescriptionMedicine (MInventory_Id, prescription_Id)
KEYS DEFINITION
CANDIDATE KEYS DEFINITION
Relations Doctor Patient Gender City Insurance Bill Payment Diagnosis Prescription Record Medicine Manufacturer Visit Candidate keys (Primary Keys) D_Ssn P_Ssn Gender_id ZIP InsCo_Id Bill_Num PayTrans_Num Diagnosis_id Prescription_id Record_id MInventory_Id Manufacturer_Id Visit_Id
BillPayment PatientRecord
Medicine PrescriptionMedicine
Constraints
Key: (foreign)Gender_id (foreign) D_Ssn Domain: Gender_id: 10(Varchar), D_Ssn: 10(Varchar) Key: (foreign)ZIP (foreign)D_Ssn Domain: ZIP: 10(Varchar), D_Ssn: 10(Varchar) Key: (foreign)Gender_id (foreign)P_Ssn Domain: Gender_id: 10(Varchar), P_Ssn: 10(Varchar) Key: (foreign)ZIP (foreign) P_Ssn Domain: ZIP: 10(Varchar), P_Ssn: 10(Varchar) Key: (primary)Visit_id (foreign)Diagnosis_Id (foreign)D_Ssn (foreign)Prescription_id Domain: Visit_id: 10(Varchar), date: Date, time: DateTime, complaint: text(255) , Diagnosis_Id: 10(Varchar), D_Ssn: 10(Varchar), Prescription_id: 10(Varchar) Key: P_Ssn + Visit_iddate, time, complaint , Diagnosis_Id, D_Ssn, Prescription_id Domain: P_Ssn: 10(Varchar) ,Visit_id: 10(Varchar) Key: (Foreign)P_SSn (Foreign)InsCo_Id 9
DoctorCity
PatientGender
PatientCity
Visit
History
Patient_Insurance
Domain: P_SSn: 10(Varchar), InsCo_Id:10(Varchar) InsuranceCity Key: (foreign) InsCo_Id (foreign) ZIP Domain: InsCo_Id: 10(Varchar), ZIP: 10(Varchar) Key: (Foreign)Bill_Num (Foreign)P_Ssn (Foreign)Diagnosis_Id (Foreign) Prescription_Id) Domain: Bill_Num: 10(Varchar), P_Ssn: 10(Varchar) Diagnosis_Id: 10(Varchar), Prescription_Id: 10(Varchar) Key: (Foreign)Bill_Num (Foreign)PayTrans_Num Domain: Bill_Num: 10(Varchar), PayTrans_Num:10(Varchar) Key: (Foreign)record_id (Foreign) P_Ssn Domain: record_id: 10(Varchar), P_Ssn: 10(Varchar) Key: (Primary)MInventory_Id (Foreign)Manufacturer_id Domain: MInventory_Id: 10(Varchar), Manufacturer_id: 10(Varchar), M_name: 30 (String), Price: 10(int), Quantity: 10(in), Exp_Date: Date Key: (Foreign) MInventory_Id (Foreign) prescription_Id Domain: MInventory_Id: 10(Varchar) , prescription_Id: 10(Varchar) Key: (Primary Key) D_Ssn Domain: 10
PatientBill
BillPayment
PatientRecord
Medicine
PrescriptionMedicine
Doctor
D_Ssn: 10(Varchar), D_name: 30(String), Age: 3(int), Phone:15(Varchar), address: 50(Varchar), Office: 50(Varchar) Patient Key: (Primary)P_Ssn Domain: P_Ssn:10(Varchar), P_Name:30(String), BirthDate: Date, Phone: 15(Varchar), address: 50(Varchar) Key: (primary) Gender_id Domain: Gender_id: 10(Varchar), Gender_name: male, female, hermaphrodite Key: (primary) ZIP Domain: ZIP: 10(Varchar) , city_name: 30(String) Key: (Primary)InsCo_Id Domain: InsCo_Id: 10(Varchar), InsCo_Name: 30(String), Phone:15(Varchar), Address: 30(Varchar) Key: (Primary)Bill_Num Domain: Bill_Num 10(Varchar) ,Amount 10(int), Bill_Date: Date, Due_Date: Date Key: (Primary)PayTrans_Num Domain: PayTrans_Num: 10(Varchar) , Pay_Method : (insurance, self), Pay_Status:(paid, pending, not paid), Paid_Date: Date Key: (Primary)Diagnosis_Id Domain: Diagnosis_Id: 10(Varchar) , category: 30(String) Key: (Primary)Prescription_Id Domain: Prescription_Id: 10 (Varchar), medicine_Quantity: 11
Gender
City
Insurance
Bill
Payment
Diagnosis
Prescription
10(int) Record Key: (primary) record_id Domain: record_id: 10(Varchar), record_type: 30(VarChar) Key: (Primary)MInventory_Id (Foreign)Manufacturer_id Domain: MInventory_Id: 10(Varchar), Manufacturer_id:10(Varchar), M_name: 30(String), Price: 10(int), Quantity:10(int), Exp_Date: Date Key: (Primary)Manufacturer_Id Domain: Manufacturer_Id:10(Varchar), Manufacturer_name: 30(String)
Medicine
Manufacturer
12
2. Patient table
3. Gender table
4. City table
5. Insurance table
13
6. Bill table
7. Payment table
8. Diagnosis table
9. Record table
14
15
22. BillPayment
17
QUERIES
1. JOINING TWO RELATIONS
SHOWING ALL THE PATIENTS WITH INSURANCE SELECT patient.P_name, insurance.InsCo_name FROM insurance JOIN patient_insurance ON insurance.InsCo_Id = patient_insurance.InsCo_Id JOIN patient ON patient_insurance.P_Ssn = patient.P_Ssn;
18
19
20
CONCLUSION
EXPERIENCE
Merging the relations was made easy due to the fact that foreign keys existed that referenced the various tables that were merged. The SQL statement became complex and more error-prone as the number of relations to be merged increased. The Database Management System used is MYSQL.
21
REFERENCE
Lecture notes http://www.wikipedia.com http://www.books.google.com http://www.business.mcmaster.ca Database Application Design by Dragomir R. Radev A Normal Form for relational databases that is not based on domains and keys(Article) By Ronald Fagin.
22