You are on page 1of 5

create database hms1

on
(
name='abp',
filename='G:\database\YP.mdf',
size=10,
maxsize=100,
filegrowth=5
)
log on
(
name='ab1',
filename='G:\database\YPlog.ldf',
size=20,
maxsize=40,
filegrowth=5
)
use hms1
create table Accumulated_Receipt
(
Room_no varchar(10)constraint PK11 primary key,
Room_type varchar(12),
First_Name varchar(18),
Last_Name varchar(21),
Age varchar(25),
Gender varchar(17),
Address varchar(27),
Bed_Charges varchar(16),
Receipt_Start_date datetime,
Receipt_End_date datetime,
No_of_days varchar(14)
)
insert into Accumulated_Receipt values('101','Non-AC','Albert','James','59 years
','M','London','1500GBP','2011/10/11','2011/11/12','31days')
insert into Accumulated_Receipt values('102','AC','Victotia','Song','44 years','
F','Alexandia','2500GBP','2011/11/02','2011/12/01','30days')
insert into Accumulated_Receipt values('103','AC','Md. Ali Abdul','Razak','35 ye
ars','M','Dubai','3500GBP','2011/01/09','2011/02/10','31days')
insert into Accumulated_Receipt values('104','Non-AC','Sunil','Roy','20years','M
','Kolkata','4500Rs','2011/10/02','2011/12/10','40days')
insert into Accumulated_Receipt values('105','AC','Miranda','Lincoln','49years',
'F','Ohio','4500GBP','2010/12/04','2011/02/13','40days')
insert into Accumulated_Receipt values('106','Non-AC','Priyanka','Sharma','66yea
rs','F','Pune','45000Rs','2011/03/01','2011/03/15','15days')
select * from Accumulated_Receipt
create table Patient_Entry
(
Title varchar(12),
Registration_No varchar(10)constraint PK10 primary key,
Room_No varchar(10)references Accumulated_Receipt(Room_No),
Registration_date datetime,
First_name varchar(20),
Last_name varchar(15),
P_address varchar(30),
City varchar(12),

State_Province varchar(10),
Nationality varchar(9),
Date_of_Birth datetime,
Postal_code varchar(25),
Country varchar(25),
Occupation varchar(20),
Religion varchar(15),
Telephone_no varchar(26),
Mobile_no varchar(26),
Marital_Status varchar(13),
Guardian_name varchar(20),
Age varchar(10),
Gender varchar(10),
Email_id varchar(19)
)
insert into Patient_Entry values('Mr','R001','101','2011/2/10','Albert','James',
'Lincoln Street','London','UK','British',
'1952/1/12','5001','England','Business','Christian','200001','123332','Married',
'Kevin James','59','Male','jamesalbert@gmail.com')
insert into Patient_Entry values('Mrs','R002','102','2011/5/9','Victoria','Song'
,'Highway Road','Alexandria','NULL','Egyptian',
'1967/8/8','89104','Egypt','Professor','Muslim','65102354','4081206712','Married
','Robert Song','44','Female','songvic@gmail.com')
insert into Patient_Entry values('Mr','R003','103','2011/2/10','Md. Ali Abdul','
Razak','Sheikh Zayed Road','Dubai','NULL','Emirati',
'1976/3/8','50251','UAE','Business','Muslim','200001','123332','Married','Md. Za
yed Abdul','35','Male','abdulali@hotmail.com')
insert into Patient_Entry values('Mr','R004','104','2011/2/10','Sunil','Roy','Ba
rista street','Kolkata','West Bengal','Indian',
'1991/4/2','654121','India','Regional Manager','Hindu','200001','123332','Marrie
d','Shantanu Roy','20','Male','roysun@sify.com')
insert into Patient_Entry values('Ms','R005','105','2011/2/10','Miranda','Lincol
n','Park street','Columbus','Ohio','American',
'1962/4/22','50251','US','CEO','Catholic','4321001','123332','Unmarried','Gerad
Lincoln','49','Female','mikemiranda@sify.com')
insert into Patient_Entry values('Mrs','R006','106','2011/2/10','Priyanka','Shar
ma','Venugopal Road','Pune','Maharashtra','Indian',
'1945/7/6','654121','India','Supervisor','Hindu','200001','123332','Married','Sh
antanu Roy','20','Female','priyankash@sify.com')
select * from Patient_Entry
create table Diagnosis_Form
(
Diagnosis_number varchar(14)constraint PK3 primary key,
Registration_No varchar(10) references Patient_Entry(Registration_No),
Diagnosis_date datetime,
First_name varchar(14),
Last_name varchar(14),
Gender varchar(10),
Age varchar(23),
Test varchar(30),
Reconsultation_advice_day varchar(15),
Injection_date datetime,

Injection_status varchar(12),
Final_Diagnosis_date datetime,
Final_Diagnosis varchar(20)
)
insert into Diagnosis_Form values('D001','R001','2011/3/6','Albert','James','Mal
e','59','Colonoscopy','Friday','2011/4/17','Injection Taken','2011/3/21','Coloni
c polyps')
insert into Diagnosis_Form values('D002','R002','2011/6/15','Victoria','Song','F
emale','44','ECG ','Tuesday','2011/6/26','Injection not taken','2011/6/31','Acqu
ired heart disease(Myocarditis)')
insert into Diagnosis_Form values('D003','R003','2011/2/12','Md. Ali Abdul','Raz
ak','Male','35','Stool,Bloo,X-Ray and Sonography','Saturday','2011/2/29','Inject
ion taken''2011/3/3','Mumps')
select * from Diagnosis_Form
create table Medicine_Form
(
Medicine_Number varchar(11)constraint PK4 primary key,
Diagnosis_number varchar(14)references Diagnosis_Form(Diagnosis_number),
Registration_No varchar(10) references Patient_Entry(Registration_No),
Medicine_Name varchar(22),
Precaution varchar(19),
Dosage_of_the_medicine varchar(15)
)
insert into Medicine_Form values('M11','D001','R001','NULL','consume Vegetables
and fruits,Folic Acid,calcium,fiber','1 tablet after meal')
insert into Medicine_Form values('M12','D002','R002','Sorbitrate','Medication to
control blood pressure and body fluids (diuretics),Intravenous immunoglobulin o
r purified antibodies, to reduce inflammation ,Bed rest and avoiding strenuous p
hysical activity','1 tablet everyday if necessary')
insert into Medicine_Form values('M13','D003','R003','Acetaminophen or ibuprofen
','MMR immunization (vaccine)','NULL')
select * from Medicine_Form
create table Patient_Receipt_Entry
(
Receipt_No varchar(11)constraint PK68 primary key,
Registration_No varchar(10) references Patient_Entry(Registration_No),
Receipt_Date datetime,
First_name varchar(17),
Last_name varchar(20),
Age varchar(14),
Gender varchar(17),
Diagnosis_Fees varchar(30),
X_Ray_Fees varchar(15),
ECG_Fees varchar(31),
Lab_Test_Fees varchar(20),
Gastroscopy_Fees varchar(88),
Indoor_injection_Fees varchar(18),
Total_Room_Cost varchar(50),
Sonography_Fees varchar(22),
Colonoscopy_Fees varchar(20),
Total_Fees_in_Figure varchar(45),
Total_Fees_in_Words varchar(30)
)
insert into Patient_Receipt_Entry values('R1','R001','2011/11/13','Albert','Jame

s','59','Male','1000 GBP','3999 GBP','7999 GBP','4002 GBP','5684 GBP','8032 GBP'


,'1015 GBP','3873 GBP','2012 GBP','37616 GBP','Thirty thousand six hundred sixte
en GREAT BRITAIN POUND')
insert into Patient_Receipt_Entry values('R2','R002','2011/12/2','Victoria','Son
g','44','Female','3240 GBP','252 GBP','819 GBP','469 GBP','950 GBP','102 GBP','7
89 GBP','890 GBP','911 GBP','8422 GBP','eight thousand four hundred twenty two G
REAT BRITAIN POUND')
insert into Patient_Receipt_Entry values('R3','R003','2011/2/11','Md. Ali Abdul'
,'Razak','35','Male','1000 GBP','3999 GBP','7999 GBP','4002 GBP','5684 GBP','803
2 GBP','1015 GBP','3873 GBP','2012 GBP','37616 GBP','Thirty thousand six hundred
sixteen GREAT BRITAIN POUND')
insert into Patient_Receipt_Entry values('R4','R004','2011/10/13','Sunil','roy',
'20','Male','3240 Rs','252 Rs','819 Rs','469 Rs','950 Rs','102 Rs','789 Rs','890
Rs','911 Rs','8422 Rs','eight thousand four hundred twenty two GRUPEES')
insert into Patient_Receipt_Entry values('R5','R005','2011/2/14','Miranda','Linc
oln','49','Female','1000 GBP','3999 GBP','7999 GBP','4002 GBP','5684 GBP','8032
GBP','1015 GBP','3873 GBP','2012 GBP','37616 GBP','Thirty thousand six hundred s
ixteen GREAT BRITAIN POUND')
insert into Patient_Receipt_Entry values('R6','R006','2011/3/16','Priyanka','Sha
rma','20','3240 Rs','252 Rs','819 Rs','469 Rs','950 Rs','102 Rs','789 Rs','890 R
s','911 Rs','8422 Rs','eight thousand four hundred twenty two GRUPEES')
select * from Patient_Receipt_Entry
create table Patient_Receipt_Query
(
Registration_No varchar(10) references Patient_Entry(Registration_No),
Receipt_Date datetime,
Total_Fees_in_Figure varchar(45),
Diagnosis_Fees varchar(30),
Total_Fees_in_Words varchar(30),
Room_Fees varchar(15),
First_name varchar(17),
Last_name varchar(20),
Age varchar(14),
Gender varchar(17),
Address varchar(30)
)
insert into Patient_Receipt_Query values('R001','2011/11/13','37616 GBP','1000
GBP','thirty thousand six hundred and sixteen','1015 GBP','Albert','James','59',
'Male','London')
insert into Patient_Receipt_Query values('R002','2011/12/2','8422 GBP','3240 GB
P','eight thousand four hundred twenty two','789 GBP','Victoria','Song','44','Fe
male','Alexandria')
select * from Patient_Receipt_Query
create table Test_Report
(
Test_no varchar(12)constraint PK90 primary key
Registration_No varchar(10)references Patient_Entry(Registration_No)
First_name varchar(18)
Last_name varchar(21)
Age varchar(10)
Gender varchar(7)
Address varchar(20)
Test_Date datetime
Test_Name varchar(17)

insert into Test_Report values('T001','R001','Albert','James','59','Male','Londo


n','2011/2/23','Colonoscopy'),
insert into Test_Report values('T002','R002','Victoria','Song','44','Female','Al
exandria','2011/6/5','X-Ray and ECG'),
insert into Test_Report values('T003','R003','Md. Ali Abdul', 'Razak','Male','Sh
eikh Zayed Road,Dubai,U.A.E.','2011/2/16','Blood')
select * from Test_Report

create table Doctor_Registration


(
Doctor_Id varchar(10)constraint PK8 primary key,
Doctor_Name varchar(18),
Date_of_Birth datetime,
Department varchar(20),
Gender varchar(7),
Education varchar(12),
Salary int(20),
Telephone_no varchar(20),
Mobile_no varchar(20),
Email_id varchar(17)
)
insert into Doctor_Registration values('D001','Sushil Sen','1975/6/21','Gastroen
terology','male',
'Doctor of osteopathic medicine','56423Rs','4568716123','446554','sen_sushil@yma
il.com'),
insert into Doctor_Registration values('D002','Jagdish Mitra','1969/3/10','ENT',
'male',
'M.D','97230Rs','01123798235','9864267015','jagmit@ymail.com'),
insert into Doctor_Registration values('D003','Ranjeema Nair','1980/4/6','Haemat
ology','female',
'M.D','23897Rs','02268716123','9864314307','ranjeemanr@ymail.com')
insert into Doctor_Registration values('D004','Mansi Goswami','1991/12/3','Nephr
ology','female',
'Doctor of osteopathic medicine','102356Rs','0226871897','988933149','goswamiman
si@refiffmail.com')
insert into Doctor_Registration values('D005','Preity Singh','1991/12/31','Nephr
ology','female',
'Doctor of osteopathic medicine','251111Rs','3612341539','9854616686','preity_si
ngh@refiffmail.com')
select * from Doctor_Registration

references Accumulated_Receipt(Room_No)

sss