package main.java.controllers;
import com.jfoenix.controls.*;
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject;
import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.*;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.util.Callback;
import javafx.util.Duration;
import main.java.layout.AutoCompleteComboBox;
import main.java.Main;
import main.resources.model.*;
import org.controlsfx.control.StatusBar;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
import java.util.concurrent.TimeUnit;
@SuppressWarnings("deprecation")
public class MainWindow_Patient implements Initializable {
public Label feeLabel;
public Label accountLabel;
public JFXComboBox<String> deptBox;
public JFXComboBox<String> doctBox;
public JFXComboBox<String> typeBox;
public JFXComboBox<String> nameBox;
public StatusBar statusBar;
public JFXButton confirmButton;
public JFXButton resetButton;
public Label timeLabel;
public JFXTreeTableView<Record> recordTable;
public JFXTextField filterField;
public Label welcomeLabel;
public JFXSpinner spinner;
private TGhxxEntity tGhxxEntity;
@FXML
private void handleExit(ActionEvent event) {
Session session = Main.factory.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
TBrxxEntity tBrxxEntity = (TBrxxEntity) session.get(TBrxxEntity.class, Main.id);
tBrxxEntity.setDlrq(new Timestamp(System.currentTimeMillis()));
session.update(tBrxxEntity);
tx.commit();
}
catch (HibernateException e) {
if (tx!=null)
tx.rollback();
e.printStackTrace();
}
finally {
session.close();
}
if (Main.curStage!=null)
Main.curStage.close();
}
@Override
public void initialize(URL location, ResourceBundle resources) {
spinner.setVisible(false);
// set patient id
tGhxxEntity = new TGhxxEntity();
tGhxxEntity.setBrbh(Main.id);
// get dept list
Session session = Main.factory.openSession();
Transaction tx = session.beginTransaction();
try {
List ksxxs = session.createQuery("from TKsxxEntity").list();
deptBox.getItems().clear();
for (Iterator it=ksxxs.iterator(); it.hasNext(); ) {
TKsxxEntity ksxx = (TKsxxEntity)it.next();
deptBox.getItems().add(ksxx.getKsbh() + " " + ksxx.getKsmc() + " " + ksxx.getPyzs());
}
tx.commit();
}
catch (HibernateException e) {
if (tx!=null)
tx.rollback();
e.printStackTrace();
}
finally {
session.close();
}
/*
comboBox列表中的值被选中时,去除编号和拼音字首,只留下名称。
*/
deptBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue!=null) {
String[] colList = newValue.split(" ");
if (colList.length==3)
Platform.runLater(()->deptBox.getEditor().setText(colList[1]));
}
}
});
doctBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue!=null) {
String[] colList = newValue.split(" ");
if (colList.length==3)
Platform.runLater(()->doctBox.getEditor().setText(colList[1]));
}
}
});
nameBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue!=null) {
String[] colList = newValue.split(" ");
if (colList.length==3)
Platform.runLater(()->nameBox.getEditor().setText(colList[1]));
}
}
});
/*
deptBox的值改变(从列表中选中或编辑完成)时,清空后续comboBox,检查当前comboBox的值是否合法,不合法则清空。
*/
deptBox.valueProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if (newValue!=null && !newValue.equals(oldValue)) {
doctBox.getEditor().clear();
typeBox.getEditor().clear();
nameBox.getEditor().clear();
feeLabel.setText("") ;
statusBar.setText("");
List itemList = deptBox.getItems();
int i;
for (i=0; i<itemList.size(); i++) {
if (newValue.equals(itemList.get(i).toString().split(" ")[1])) {
break;
}
}
if (i==itemList.size())
deptBox.getEditor().clear();
}
}
});
doctBox.getEditor().focusedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
if (oldValue==false && newValue==true) {
if (deptBox.getEditor().getText().isEmpty()) {
Session session = Main.factory.openSession();
Transaction tx = session.beginTransaction();
try {
List ksyss = session.createQuery("from TKsysEntity ").list();
doctBox.getItems().clear();
for (Iterator it=ksyss.iterator(); it.hasNext(); ) {
TKsysEntity ksys = (TKsysEntity)it.next();
doctBox.getItems().add(ksys.getYsbh() + " " + ksys.getYsmc() + " " + ksys.getPtzs());
}
}
catch (HibernateException e) {
if (tx!=null)
tx.rollback();
e.printStackTrace();
}
finally {
session.close();
}
}
else {
Session session = Main.factory.openSession();
Transaction tx = session.beginTransaction();
try {
Query query = session.createQuery("
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
前端基于javafx,并使用了一些优秀的javafx组件库,例如JFoenix、controlsfx进行图形界面的开发; 后端使用mysql数据库,并利用Hibernate进行数据库的维护和查询。 开发环境: * Jetbrains Intellij 2018.1 Ultamate Edition * JavaSE-10 * JFoenix 9.0.4 * controlsfx 9.0 * Hibernate 5.3.0
资源推荐
资源详情
资源评论
收起资源包目录
HospitalRegistration.zip (52个子文件)
HospitalRegistration
src
hibernate.cfg.xml 1KB
main
resources
image
patient_avatar.png 5KB
if_Safety01_928417.png 2KB
Icon.png 3KB
search.gif 3KB
LoginTitleIcon.png 5KB
User.png 4KB
avatar.jpg 7KB
css
MainWindow_Doctor.css 58B
Login.css 78B
view
MainWindow_Patient.fxml 5KB
MainWindow_Doctor.fxml 5KB
Login.fxml 2KB
model
TKsysEntity.java 2KB
THzxxEntity.hbm.xml 1KB
TKsxxEntity.java 1KB
TGhxxEntity.hbm.xml 1KB
TBrxxEntity.hbm.xml 915B
TKsysEntity.hbm.xml 1KB
TBrxxEntity.java 2KB
TKsxxEntity.hbm.xml 659B
TGhxxEntity.java 3KB
THzxxEntity.java 2KB
java
controllers
MainWindow_Patient.java 32KB
MainWindow_Doctor.java 20KB
Login.java 7KB
Main.java 3KB
layout
AutoCompleteComboBox.java 6KB
out
production
Hospital
hibernate.cfg.xml 1KB
main
resources
image
patient_avatar.png 5KB
if_Safety01_928417.png 2KB
Icon.png 3KB
search.gif 3KB
LoginTitleIcon.png 5KB
User.png 4KB
avatar.jpg 7KB
css
MainWindow_Doctor.css 58B
Login.css 78B
view
MainWindow_Patient.fxml 5KB
MainWindow_Doctor.fxml 5KB
Login.fxml 2KB
model
THzxxEntity.hbm.xml 1KB
TGhxxEntity.hbm.xml 1KB
TBrxxEntity.hbm.xml 915B
TKsysEntity.hbm.xml 1KB
TKsxxEntity.hbm.xml 659B
Screenshots
doctor2.PNG 28KB
patient.PNG 40KB
Login.PNG 11KB
doctor1.PNG 21KB
.gitignore 278B
Hospital.iml 2KB
共 52 条
- 1
资源评论
振华OPPO
- 粉丝: 28w+
- 资源: 535
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于javascript实现的蚁群算法(JS代码)
- 基于python实现的随机森林(python代码)
- python读取excel到数据库中,简单的数据库管理脚本
- 7777端口抓包数据集
- IMG_0694.GIF
- 基于图像的三维模型重建C++源代码+文档说明(高分课程设计)
- 基于聚焦法的工件立体测量方案,根据数据进行三维重建 使用HALCON处理图像,MATLAB拟合数据+源代码+数据集+效果图
- 锄战三国村 修改:货币使用不减 v1.10(2) 原创 (中文).apk
- 基于python实现的单目双目视觉三维重建+源代码+图像图片(高分课程设计)
- 基于C+++OPENCV的全景图像拼接源码(课程设计)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功