java mysql 预约系统

Python010

java mysql 预约系统,第1张

很明显,这是一个从属关系的双表结构。

第一个问题,很好解决,做一个任务定时器,每天晚上12点根据预约表更新房间表状态,当天预约的房间直接更改房间表。

第二个,好像没什么问题,你查询的时候是要根据时间查询的,如果是今天要预约就查房间表,如果是未来,就查预约表,我不知道你的问题在哪个地方

第三个,把房间价格直接作为常量定义到数据库,最后再加一个字段即总价,每次客人开房开始计时,每天12点把总价加上房间价格再赋值给总价,客人退房的时候房间总价清零。

摘    要

进入21世纪以来,网络的空前发展给人们的工作和生活带来了极大的便利,信息化建设已经成为节约运营成本、提高工作效率的首选。相比之下,国内相当数量的中小医院的医院预约挂号工作还采用相对保守的手工工作方式,数据信息查询和存储的成本较高,但效率却很低下。为了使医院预约挂号管理更高效、更科学,决定开发医院预约挂号平台。

本文采用结构化分析的方法,详细阐述了一个功能比较强大的医院预约挂号平台的前后台开发、操作流程和涉及的一些关键技术。首先进行了可行性分析,然后是系统分析,通过实际的业务流程调研,分析业务流程和系统的组织结构,完成了数据流分析和数据字典;然后是系统设计阶段主要完成了功能模块的划分、阐述了系统设计的思想、数据库的设计和系统设计的工具及技术。该阶段对本系统各个模块的功能进行了详细设计,形成了本系统的功能模块图;数据库设计时先进行了概念结构设计,然后进行了逻辑结构设计,最后完成了数据表的设计。

根据前几个阶段的分析和设计,本系统在设计方面采用B/S模式,同时使用JSP技术进行基本页面的设计与功能实现,后台数据库选用SQL Server 2000数据库。本系统的设计实施为医院预约挂号系统的运行做基础,为医院预约挂号管理工作提供良好的条件。

关键词:预约挂号;结构化分析;平台

Abstract

In the 21st century, the unprecedented development of the network to the people's work and life has brought great convenience, information technology has become operational cost savings, improve efficiency of choice. In contrast, a considerable number of domestic small and medium hospitals, hospital appointment registration work is relatively conservative with manual work, data query and the high cost of storage, but the efficiency is very low. To make an appointment by registered hospital management more efficient, more science, decided to develop the hospital appointment registration platform.

In this paper, structural analysis, a function described in detail more powerful platform for the hospital before and after the appointment register sets and development, operational processes, and some of the key technologies involved. First, a feasibility analysis, and system analysis, business process through the actual research, analyze business processes and organizational structure of the system to complete the data flow analysis and data dictionarythen completed the system design phase is mainly divided into functional modules, elaborated the idea of the system design, database design and system design tools and techniques. This phase of the system function of each module in detail the design, forming a functional block diagram of the systemdatabase design first tested the concept design, followed by a logic design, and finally completed the data table design.

According to the first few stages of the analysis and design, the system used in the design of B / S mode, JSP technology, the basic page design and implementation of function, use SQL Server 2000 database backend database. Implementation of the system design registration system for the operation of the hospital appointment as a foundation for the hospital management to provide a good appointment registration conditions.

Key Words:Appointment registrationstructural analysisplatform

目    录

摘    要... I

Abstract II

一、引言... 1

(一)项目开发的背景... 1

(二)项目开发的目的... 1

二、可行性分析及总体设计原则... 2

(一)可行性分析... 2

1.技术可行性... 2

2.经济可行性... 2

3.社会可行性... 3

(二)总体设计原则... 3

三、系统分析... 5

(一)业务流程分析... 5

(二)数据流图... 6

(三)数据字典... 9

四、系统设计... 13

(一)系统功能设计... 13

(二)系统数据库设计... 14

1.概念结构设计... 14

2.逻辑结构设计... 18

3.数据库表设计... 18

(三)系统开发工具与开发模式的选择... 20

1.系统开发工具... 20

2.系统设计模式... 21

五、系统实现... 22

(一)用户模块... 22

1.登录及注册管理模块... 22

2.首界面... 23

3.用户注册界面... 24

4.公告界面... 25

5.科室预约界面... 26

6.留言界面... 27

(三)管理员模块... 28

1.登录界面... 28

2.科室管理界面... 28

3.添加专家界面... 29

六、性能测试与分析... 30

(一)测试的重要性... 30

(二)测试实例的研究与选择... 30

(三)测试环境与测试条件... 31

(四)实例测试... 32

(五)系统评价... 32

(六)测试结果... 33

参 考 文 献... 35

致    谢... 36

物车的逻辑业务的实现(MyCartBO.java),能够满足用户的添加,删除,修改,清空,查看购物车的信息!

ConnDB.java(这只是一个得到数据库连接和类)

01 //连接数据库

02 package cn.fqfx.model

03

04 import java.sql.*

05

06 public class ConnDB

07 {

08 //定义一个连接

09 private Connection ct = null

10

11 //得到连接

12 public Connection getConn()

13 {

14 try {

15 //加载驱动

16 Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver")

17 //得到连接

18 ct = DriverManager.getConnection

19 ("jdbc:microsoft:sqlserver://localhost:1433databaseName=whdb2","sa","sa")

20 } catch (Exception e) {

21 e.printStackTrace()

22 // TODO: handle exception

23 }

24 return ct

25 }

26 }

