一、系统介绍
======
1.开发环境
开发工具:IDEA2018.2
JDK版本:jdk1.8
2.技术选型
Java语言开发,使用ArrayList存储信息。
3.系统功能
1.实现系统登录
2.实现病人信息的增删改查
4.获取资源
1.CSDN下载
二、系统展示
=======
1.登录系统
2.查询病人信息
3.新增病人信息
4.更新病人信息
5.删除病人信息
三、部分代码
======
BusinessService
package service;
import common.Constant;
import common.Response;
import entity.Patient;
import java.util.ArrayList;
import java.util.List;
public class BusinessService {
private static List businessList = new ArrayList<>();
static {
businessList.add(new Patient(“张三”,“111111”,“30”,“北京”,“1001”,“无”));
businessList.add(new Patient(“李四”,“222222”,“40”,“上海”,“1002”,“无”));
businessList.add(new Patient(“王五”,“333333”,“50”,“广州”,“1003”,“无”));
}
public Response query(String name){
if(name == null || “”.equals(name)){
return new Response(“error”,“姓名为空。”);
}
for(Patient patient : businessList){
if(name.equals(patient.getName())){
return new Response(“success”,“查询成功。”, patient);
}
}
return new Response(“error”,“未查询到此”+ Constant.MAIN_CLASS +“,请重新输入:”);
}
public Response add(Patient patient){
for(Patient p : businessList){
if(p.getName().equals(patient.getName())){
return new Response(“error”,“该”+Constant.MAIN_CLASS+“已存在。”);
}
}
businessList.add(patient);
return new Response(“success”,Constant.MAIN_CLASS+“添加成功。”, patient);
}
public Response checkProp(Patient patient, String prop, String value){
if(prop == null || “”.equals(prop)){
return new Response(“error”,“属性为空。”);
}
String[] props = {“name”,“ID_card”,“age”,“address”,“number”,“history”};
switch(prop){
case “name” :
patient.setName(value);
break;
case “ID_card” :
patient.setID_card(value);
break;
case “age” :
patient.setAge(value);
break;
case “address” :
patient.setAddress(value);
break;
case “number” :
patient.setNumber(value);
break;
case “history” :
patient.setHistory(value);
break;
default:
return new Response(“error”,“该属性不存在。”);
}
return new Response(“success”,“编辑成功。”);
}
public Response delete(String name){
if(name == null || “”.equals(name)){
return new Response(“error”,Constant.MAIN_CLASS+“姓名为空。”);
}
for(Patient patient : businessList){
if(patient.getName().equals(name)){
businessList.remove(patient);
return new Response(“success”,Constant.MAIN_CLASS+“删除成功。”);
}
}
return new Response(“error”,Constant.MAIN_CLASS+“不存在。”);
}
}
LoginService
package service;
import common.Account;
import common.Response;
import entity.User;
import java.util.ArrayList;
import java.util.List;
public class LoginService {
private static List userList = new ArrayList();
static{
userList.add(new User(Account.ADMIN.getUsername(),Account.ADMIN.getPassword()));
userList.add(new User(Account.USER1.getUsername(),Account.USER1.getPassword()));
userList.add(new User(Account.USER2.getUsername(),Account.USER2.getPassword()));
userList.add(new User(Account.USER3.getUsername(),Account.USER3.getPassword()));
}
userList = new ArrayList();
static{
userList.add(new User(Account.ADMIN.getUsername(),Account.ADMIN.getPassword()));
userList.add(new User(Account.USER1.getUsername(),Account.USER1.getPassword()));
userList.add(new User(Account.USER2.getUsername(),Account.USER2.getPassword()));
userList.add(new User(Account.USER3.getUsername(),Account.USER3.getPassword()));
}