Design Report
Design Report
Design Report
Prepared for
Drugs, Drugs, Drugs
Pharmacy Chain
Prepared By
Data and Stuff Consulting
Michael Cervantes, Robin Hurtado
Introduction
Purpose
Drugs, Drugs, Drugs is a chain drug store in need of a database to manage its prescriptions. They operate
multiple stores and need to track details of prescriptions and prescription fulfillment, as well as patients, doctors, and
pharmaceutical companies related to the prescriptions.
Restate Requirements
The details of prescription fulfillment need to be tracked. When a prescription is filled, we want to track the filling
pharmacy and date that it was fulfilled.
Each prescription is written on a specific date for one patient, by one doctor, for one drug, with the quantity of that drug
prescribed.
Every patient has a primary doctor; however, any doctor can write a prescription for any patient.
The drug has a generic name, and may also have a unique trade name specific to a pharmaceutical company.
If the prescription lists a drug by its generic name, then any drug with that formula name can be used to fulfill that
prescription. If prescription lists a drug by trade name, then only that specific trade name associated with a specific
pharmaceutical company can be used to fill that prescription.
A doctor has a unique SSN, as well as a name, specialty, and years of experience.
A pharmaceutical company is identified by its name, and also has a phone number.
Each pharmacy sells several drugs, and the price of an individual drug may vary by pharmacy.
Pharmaceutical companies have long-term contracts with pharmacies. A pharmacy can have contracts with multiple
pharmaceutical companies, and a pharmaceutical company can have contracts with multiple pharmacies.
A supervisor is appointed by the pharmacy for each contract. Each contract has a supervisor, but the supervisor may
change. One supervisor may be assigned to multiple contracts.
EER Diagram
All phone numbers are US phone numbers and only require 9 digits.
Required non- key attributes for patient entities are name andSSN.
Required non-key attributes for prescription entities are prescription number, date, and quantity.
Required non-key attributes for doctor entities are SSN, name, and years of experience.
Required non-key attributes for contract entities are start date, end date, and text.
The following constraint cannot be accomplished through SQL schema, and will need to be addressed through
application code:
If a prescription indicates a drug’s generic name, any drug with that formula name can be used to fill the prescription. If
the prescription indicates a drug’s trade name, then the specific drug from the specific associated pharmaceutical
company must be used to fill the prescription.
Relational Schema
SET @OLD_SQL_MODE=@@SQL_MODE,
SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION
_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema cst363
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema cst363
-- -----------------------------------------------------
USE `cst363` ;
-- -----------------------------------------------------
-- Table `Doctor`
-- -----------------------------------------------------
-- ENGINE = InnoDB;
-- Prof's schema for Dr table for java program
);
-- TRUNCATE DOCTOR;
-- -----------------------------------------------------
-- Table `Patient`
-- -----------------------------------------------------
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- TRUNCATE PATIENT;
-- -----------------------------------------------------
-- Table `Drug`
-- -----------------------------------------------------
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Prescription`
-- -----------------------------------------------------
CONSTRAINT `fk_Prescription_Patient1`
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Prescription_Doctor1`
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Prescription_Drug1`
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Pharmacy`
-- -----------------------------------------------------
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Fill`
-- -----------------------------------------------------
CONSTRAINT `fk_Fill_Prescription1`
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Fill_Pharmacy1`
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `PharmaCo`
-- -----------------------------------------------------
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Drug_has_PharmaCo`
-- -----------------------------------------------------
CONSTRAINT `fk_PharmaCo_has_Drug_PharmaCo1`
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_PharmaCo_has_Drug_Drug1`
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Pharmacy_sells_Drug`
-- -----------------------------------------------------
CONSTRAINT `fk_Pharmacy_has_Drug_Pharmacy1`
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Pharmacy_has_Drug_Drug1`
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `Contract`
-- -----------------------------------------------------
CONSTRAINT `fk_Pharmacy_has_PharmaCo_Pharmacy1`
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_Pharmacy_has_PharmaCo_PharmaCo1`
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
Patient Form
The Patient Register form has nine fields to enter. Patient’s SSN, first name, last name, birthdate, street, city,
state, zip code, and Primary Physician Name. Each field must have the correct input from the patient to be valid.
When the user enters an invalid entry the form throws an error to warn about the incorrect input.
Successful update and found patient.
When adding a New Prescription, we are encountering an error that will need to be corrected with an update patch.
Conclusions
Data and Stuff Consulting have built a database that doctors and patients can trust and have confidence in using.
With reliable software that can keep track of patients prescriptions. While doctors can prescribe medication to their
patients knowing the software can help deliver the needs of their patients. Data and Stuff Consulting looks forward to
building the bridge between a patient and their physician.