GoodsBean.java(这个文件主要用来保存从数据库的goods表中取得的信息)

01 //这是一个与Goods表对应的java bean

02 //表的信息可以保存在这里面

03 package cn.fqfx.model

04

05 public class GoodsBean

06 {

07 //分别与goods表的各个字段相对应

08 private int goodsId = 0

09 private String goodsName = ""

10 private String goodsInfo = ""

11 private String goodsPlace = ""

12

13

14 public int getGoodsId() {

15 return goodsId

16 }

17 public void setGoodsId(int goodsId) {

18 this.goodsId = goodsId

19 }

20

21

22 public String getGoodsName() {

23 return goodsName

24 }

25 public void setGoodsName(String goodsName) {

26 this.goodsName = goodsName

27 }

28

29

30 public String getGoodsInfo() {

31 return goodsInfo

32 }

33 public void setGoodsInfo(String goodsInfo) {

34 this.goodsInfo = goodsInfo

35 }

36

37

38 public String getGoodsPlace() {

39 return goodsPlace

40 }

41 public void setGoodsPlace(String goodsPlace) {

42 this.goodsPlace = goodsPlace

43 }

44 }

MyCartBO.java(这个就是购物车,主要以HashMap实现存放用户想买的商品id,商品数量.然后,通过方法的调用把购物车中的信息返回到界面让用户看)

001 //这是一个业务对象,相当于一个购物车!!

002 //-->使用说明:这个购物车最好是在session中使用,因为一个用户一辆购物车,这样东西才不会一直丢

003 package cn.fqfx.model

004

005 import java.sql.*

006 import java.util.*

007

008 public class MyCartBO

009 {

010 //定义几个数据库的连接

011 private Connection ct = null

012 private PreparedStatement ps = null

013 private ResultSet rs = null

014

015 //定义一个HashMap充当购物车,第一个用来存放goodsId,值就是goods的数量

016 HashMap<String, String>hm = new HashMap<String, String>()

017

018 //当用户想购买的时候,就加入 购物车里面

019 public void addGoods(String goodsId, String goodsNumber)

020 {

021 hm.put(goodsId, goodsNumber)

022 }

023

024 //当用户不想要东西的时候,就把它删除

025 public void delGoods(String goodsId)

026 {

027 hm.remove(goodsId)

028 }

029

030 //当用户什么也不想要的时候,就清空它

031 public void clearGoods()

032 {

033 hm.clear()

034 }

035

036 //当用户想更换物品的数量的时候,就更新一下

037 public void upGoods(String goodsId, String newNumber)

038 {

039 //还是用加入物品的方法,因为会自动替换掉它,如果货物名字想换,那说明用户想删除了

040 hm.put(goodsId, newNumber)

041 }

042

043 //得到单个物品的数量,要用的话把它转成int型再使用

044 public String getGoodsNumberByGoodsId(String goodsId)

045 {

046 return hm.get(goodsId)

047 }

048

049 //把购物车的东西全部取出来,放入ArrayList里面

050 public ArrayList<GoodsBean>getAllGoods()

051 {

052 //要知道这个ArrayList是用来放GoodsBean,因为GoodsBean与表相对应,所以可以保存物品的信息

053 ArrayList<GoodsBean>al = new ArrayList<GoodsBean>()

054 try {

055 //得到连接

056 ct = new ConnDB().getConn()

057

058 //想一个sql语句,主要是取得goodsId,就可以全部取出来给外面的使用

059 String sql = "select * from goods where goodsId in ("

060 Iterator<String>it = hm.keySet().iterator()

061 while(it.hasNext())

062 {

063 //把goodsId取出来

064 String goodsId = it.next()

065 if(it.hasNext()){

066 sql += goodsId+","

067 }else{

068 sql += goodsId+")"

069 }

070 }

071

072 //创建ps,上面把sql语句组织好

073 ps = ct.prepareStatement(sql)

074

075 //执行

076 rs = ps.executeQuery()

077

078 //取出来,放在GoodsBean,再把GoodsBean一个个放入ArrayList中,显示的页面就可以调用了

079 while(rs.next())

080 {

081 GoodsBean gb = new GoodsBean()

082 gb.setGoodsId(rs.getInt(1))

083 gb.setGoodsName(rs.getString(2))

084 gb.setGoodsInfo(rs.getString(3))

085 gb.setGoodsPlace(rs.getString(4))

086

087 //把gb放入al,相当于保存了从数据库中获得的数据

088 al.add(gb)

089 }

090 } catch (Exception e) {

091 e.printStackTrace()

092 // TODO: handle exception

093 }finally{

094 this.closeDBResource()

095 }

096 return al

097 }

098

099 //关闭数据库资源

100 public void closeDBResource()

101 {

102 try {

103 if(rs != null){

104 rs.close()

105 rs = null

106 }

107 } catch (Exception e2) {

108 e2.printStackTrace()

109 // TODO: handle exception

110 }

111 try {

112 if(ps != null){

113 ps.close()

114 ps = null

115 }

116 } catch (Exception e2) {

117 e2.printStackTrace()

118 // TODO: handle exception

119 }

120 try {

121 if(ct != null){

122 ct.close()

123 ct= null

124 }

125 } catch (Exception e2) {

126 e2.printStackTrace()

127 // TODO: handle exception

128 }

129 }

130 }