藥品信息管理系統(tǒng) 課程設計_第1頁
藥品信息管理系統(tǒng) 課程設計_第2頁
藥品信息管理系統(tǒng) 課程設計_第3頁
藥品信息管理系統(tǒng) 課程設計_第4頁
藥品信息管理系統(tǒng) 課程設計_第5頁
已閱讀5頁,還剩30頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、遼 寧 科 技 大 學課程設計報告設計題目: 藥品信息管理系統(tǒng) 學院、系: 電信 專業(yè)班級: 計算機141班 學生姓名: 梁君瑋 指導教師: 劉揚 王莉 成 績: 2017年 12月 1日目錄1.概述41.1實驗目標41.2運行環(huán)境、工具及框架42需求分析42.1頂層流程42.2中層流程52.3底層流程52.3.1登錄系統(tǒng)52.3.2進藥操作62.3.3售藥操作62.3.4庫存管理72.3.5單據(jù)管理72.3.6外鍵:供應商管理(擴展功能)82.3.7外鍵:客戶管理(擴展功能)83概要設計93.1 E-R圖94總體設計94.1數(shù)據(jù)庫設計94.1.1使用PowerDesigner設計數(shù)據(jù)庫模型9

2、4.1.2生成建表語句104.2系統(tǒng)功能設計134.2.1使用Rational Rose設計系統(tǒng)用例圖134.2.2系統(tǒng)功能描述135應用程序的編程實現(xiàn)145.1建庫145.2設計網(wǎng)頁165.2.1前端目錄結構165.2.2舉例(進藥頁):175.3添加配置225.3.1邏輯架構225.3.2Hibernate配置事務及實體類235.4代碼目錄結構(MVC)245.5編寫后臺代碼(java)245.5.1實體類245.5.2數(shù)據(jù)持久層(hibernate)265.5.3服務層(使用Spring的Service注解)285.5.4控制層(SpringMVC)296測試和運行311. 概述1.1實

3、驗目標為了檢驗自己從大一到現(xiàn)在為止的學習收獲,運用所學軟件工程課程及數(shù)據(jù)庫課程所學習的理論知識同實踐相結合,建立工程化思想,使用面向?qū)ο笳Z言(java)開發(fā)一個小型MIS系統(tǒng),鍛煉自己解決實際問題的能力,為畢業(yè)設計打下良好的基礎。本次實驗從前端到后臺、從設計分析到實現(xiàn)并完成都是通過自己的慢慢積累并查閱相關框架資料(包括使用建模工具)完成,也算是一個微型的web全棧設計了。1.2運行環(huán)境、工具及框架本次設計的是基于jdk1.8的web項目,使用工具及運行環(huán)境如下:編程語言:java、HTML、css、js等后端框架:Spring+SpringMVC+Hibernate前端腳本:jQuery、js

4、tl、el、jsp等日志記錄:log4j、logging設計工具:Rational Rose、Microsoft Visio數(shù)據(jù)庫:MySQL5.7數(shù)據(jù)庫工具:PowerDesigner、navicatformysql編譯工具:eclipse、WebStorm服務器:tomcat測試系統(tǒng)環(huán)境:wind7、wind10、Linux(centOS7)2需求分析使用visio工具建立數(shù)據(jù)流圖(使用三層數(shù)據(jù)流圖):2.1頂層流程2.2中層流程2.3底層流程2.3.1登錄系統(tǒng)2.3.2進藥操作2.3.3售藥操作2.3.4庫存管理 2.3.5單據(jù)管理2.3.6外鍵:供應商管理(擴展功能)2.3.7外鍵:客

5、戶管理(擴展功能)3概要設計3.1 E-R圖4總體設計4.1數(shù)據(jù)庫設計4.1.1使用PowerDesigner設計數(shù)據(jù)庫模型4.1.2生成建表語句/*=*/* DBMS name: MySQL 5.0 */* Created on: 2017/12/7 20:19:35 */*=*/drop table if exists t_customer;drop table if exists t_enter;drop table if exists t_inventory;drop table if exists t_manufacturers;drop table if exists t_sell

