药品信息数据表
用药信息数据表
手术信息数据表
床位使用信息数据表
第四章数据库的实现
4.1数据库的创建
create database 医院管理系统
4.2基本表的创建
--建数据库表
create database 住院部数据库系统 use 住院部数据库系统 go
create table 医护人员(
工号char(5) primary key, 姓名char(20) not null,
性别char(2) check(性别='男' or 性别='女'), 年龄int check(年龄>0), 毕业学校char(20) ) go
create table 医生(
工号char(5) primary key, 科室char(15) not null, 主治char(20) )
alter table 医生
add constraint 医生外键foreign key(工号) references 医护人员(工号) create table 护士(
工号char(5) primary key, 专业方向char(20)
)
create table 病人(
病人号char(5)primary key, 姓名char(15) not null,
性别char(2)check(性别='男' or 性别='女'), 年龄int check(年龄>0),
主治医生编号char(5) foreign key(主治医生编号) references 医生(工号) )
create table 药品(
药品号char(5) primary key,--int identity(1,1),可以制作流水单号 药品名称char(20) not null, 整量单位char(5), 散量单位char(5), 散整比 int, 使用说明char(40), 价格money check(价格>0) )
--alter table 药品
--alter column 使用说明char(40) create table 病历(
病历号char(5) primary key, 诊断结果信息char(40) )
create table 处方(
处方号char(5),
药品号char(5) foreign key references 药品(药品号), )
create table 体检( 体检号char(5) , 体检项目char(20) , 价格money check(价格>0),
用法 char(20), 数量 int,
primary key(处方号,药品号)
primary key(体检号,体检项目)
) *
alter table 体检
add constraint 体检主键 primary key (体检号,体检项目) alter table 体检
alter column 体检项目char(20) *
create table 诊断(
病人号char(5) foreign key references 病人(病人号), 医生号char(5) foreign key references 医生(工号), 病历号char(5) foreign key references 病历(病历号),
处方号char(5) , 体检号char(5) ,
诊断时间datetime,
primary key(病人号,医生号,诊断时间) )
*create table 设备(
设备类别char(5) primary key, 收费说明char(10),--(元次,元天,元ml) )*
create table 床位(
设备号char(5) primary key,
--(元天)
房间 char(10), 价格money
价格money check(价格>0) )
create table 床位占用(
占用编号char(5) primary key,
病人号char(5) foreign key references 病人(病人号), 设备号char(5) foreign key references 床位(设备号), 开始时间datetime, 结束时间datetime, )
create table 氧气瓶(
设备号char(5) primary key,
--(元ml)
价格money check(价格>0), 剩余量float check(剩余量>0) )
create table 氧气瓶占用(
病人号char(5) foreign key references 病人(病人号), 设备号char(5) foreign key references 氧气瓶(设备号), 开始时间datetime, 结束时间datetime,
使用量float check(使用量>0), primary key(病人号,设备号,开始时间) )
create table 手术台(
设备号char(5) primary key,
--(元次)
价格money check(价格>0) )
create table 手术(
病人号char(5) foreign key references 病人(病人号), 医生号char(5) foreign key references 医生(工号), 设备号char(5) , 开始时间datetime, 结束时间datetime
primary key(病人号,医生号,设备号,开始时间) )
create table 值班表(
护士号char(5)foreign key references 护士(工号), 床位号char(5)foreign key references 床位(设备号), 日期datetime,
属性char(10), --(上午班,下午班,晚班) primary key(护士号,床位号,日期,属性) )
create table 购买药品(
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库数据库原理及应用 - 毕业论文说明书(3)在线全文阅读。
相关推荐: