网站建设资讯

NEWS

网站建设资讯

教室预约java源代码 java教务系统源代码

java网上预约功能怎么实现啊。。

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

我们提供的服务有:成都网站设计、网站制作、外贸营销网站建设、微信公众号开发、网站优化、网站认证、水磨沟ssl等。为近1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的水磨沟网站制作公司

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:1433;databaseName=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 HashMapString, String hm = new HashMapString, 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 ArrayListGoodsBean getAllGoods()

051 {

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

053 ArrayListGoodsBean al = new ArrayListGoodsBean();

054 try {

055 //得到连接

056 ct = new ConnDB().getConn();

057

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

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

060 IteratorString 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 }

求一个基于Java编写的医院预约系统源码

摘    要

进入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 dictionary; then 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 system; database 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 registration; structural analysis; platform

目    录

摘    要... 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

java课程设计源代码(急!!!!)

import java.awt.Color;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.SwingConstants;

import javax.swing.border.LineBorder;

public class game21 extends JFrame {

private JLabel label_2;

private int number;

private int sum;

final JLabel label = new JLabel();

final JLabel label_1 = new JLabel();

public static void main(String[] args) {

new game21();

}

public game21() {

super("21点?!");

getContentPane().setLayout(null);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

final JButton button = new JButton();

button.addActionListener(new ActionListener() {

public void actionPerformed(final ActionEvent arg0) {

onClick();

}

});

button.setText("出牌");

button.setBounds(170, 350, 106, 28);

getContentPane().add(button);

label.setBorder(new LineBorder(Color.black, 1, false));

label.setHorizontalAlignment(SwingConstants.CENTER);

label.setFont(new Font("", Font.BOLD, 26));

label.setText("背面");

label.setBounds(158, 81, 137, 153);

getContentPane().add(label);

label_1.setText("你已经拥有的牌:");

label_1.setBounds(109, 22, 270, 45);

getContentPane().add(label_1);

this.setBounds(200, 300, 501, 528);

this.setVisible(true);

getContentPane().add(getLabel_2());

}

public int randNumber() {

try {

Thread.sleep(10);

} catch (InterruptedException e) {

e.printStackTrace();

}

return (int) (Math.random() * 10 + 1);

}

public void onClick() {

number = this.randNumber();

this.sum += number;

label.setText("" + number);

String strTemp = this.label_1.getText();

strTemp += "" + number + " ";

label_1.setText(strTemp);

String temp = "合计:" + sum;

label_2.setText(temp);

isWin();

}

public void isWin() {

if (sum 21) {

JOptionPane.showMessageDialog(this, "你输了");

clear();

return;

} else if (sum == 21) {

JOptionPane.showMessageDialog(this, "你赢了");

clear();

return;

} else {

int i = JOptionPane.showOptionDialog(this, "是否继续?", "提示",

JOptionPane.OK_CANCEL_OPTION,

JOptionPane.INFORMATION_MESSAGE, null, null, null);

if (i == JOptionPane.OK_OPTION) {

onClick();

} else

return;

}

}

private void clear() {

label_2.setText("合计:");

sum = 0;

number = 0;

label_1.setText("你已经拥有的牌:");

}

/**

* @return

*/

protected JLabel getLabel_2() {

if (label_2 == null) {

label_2 = new JLabel();

label_2.setText("合计:");

label_2.setBounds(313, 35, 66, 18);

}

return label_2;

}

}

真好无聊中。。

急求java学生信息管理系统源代码,带有连接数据库的,万分感谢

import java.awt.BorderLayout;

import java.awt.CardLayout;

import java.awt.Container;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.Icon;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JMenu;

import javax.swing.JMenuBar;

import javax.swing.JMenuItem;

import javax.swing.JPanel;

import javax.swing.JToolBar;

import javax.swing.SwingConstants;

public class MainFrame extends JFrame implements ActionListener{

InsertPanel ip = null;

SelectPanel sp = null;

JPanel pframe;

JButton jb1,jb2,jb3;

JMenuItem jm11,jm21,jm22,jm23,jm31,jm32,jm41,jm42;

CardLayout clayout;

public MainFrame(String s){

super(s);

JMenuBar mb = new JMenuBar();

this.setJMenuBar(mb);

JMenu m1 = new JMenu("系统");

JMenu m2 = new JMenu("基本信息");

JMenu m3 = new JMenu("成绩");

JMenu m4 = new JMenu("奖惩");

mb.add(m1);

mb.add(m2);

mb.add(m3);

mb.add(m4);

jm11 = new JMenuItem("退出系统");

jm21 = new JMenuItem("输入");

jm22 = new JMenuItem("查询");

jm23 = new JMenuItem("更改");

jm31 = new JMenuItem("输入成绩");

jm32 = new JMenuItem("查询成绩");

jm41 = new JMenuItem("奖励");

jm42 = new JMenuItem("处分");

m1.add(jm11);

m2.add(jm21);

m2.add(jm22);

m2.add(jm23);

m3.add(jm31);

m3.add(jm32);

m4.add(jm41);

m4.add(jm42);

Icon i1 = new ImageIcon();

Icon i2 = new ImageIcon();

Icon i3 = new ImageIcon();

jb1 = new JButton(i1);

jb1.setToolTipText("输入");

jb2 = new JButton(i2);

jb2.setToolTipText("查询");

jb3 = new JButton(i3);

jb3.setToolTipText("退出");

JToolBar tb = new JToolBar("系统工具");

tb.add(jb1);

tb.add(jb2);

tb.add(jb3);

add(tb,BorderLayout.NORTH);

jm11.addActionListener(this);

jm21.addActionListener(this);

jm22.addActionListener(this);

jb1.addActionListener(this);

jb2.addActionListener(this);

jb3.addActionListener(this);

clayout = new CardLayout();

pframe = new JPanel(clayout);

add(pframe);

JPanel mainp = new JPanel(new BorderLayout());

JLabel mainl = new JLabel("学生信息管理平台",SwingConstants.CENTER);

mainl.setFont(new Font("serif",Font.BOLD,30));

mainp.add(mainl);

pframe.add(mainp,"main");

clayout.show(pframe, "main");

}

public void actionPerformed(ActionEvent e){

if(e.getSource() == jm21 || e.getSource() == jb1){

if(ip == null){

ip= new InsertPanel();

pframe.add(ip,"insert");

}

clayout.show(pframe, "insert");

this.setTitle("输入学生信息");

}

else if(e.getSource() == jm22 || e.getSource() == jb2){

if(sp == null){

sp= new SelectPanel();

pframe.add(sp,"select");

}

clayout.show(pframe, "select");

this.setTitle("查询学生信息");

}

else if(e.getSource() == jm11 || e.getSource() == jb3){

System.exit(0);

}

}

}

第二个:

import javax.swing.JFrame;

public class MainTest {

public static void main(String [] args){

MainFrame f = new MainFrame("学生信息管理平台");

f.setSize(400,300);

f.setLocation(350,250);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setVisible(true);

}

}

第二个:

import java.sql.Connection;

import java.sql.DriverManager;

public class MySQLConnection {

static Connection getCon(){

Connection con = null;

try{

Class.forName("com.mysql.jdbc.Driver");

con = DriverManager.getConnection("jdbc:mysql://localhost/test","root","123");

}

catch(Exception e){

System.out.println("建立数据库连接遇到异常!");

}

return con;

}

}

第四个:

import java.awt.BorderLayout;

import java.awt.GridLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JTextField;

import javax.swing.SwingConstants;

public class SelectPanel extends JPanel implements ActionListener{

JButton jb;

JTextField jt;

JTextField jt1,jt2,jt3,jt4;

public SelectPanel(){

JLabel jl = new JLabel("请输入学号:",SwingConstants.CENTER);

jt = new JTextField();

jb = new JButton("确定");

JPanel jp1 = new JPanel(new GridLayout(1,3));

jp1.add(jl);

jp1.add(jt);

jp1.add(jb);

JLabel j1,j2,j3,j4;

j1 = new JLabel("学号:",SwingConstants.CENTER);

j2 = new JLabel("姓名:",SwingConstants.CENTER);

j3 = new JLabel("性别:",SwingConstants.CENTER);

j4 = new JLabel("年龄:",SwingConstants.CENTER);

jt1 = new JTextField(6);

jt1.setEditable(false);

jt2 = new JTextField(6);

jt2.setEditable(false);

jt3 = new JTextField(6);

jt3.setEditable(false);

jt4 = new JTextField(6);

jt4.setEditable(false);

JPanel jp2 = new JPanel(new BorderLayout());

JPanel jp3 = new JPanel(new GridLayout(4,2));

jp2.add(new JLabel(""),BorderLayout.NORTH);

jp3.add(j1);

jp3.add(jt1);

jp3.add(j2);

jp3.add(jt2);

jp3.add(j3);

jp3.add(jt3);

jp3.add(j4);

jp3.add(jt4);

jp2.add(jp3);

this.setLayout(new BorderLayout());

add(jp1,BorderLayout.NORTH);

add(jp2);

jb.addActionListener(this);

}

public void actionPerformed(ActionEvent e){

if(e.getSource() == jb){

String stuNo = jt.getText().trim();

Student s = new Student();

boolean b = true;

try{

b = s.selectByStuNo(stuNo);

}

catch(Exception ex){

System.out.println("查询学生信息遇到异常!");

}

if(b){

jt1.setText(s.getStuNo());

jt2.setText(s.getName());

jt3.setText(s.getGender());

int a = s.getAge();

Integer i = new Integer(a);

jt4.setText(i.toString());

}

else{

JOptionPane.showMessageDialog(null, "无此学生!");

}

}

}

}

第五个:

import javax.swing.JFrame;

public class SelectTest {

public static void main(String [] args){

JFrame f = new JFrame("查询学生信息");

SelectPanel p = new SelectPanel();

f.add(p);

f.setSize(400,300);

f.setLocation(300,250);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setVisible(true);

}

}

第六个:

import java.sql.Connection;

import java.sql.ResultSet;

import java.sql.Statement;

public class Student {

String stuNo;

String name;

String gender;

int age;

public Student(){}

public Student(String stuNo,String name,String gender, int age){

this.stuNo = stuNo;

this.name = name;

this.gender = gender;

this.age = age;

}

public String getStuNo(){

return stuNo;

}

public void setStuNo(String stuNo){

this.stuNo = stuNo;

}

public String getName(){

return name;

}

public void setName(String name){

this.name = name;

}

public String getGender(){

return gender;

}

public void setGender(String gender){

this.gender = gender;

}

public int getAge(){

return age;

}

public void setAge(int age){

this.age = age;

}

public boolean insertStudent(){

boolean b = true;

try{

Connection con = MySQLConnection.getCon();

Statement statement = con.createStatement();

String sql = "insert into student values('" + stuNo + "','" + name +"','" + gender + "'," + age + ")";

sql = new String(sql.getBytes("gb2312"),"ISO8859_1");

statement.executeUpdate(sql);

con.close();

}

catch(Exception e){

b = false;

System.out.println("插入数据库遇到异常!");

}

return b;

}

public boolean selectByStuNo(String stuNo)throws Exception{

boolean b = true;

Connection con = MySQLConnection.getCon();

Statement statement = con.createStatement();

String sql = "select * from student where stuNo =" + stuNo;

ResultSet rs = statement.executeQuery(sql);

if(rs != null rs.next()){

String no = rs.getString(1);

this.setStuNo(no);

String n = rs.getString(2);

n = new String(n.getBytes("ISO8859_1"),"gb2312");

this.setName(n);

String g = rs.getString(3);

g = new String (g.getBytes("ISO8859_1"),"gb2312");

this.setGender(g);

this.setAge(rs.getInt(4));

b = true;

}

rs.close();

statement.close();

con.close();

return b;

}

}

数据库你自己弄吧,我没时间弄了!初学得多动手哦


当前名称:教室预约java源代码 java教务系统源代码
文章来源:http://cdweb.net/article/ddodsje.html