6、;drop table if exists t_supplier;drop table if exists t_user;/*=*/* Table: t_customer */*=*/create table t_customer( c_id varchar(255) not null, c_name varchar(255), c_address varchar(255), c_postal varchar(255), c_phone varchar(255), c_poxy varchar(255), primary key (c_id);/*=*/* Table: t_enter */*

7、=*/create table t_enter( document_number varchar(255) not null, medicine_id varchar(255), procurement_price double(10,2), procurement_number int(10), procurement_date varchar(255), specification varchar(255), m_id varchar(255), s_id varchar(255), primary key (document_number);/*=*/* Table: t_invento

8、ry */*=*/create table t_inventory( medicine_id varchar(255) not null, medicine_name varchar(255), inventory_number int(10), specification varchar(255), retail_price double(10,2), m_id varchar(255), primary key (medicine_id);/*=*/* Table: t_manufacturers */*=*/create table t_manufacturers( m_id varch

9、ar(255) not null, m_name varchar(255) not null, m_address varchar(255), m_postal varchar(255), m_phone varchar(255), m_fax varchar(255), primary key (m_id);/*=*/* Table: t_sell */*=*/create table t_sell( document_number int(10) not null, medicine_id varchar(255), c_id varchar(255), sell_number int(1

10、0), sell_date date, unit_price double(10,2), primary key (document_number);/*=*/* Table: t_supplier */*=*/create table t_supplier( s_id varchar(255) not null, s_name varchar(255) not null, s_address varchar(255), s_postal varchar(255), s_fax varchar(255), s_phone varchar(255), primary key (s_id);/*=

11、*/* Table: t_user */*=*/create table t_user( login_id varchar(255) not null, password varchar(255) not null, username varchar(255), primary key (login_id);alter table t_enter add constraint FK_Reference_1 foreign key (medicine_id) references t_inventory (medicine_id) on delete restrict on update res

12、trict;alter table t_enter add constraint FK_Reference_3 foreign key (m_id) references t_manufacturers (m_id) on delete restrict on update restrict;alter table t_enter add constraint FK_Reference_4 foreign key (s_id) references t_supplier (s_id) on delete restrict on update restrict;alter table t_inv

13、entory add constraint FK_Reference_5 foreign key (m_id) references t_manufacturers (m_id) on delete restrict on update restrict;alter table t_sell add constraint FK_Reference_2 foreign key (medicine_id) references t_inventory (medicine_id) on delete restrict on update restrict;alter table t_sell add

14、 constraint FK_Reference_7 foreign key (c_id) references t_customer (c_id) on delete restrict on update restrict;4.2系統(tǒng)功能設計4.2.1使用Rational Rose設計系統(tǒng)用例圖4.2.2系統(tǒng)功能描述實現(xiàn)基本功能:藥品數(shù)據(jù)庫進藥表(單據(jù)號,藥品編碼,采購價,采購數(shù)量,采購日期,供應商)售藥表(顧客號,藥品編碼,銷售數(shù)量,銷售日期,單價)庫存表(藥品編碼,藥品名稱,庫存量,生產(chǎn)廠家,規(guī)格,零售價)單據(jù)號:編程自動生成(從1開始,每次加1)。顧客號:編程自動生成(從1開始,每次加

15、1)。進藥:當進新藥(第一次進此藥)時,用戶需要輸入(藥品編碼,藥品名稱,采購價,采購數(shù)量,采購日期,供應商,生產(chǎn)廠家,規(guī)格,零售價)當進的藥品是已經(jīng)進過的藥品時,用戶輸入完藥品代碼時,窗體的文本框中將自動顯示藥品名稱,生產(chǎn)廠家,規(guī)格,零售價,用戶只需要輸入采購價,采購數(shù)量,采購日期,供應商。售藥:只需要用戶輸入藥品編碼,銷售數(shù)量;單價,藥品名稱將自動顯示,日期調(diào)用系統(tǒng)當前日期。一次售藥可以銷售多種藥品,最后一起結帳。顯示應收藥款,實收金額,找零。庫存查詢:按藥品代碼,藥品名稱查詢。進藥查詢:按藥品代碼,藥品名稱,采購日期查詢。售藥查詢:按藥品代碼,藥品名稱、銷售日期查詢。5應用程序的編程實現(xiàn)

16、5.1建庫在navicatformysql中運行sql腳本:生成數(shù)據(jù)庫如下:庫存表:售藥表(其他表不一一列舉出來了):5.2設計網(wǎng)頁編碼采用utf-8、使用css文件保持頁面風格統(tǒng)一。5.2.1前端目錄結構5.2.2舉例(進藥頁):主菜單和頂部代碼:<% page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><% taglib uri=" prefix="c"%><%

17、String path = request.getScheme() + ":/" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/"%><!DOCTYPE html><html><head><base href="<%=path%>"><meta charset="UTF-8"><ti

18、tle>藥品信息管理系統(tǒng)</title><link rel="stylesheet" href="style/drp.css"><script src="jquery/jquery-1.11.1.js"></script><style type="text/css">body margin-top: 0;margin-left: 0;ul li list-style: none;acolor:black;</style><scrip

19、t type="text/javascript">$(function() window.open("main/enter/index.jsp", "workFrame"););function show(where) window.open("main/"+where + "/index.jsp", "workFrame");</script></head><body class="body1"><div

20、id="head" style="background-color: #000000; color: #ffffff; padding: 10px; font-size: 17px; font-family: 宋體"><span style="font-size: 40px; font-family: '華文行楷'">藥品信息管理系統(tǒng)</span>一一梁君瑋<div style="float: right; right: 100px;"><br>

21、用戶:<c:if test="$!empty username ">$username</c:if><c:if test="$empty username ">未登錄</c:if>&nbsp;<a href="javascript:;">注銷</a></div></div><div id="menu" style="float: left; width: 10%;"><br&

22、gt;<ul><li><br><a href="javascript:;" onclick="show('enter')">進藥</a></li><li><br><a href="javascript:;" onclick="show('enter')">售藥</a></li><li><br><a href="ja

23、vascript:;" onclick="show('inventory')">庫存查詢</a></li><li><br><a href="javascript:;" onclick="show('enterlist')">進藥查詢</a></li><li><br><a href="javascript:;" onclick="show('

24、;enterlist')">售藥查詢</a></li><li><br><a href="javascript:;" onclick="show('supplier')">供應商</a></li><li><br><a href="javascript:;" onclick="show('supplier')">客戶</a></

25、li></ul></div><div style="float: left; background-color: #000000; width: 1px; height: 570px; left: 200px;"></div><div style="float: left; width: 88%; height: 570px"><iframe style="border-width: 0px; width: 100%; height: 100%;" name=&q

26、uot;workFrame"></iframe></div></body></html>進藥頁面代碼:<% page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><% taglib uri=" prefix="c" %><%String path=request.getScheme()+":/&

27、quot;+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"%><!DOCTYPE html><html><head><base href="<%=path %>"><meta charset="UTF-8"><title>進藥</title><link rel="stylesheet&q

28、uot; href="style/drp.css" type="text/css"><link href="style/JSCalendar.css" rel="stylesheet" type="text/css"><link href="jquery/css/ljw.css" rel="stylesheet" type="text/css"><script src="script/JSC

29、alendar.js"></script><script src="script/client_validate.js"></script><script type="text/javascript">function selectMedicine(index) window.open('main/enter/choose_medicine.jsp', '請選擇藥品','width=800, height=410, scrollbars=no'

30、);var rowIndex = 0;function addOneLineOnClick() var row = tblFlowCardDetail.insertRow(tblFlowCardDetail.rows.length);var col = row.insertCell(0);col.innerHTML = "<input readonly name='eid' size='10'/><input type='button' value ='.' name='selectMedici

31、neBtn' index=""+ rowIndex + "" onclick="selectMedicine(this.index)">"col = row.insertCell(1);col.innerHTML = "<tr><input name='ename' size='12'/>"col = row.insertCell(2);col.innerHTML = "<input name='eprice&#

32、39; size='8'/>"col = row.insertCell(3);col.innerHTML = "<input name='enumber' size='8'/>"col = row.insertCell(4);col.innerHTML = "<input name='edata' size='11'/>"col = row.insertCell(5);col.innerHTML = "<input na

33、me='production' size='11'/>"col = row.insertCell(6);col.innerHTML = "<input name='norms' size='11'/>"col = row.insertCell(7);col.innerHTML = "<input name='retail' size='8'/>"col = row.insertCell(8);col.innerHTML

34、= "<input type='button' value='刪除' id='deleteEnterBtn' onclick="return DeleteRow('row"+ rowIndex + "')"></tr>"row.setAttribute("id", "row" + rowIndex);row.setAttribute("name", "row" + ro

35、wIndex);rowIndex+;function DeleteRow(rowTag) var i = tblFlowCardDetail.rowsrowTag.rowIndex;var j;for (j = i; j <= rowIndex; j+) tblFlowCardDetail.rowsj.cells0.childNodes1.index-; tblFlowCardDetail.deleteRow(i);rowIndex-;</script></head><body class="body1"><div align

36、="center"><form name="checkVoucherForm" id="checkVoucherForm"><table class="table_nbsp"><tr><td>&nbsp;</td></tr></table><table class="table_title"><tr><td width="522" class=&qu

37、ot;p1" height="2" nowrap><imgsrc="images/mark_arrow_03.gif" width="14" height="14">&nbsp; <b>分銷商庫存管理&gt;&gt;盤點結果維護&gt;&gt;添加</b></td></tr></table><hr width="97%" align="center&qu

38、ot; size=0><table class="table_top"><tr><td width="15%" height="29"><div align="right"><font color="#FF0000">*</font>供應商代碼:&nbsp;</div></td><td width="20%"><input name="cl

39、ientId" type="text"class="text1" id="clientId4" size="10" maxlength="10"readonly> <input name="btnSelectClient"type="button" id="btnSelectClient" value="." class="button1"onClick="wind

40、ow.open('main/enter/choose_supplier.jsp', '選擇分銷商', 'width=800, height=400, scrollbars=no')"></td><td width="12%"><div align="right">供應商名稱:&nbsp;</div></td><td width="53%"><input name="client

41、Name" type="text"class="text1" id="clientName" size="10" maxlength="10"readonly></td></tr></table><hr width="97%" align="center" size=0><table name="tblFlowCardDetail" id="tblFlowC

42、ardDetail" class="table_main"><tr bordercolor="#FFFFFF" bgcolor="#FFFFFF"><td><div align="left"><span color="#FF0000">*</span>藥品編碼</div></td><td><div align="left">藥品名稱</div>

43、;</td><td>采購價</td><td>采購數(shù)量</td><td>采購日期</td><td>生產(chǎn)廠家</td><td>規(guī)格</td><td>零售價</td><td><div align="left">刪除</div></td></tr></table><p><input name="btnAddLine" t

44、ype="button" id="btnAddLine"onClick="return addOneLineOnClick()" value="加入一行"> <input name="btnSave" type="button" id="saveBtn" value="確認進藥"> </p><p>&nbsp;</p><p>&nbsp;</p>&

45、lt;/form><p>&nbsp;</p></div></body></html>頁面如下:5.3添加配置5.3.1邏輯架構分層MVC(view-controller-service-dao-VO-db)框架使用的是SSH(Spring+SpringMVC+Hibernate)使用Spring集成SpringMVC和Hibernate,使用配置文件的方式:5.3.2Hibernate配置事務及實體類數(shù)據(jù)源連接池使用c3p0:5.4代碼目錄結構(MVC)5.5編寫后臺代碼(java)5.5.1實體類使用hibernate

46、和jdk自帶的注解建立實體類例(進藥實體類):package com.ljw.medicine.beans;import javax.persistence.CascadeType;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.Id;import javax.persistence.ManyToOne;import javax.persistence.Table;import org.hibernate.annotations.GenericGen

47、erator;/* * ClassName:Enter * <p>company:</p> * <p>Description:進藥實體類</p> * date 2017年11月30日 下午7:12:28 * author 梁君瑋 */EntityTablepublic class Enter IdGeneratedValue(generator="xxx")GenericGenerator(name="xxx",strategy="native")private Integer docu

48、ment_id;/單據(jù)號ManyToOne(targetEntity=Inventory.class,cascade=CascadeType.ALL)private Inventory inventory;/藥品private double procurement_price;/采購價private int procurement_number;/采購數(shù)量private String procurement_date;/采購日期ManyToOne(targetEntity=Supplier.class,cascade=CascadeType.ALL)private Supplier suppl

49、ier;/供應商public Integer getDocument_number() return document_id;public void setDocument_number(Integer document_id) this.document_id = document_id;public Inventory getInventory() return inventory;public void setInventory(Inventory inventory) this.inventory = inventory;public double getProcurement_pri

50、ce() return procurement_price;public void setProcurement_price(double procurement_price) curement_price = procurement_price;public int getProcurement_number() return procurement_number;public void setProcurement_number(int procurement_number) curement_number = procurement_number;publ

51、ic String getProcurement_date() return procurement_date;public void setProcurement_date(String procurement_date) curement_date = procurement_date;public Supplier getSupplier() return supplier;public void setSupplier(Supplier supplier) this.supplier = supplier;5.5.2數(shù)據(jù)持久層(hibernate)例(進藥):packa

52、ge com.ljw.medicine.dao.impl;import java.util.List;import java.util.Map;import org.hibernate.SessionFactory;import org.hibernate.query.Query;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Repository;import com.ljw.medicine.beans.Enter;import com.l

53、jw.medicine.dao.EnterDao;/* * ClassName:EnterDaoImpl * <p>company:</p> * <p>Description:進藥信息持久層實現(xiàn)類</p> * date 2017年11月30日 下午7:22:32 * author 梁君瑋 */Repositorypublic class EnterDaoImpl implements EnterDao Autowiredpublic final void setSessionFactory(SessionFactory sessionFactor

54、y) this.sessionFactory = sessionFactory; private SessionFactory sessionFactory;/* * 批量保存創(chuàng)建的進藥信息 */Overridepublic void saveCreateEnter(List<Enter> enterList) sessionFactory.getCurrentSession().save(enterList);/* * 根據(jù)條件分頁查詢進藥信息列表 */Overridepublic List<Enter> queryEnterForPageByCondition(Ma

55、p<String, Object> map) Enter enter = (Enter) map.get("enter");Integer skipNumber = (Integer) map.get("skipNumber");Integer pageSize = (Integer) map.get("pageSize");String hql = "from Enter where inventory.m_id like :m_id and inventory.m_name like :m_name and

56、procurement_date like :procurement_date and supplier like :supplier order by procurement_date desc "SuppressWarnings("unchecked")Query<Enter> query = sessionFactory.getCurrentSession().createQuery(hql).setParameter("m_id", "%"+enter.getInventory().getM_id()+&

57、quot;%") .setParameter("m_name","%"+ enter.getInventory().getM_name()+"%").setParameter("procurement_date","%"+ enter.getProcurement_date()+"%").setParameter("supplier","%"+ enter.getSupplier().getS_id()+"%").setFirstResult(skipNumber).setMaxResults(pageSize);return query.list();/* * 根據(jù)條件查詢進藥信息的總條數(shù)

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論