基于javaweb+mysql的springboot医院预约挂号系统(java+springboot+thymeleaf+html+maven+layui+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot医院预约挂号系统(java+springboot+thymeleaf+html+maven+layui+mysql)
一、项目简述功能包括: 用户分为患者,医生,管理员,患者可进行注册选择医生挂号,选择日期,选择号源,医生可进行接诊,管理员可对用户,医生信息的维护等等功能。
二、项目运行环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
messages.setType(1);
messages.setTime(new Date());
PageInfo<Messages> pageInfo2 = messagesService.selectMessagesListDemo(messages,1,99);
return pageInfo2.getList();
}
/**
*医生列表查询
*/
@RequestMapping(value = "/messagesQundingUptate")
@ResponseBody
public String messagesQundingUptate(Integer id) {
if(id != null) {
Messages messages = new Messages();
messages.setId(id);
messages.setType(3); //3表示预约成功
messagesService.updateByPrimaryKeySelective(messages);
Messages selectByPrimaryKey = messagesService.selectByPrimaryKey(id);
Messages mes = new Messages();
mes.setType(1);
mes.setTime(new Date());
mes.setDid(selectByPrimaryKey.getDid());
List<Messages> list = messagesService.selectMessagesPai(mes);
for (int i = 0; i < list.size(); i++) {
list.get(i).setPai(i+1);
messagesService.updateByPrimaryKeySelective(list.get(i));
}
}
return "ok";
}
/**
*患者信息列表
*/
@RequestMapping("/patientList")
public String messageList(Model model, Patient patient, @RequestParam(value="page",defaultValue="1")Integer page,HttpServletRequest request) {
if(patient == null) {
patient = new Patient();
}
HttpSession session = request.getSession();
Doctor dt = (Doctor) session.getAttribute("DOCTOR");
if(dt == null){
return "redirect:/login/index";
}
return selectByPrimaryKey;
}
/**
*医生列表查询
* @throws ParseException
*/
@RequestMapping(value = "/doctortimeSelect")
@ResponseBody
public List<Doctor> doctortimeSelect(@RequestParam("datetimei")String datetimei,@RequestParam("id")Integer id) throws ParseException {
Doctor doctor = new Doctor();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
doctor.setSid(id);
doctor.setBegindate(simpleDateFormat.parse(datetimei));
List<Doctor> selectDoctor = doctorService.selectTime(doctor);
return selectDoctor;
}
/**
*医生列表查询
* @throws ParseException
*/
@RequestMapping(value = "/doctorGeRenList")
@ResponseBody
public Doctor doctorGeRenList(Integer id) throws ParseException {
Doctor doctor = doctorService.selectByPrimaryKey(id);
return doctor;
}
/**
*时间格式转换
*/
@RequestMapping(value = "/doctorYuyueTime")
@ResponseBody
public Map<String,String> doctorYuyueTime(Integer id) {
Map<String,String> map = new HashMap<String,String>();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
Doctor doctor = doctorService.selectByPrimaryKey(id);
map.put("begin",sdf.format(doctor.getBegintime()));
map.put("end",sdf.format(doctor.getEndtime()));
return map;
}
/**
*时间格式转换
if(type == 1 ) {
return "doctorRegister";
}
return "adminRegister";
}
/**
* 医生注册界面
*/
@RequestMapping("/doctorRegisterPage")
public String doctorRegister(Model model) {
List<Section> sectionlist2 = null;
Section se = new Section();
se.setType(1);
List<Section> sectionlist = sectionService.selectByExample(se);
if(sectionlist.size() > 0 ) {
//科室详情
Section section = new Section();
section.setPid(sectionlist.get(0).getId());
section.setType(2);
sectionlist2 = sectionService.selectByExample(section);
}
model.addAttribute("sectionlist", sectionlist);
model.addAttribute("sectionlist2", sectionlist2);
return "doctorRegister";
}
/**
* 管理员注册
*/
@RequestMapping("/admin_Register")
public String admin_Register(Admin admin,Model model) {
int insertSelective = adminService.insertSelective(admin);
model.addAttribute("type",2);
return "login";
}
/**
* 登陆验证
* @return
*/
@RequestMapping("/verificatio")
public String verificatio(String username, String password, Integer type, HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
session.setAttribute("type",type);
//类型为1是医院 2是管理员
// messages.setTime(new Date());
messages.setType(1);
// messages.setUid(patient1.getPid());
messages.setUserid(patient1.getId());
System.out.println("-----------------1");
System.out.println(messages);
System.out.println(patient1);
System.out.println("-----------------2");
PageInfo<Messages> pageInfo = messagesService.selectMessagesList(messages, 1, size);
model.addAttribute("doctorList",pageInfo.getList());
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("patient",patient);
return "patient/patientList";
}
/**
*患者信息列表
*/
@RequestMapping(value = "/patienDel")
@ResponseBody
public List<Patient> patienDel(Integer id) {
if(id != null) {
patientService.deleteByPrimaryKey(id);
}
List<Patient> selectByExample = patientService.selectByExample(null);
return selectByExample;
}
/**
*患者信息查看
*/
@RequestMapping(value = "/patientUpatePage")
@ResponseBody
public Patient patientUpatePage(Integer id) {
Patient patient = null;
if(id != null) {
patient = patientService.selectByPrimaryKey(id);
}
return patient;
}
@Autowired
private AdminService adminService;
@Autowired
private SectionService sectionService;
@Autowired
private BannersService bannersService;
@Autowired
private DoctorService doctorService;
@Autowired
private PatientService patientService;
@Autowired
private MessagesService messagesService;
private Integer size = 6;//每页显示数量
@Value("${fileUrl}") //在配置文件中获取文件的保存路径
private String filePath;
/**
* 导入
* @param file
* @param response
* @throws IOException
*/
@RequestMapping("/excelInput")
public String excelInput(MultipartFile file,HttpServletResponse response) throws IOException {
String sb = file.getOriginalFilename();
List<String[]> jieExcel = ExcelInput.jieExcel(file.getInputStream(), sb.substring(sb.indexOf(".")+1));
for (String[] strings : jieExcel) {
System.out.println(Arrays.toString(strings));
}
return "redirect:/admin/index";
}
model.addAttribute("type",type);
session.invalidate(); //session销毁
return "login";
}
/*
*//**
* 跳转忘记密码界面
*//*
@RequestMapping("/mimaPageUptate")
public String passwordUpate() {
return "behind/merchant/mibaoUptate";
}
*//**
* 修改密码
*//*
@RequestMapping("/mimaUpate")
@ResponseBody
public Map<String,String> passwordUpate(Model model, String mima, String mibao, String zhanghao) {
Map<String, String> map = new HashMap<String, String>();
Merchant me = new Merchant();
me.setZhanghao(zhanghao);
me.setMibao(mibao);
List<Merchant> list = merchantService.selectMerchant(me);
if(list.size() > 0){
Merchant me2 = new Merchant();
me2.setId(list.get(0).getId());
me2.setMima(mima);
merchantService.updateByPrimaryKeySelective(me2);
map.put("pan","ok");
}else{
map.put("pan","err");
}
return map;
}
if(doctor.getYipeoples() == null) {
doctor.setYipeoples(0);
}
doctor.setYipeoples(doctor.getYipeoples()+1);
doctorService.updateByPrimaryKeySelective(doctor);
}
Section section = sectionService.selectByPrimaryKey(patient.getSid());//科室
if(section != null) {
patient.setSname(section.getName());
}
Patient pa = patientService.selectByPrimaryKey(patient1.getId()); //患者
if(pa != null) {
patient.setUid(pa.getPid());
patient.setUserid(pa.getId());
patient.setPhone(pa.getPhone());
patient.setUsername(pa.getUsername());
patient.setAge(pa.getAge());
int countByExample = messagesService.countByExample(null);
patient.setBianhao(countByExample+1);
//排序
Messages message = new Messages();
// message.setUid(patient.getUid());
message.setTime(patient.getTime());
message.setDid(patient.getDid());
message.setType(-1);
List<Messages> list = messagesService.selectMessages(message);
if(list.size() <= 0) {
patient.setPai(1);
}else {
patient.setPai(list.size()+1);
}
}
messagesService.insertSelective(patient);
if(patient.getId() != null) {
hui = messagesService.selectByPrimaryKey(patient.getId());
Messages xin = new Messages();
xin.setDid(hui.getDid());
xin.setType(1);
xin.setTime(shijian);
List<Messages> selectMessagesPai = messagesService.selectMessagesPai(xin);
hui.setAge(selectMessagesPai.size());
}
return "redirect:/api/doctorList1";
}
/**
*取消预约
* @throws ParseException
section.setType(2);
sectionlist2 = sectionService.selectByExample(section);
model.addAttribute("sectionlist2", sectionlist2);
model.addAttribute("se1", se1);
}
}
return "doctor/doctorUptate";
}
/**
* 修改医生信息
*/
@RequestMapping("/messageTime")
public String messageTime(String name,Model model,HttpServletRequest request) {
HttpSession session = request.getSession();
Doctor dt = (Doctor) session.getAttribute("DOCTOR");
if(name != null) {
Messages mess = new Messages();
mess.setDid(dt.getId());
mess.setUsername(name);
List<Messages> selectMessages = messagesService.selectMessagesTWO(mess);
model.addAttribute("messagesList", selectMessages);
}
return "doctor/messageTime";
}
/**
* 修改医生信息
*/
@RequestMapping("/admindoctorUptate")
public String adminUptatePassword(Doctor doctor,Model model) {
if(doctor != null && doctor.getId() != null) {
if(doctor.getSid() != null) {
Section section = sectionService.selectByPrimaryKey(doctor.getSid());
doctor.setSid(section.getId());
doctor.setSname(section.getName());
}
doctorService.updateByPrimaryKeySelective(doctor);
}
return "redirect:/doctor/index";
}
/**
* 预约信息列表
*/
@RequestMapping("/messageList")
public String doctorList(Model model, Messages messages, @RequestParam(value="page",defaultValue="1")Integer page,Integer type,HttpServletRequest request) {
model.addAttribute("nu",shu.toString());
}
return "admin/index";
}
/**
* 管理员修改密码界面
* @return
*/
@RequestMapping("/adminUptatePage")
public String adminUptatePage(Model model) {
return "admin/adminUptate";
}
/**
* 修改密码
*/
@RequestMapping("/adminUptatePassword")
public String adminUptatePassword(Model model,Admin admin,HttpServletRequest request) {
HttpSession session = request.getSession();
Admin ad = (Admin) session.getAttribute("ADMIN");
if(ad != null && admin.getPassword() != null){
admin.setId(ad.getId());
adminService.updateByPrimaryKeySelective(admin);
}
return "redirect:/admin/index";
}
/**
* 坐诊时间设置界面
*/
@RequestMapping("/doctorTimePage")
public String doctorTimePage(Integer id,Model model) {
if(id != null) {
Doctor doctor = doctorService.selectByPrimaryKey(id);
model.addAttribute("doctor",doctor);
}
@ResponseBody
public Patient patientUpatePage(Integer id) {
Patient patient = null;
if(id != null) {
patient = patientService.selectByPrimaryKey(id);
}
return patient;
}
/**
*患者信息修改
*/
@RequestMapping(value = "/patientUpdate")
@ResponseBody
public Patient patientUpdate(@RequestBody Patient patient) {
patientService.updateByPrimaryKeySelective(patient);
return null;
}
/**
*预约信息
* @throws ParseException
*/
@RequestMapping(value = "/messagesSave")
public String messagesSave(Messages patient,HttpServletRequest request) throws ParseException {
HttpSession session = request.getSession();
Patient patient1 = (Patient) session.getAttribute("PATIENT");
Messages hui = null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date shijian = simpleDateFormat.parse(patient.getSname());
patient.setTime(shijian);
patient.setType(1);//待预约
Doctor doctor = doctorService.selectByPrimaryKey(patient.getDid());//医生
if(doctor != null) {
patient.setDname(doctor.getName());
if(doctor.getYipeoples() == null) {
}
*//**
* 后台登陆界面
* @return
*//*
@RequestMapping("/afterView")
public String afterLogin(Integer type,Model model) {
if(type == null){
type = 1;
}
model.addAttribute("type",type);
return "behind/login";
}
*//**
* 登陆验证
* @return
*//*
@RequestMapping("/verificatio")
public String signin(String username, String password, Integer type, HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
session.setAttribute("type",type);
//类型为1是商户后台 2是管理员
if(type == 1){
Merchant merchant = new Merchant();
merchant.setZhanghao(username);
merchant.setMima(password);
merchant.setState(1);
List<Merchant> merchants = merchantService.selectMerchant(merchant);
if(merchants.size() <= 0){
model.addAttribute("message","密码错误");
model.addAttribute("type",type);
return "behind/login";
}
session.setAttribute("MERCHANT",merchants.get(0));
return "redirect:/merchant/index";
}
Admin admin = new Admin();
admin.setUsername(username);
/**
* @throws ParseException
*/
@RequestMapping(value = "/doctortouList")
@ResponseBody
public List<Doctor> doctortouList() {
PageInfo<Doctor> pageInfo = doctorService.selectDoctorList(null,1,4);
return pageInfo.getList();
}
/**
* @throws ParseException
*/
@RequestMapping(value = "/datatimeGua")
@ResponseBody
public Integer datatimeGua(@RequestParam("datetime")String datetime,@RequestParam("did")Integer did) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date parse = sdf.parse(datetime);
Messages message = new Messages();
message.setTime(parse);
message.setDid(did);
message.setType(-1);
List<Messages> list = messagesService.selectMessages(message);
return list.size();
}
}
package com.hos.hospital.controller;
*/
}
package com.hos.hospital.controller;
public Integer patientPai(Integer id) {
Patient pa = new Patient();
pa.setPid(id);
PatientExample se = new PatientExample();
PatientExample.Criteria criteria = se.createCriteria();
if(pa != null){
if(pa.getPid() != null) {
criteria.andPidEqualTo(pa.getPid());
}
}
List<Patient> selectByExample = patientService.selectByExample(se);
if(selectByExample.size() >0 ) {
List<Messages> lmlist = messagesService.selectByExample(null);
int j = 0 ;
for (Messages me : lmlist) {
if(me.getUid() == id) {
return j;
}
j++;
}
}
return -1;
}
/**
*查询科室
*/
@RequestMapping(value = "/sectioNameList")
@ResponseBody
public List<Section> sectioNameList(String name) {
Section se = new Section();
se.setName(name);
se.setType(2);
List<Section> sectionlist = sectionService.selectByExample(se);
if(sectionlist.size() > 0) {
//查询全部科室
se.setName(null);
/**
* 后端管理员控制层
*/
@Controller
@RequestMapping("/api")
public class PatientController {
private Integer size = 6;//每页显示数量
@Autowired
private AdminService adminService;
@Autowired
private SectionService sectionService;
@Autowired
private BannersService bannersService;
@Autowired
private DoctorService doctorService;
@Autowired
private PatientService patientService;
@Autowired
private MessagesService messagesService;
/**
* 医生列表
*/
@RequestMapping("/doctorList1")
public String doctorList(Model model, Doctor doctor, @RequestParam(value="page",defaultValue="1")Integer page) {
if(doctor == null) {
doctor = new Doctor();
}
PageInfo<Doctor> pageInfo = doctorService.selectDoctorList(doctor,page,size);
List<Doctor> list = pageInfo.getList();
if(doctor.getId() != null){
if(doctor.getSid() != null) {
Section selectByPrimaryKey = sectionService.selectByPrimaryKey(doctor.getSid());
doctor.setSname(selectByPrimaryKey.getName());
}
doctorService.updateByPrimaryKeySelective(doctor);
}
return "redirect:/admin/doctorList";
}
/**
* 医生列表
*/
@RequestMapping("/doctorList")
public String doctorList(Model model, Doctor doctor, @RequestParam(value="page",defaultValue="1")Integer page) {
if(doctor == null) {
doctor = new Doctor();
}
PageInfo<Doctor> pageInfo = doctorService.selectDoctorList(doctor,page,size);
List<Doctor> list = pageInfo.getList();
model.addAttribute("doctorList",pageInfo.getList());
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("doctor",doctor);
return "admin/doctorList";
}
/**
* 修改医生信息界面
* @return
*/
@RequestMapping("/doctorUptatePage")
public String doctorUptatePage(Model model,Integer id) {
if(id != null) {
Doctor doctor = doctorService.selectByPrimaryKey(id);
List<Section> sectionlist2 = null;
model.addAttribute("doctor",doctor);
//科室
*/
@RequestMapping(value = "/doctorYuyueTime")
@ResponseBody
public Map<String,String> doctorYuyueTime(Integer id) {
Map<String,String> map = new HashMap<String,String>();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
Doctor doctor = doctorService.selectByPrimaryKey(id);
map.put("begin",sdf.format(doctor.getBegintime()));
map.put("end",sdf.format(doctor.getEndtime()));
return map;
}
/**
*时间格式转换
* @throws ParseException
*/
@RequestMapping(value = "/timeZhuan")
@ResponseBody
public String timeZhuan(String time) throws ParseException {
Date parse = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if(time != null) {
parse = sdf.parse(time);
}
return sdf.format(parse);
}
/**
*添加患者信息
*/
@RequestMapping(value = "/loginByPatient")
public String loginByPatient(@RequestBody Patient patient) {
return "loginByPatient";
}
/**
*添加患者信息
* @return
* @throws IOException
*/
@RequestMapping(value ="/zixunAdd")
@ResponseBody
public Map<String, Object> zixunAdd(@RequestParam("mf")MultipartFile mufile,@RequestParam("id")Integer id) throws IOException{
Map<String, Object> map = new HashMap<String, Object>();
String random = StringRandom.getRandom();
String filename = mufile.getOriginalFilename();
//随机字符+原图片名用作新的图片名
filename = random+".jpg";
try {
//文件保存路径 D:/xxxx/xxxx/
File file = new File(filePath+filename);
//判断父级文件是否存在
if (!file.getParentFile().exists()) {
file.getParentFile().mkdir();
}
mufile.transferTo(file);
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
}
Doctor doctor = new Doctor();
if(id != -1){
doctor.setId(id);
doctor.setImg("/files/"+filename);
doctorService.updateByPrimaryKeySelective(doctor);
}else {
//添加图片路径
doctor.setImg("/files/"+filename);
doctorService.insertSelective(doctor);
System.out.println("id:"+doctor.getId());
map.put("id",doctor.getId());
}
return map;
}
/**
* 判断管理员账号
*/
@RequestMapping("/sectionxList")
@ResponseBody
public List<Section> sectionxList(Model model, Integer id) {
/**
* 后端管理员控制层
*/
@Controller
@RequestMapping("/api")
public class PatientController {
private Integer size = 6;//每页显示数量
@Autowired
private AdminService adminService;
@Autowired
private SectionService sectionService;
@Autowired
private BannersService bannersService;
@Autowired
private DoctorService doctorService;
@Autowired
PageInfo<Zixun> pageInfo = zixunService.selectZixunList(zixun,page,size);
model.addAttribute("zixunList",pageInfo.getList());
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("zixun",zixun);
return "behind/admin/zixunList";
}
*//**
* 资讯下架
* @param model
* @return
*//*
@RequestMapping("/zixunUptate")
public String zixunUptate(Model model,Integer id) {
if(id != null){
Zixun zixun = new Zixun();
zixun.setId(id);
zixun.setState(1); //1是下架
zixunService.updateByPrimaryKeySelective(zixun);
}
return "redirect:/admin/zixunList";
}
*//**
* 管理评论
* @return
*//*
@RequestMapping("/commentList")
public String commentList(Model model,Integer type) {
if(type != null){
Comment comment = new Comment();
comment.setType(type);//商品评论
comment.setReport(1);//1为举报的
List<Comment> commentsList = commentService.selectComment(comment);
model.addAttribute("commentsList",commentsList);
*//*
@RequestMapping("/sessionInvalidate")
public String boot(HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
Integer type = (Integer) session.getAttribute("type");
if(type == null){
type=1;
}
model.addAttribute("type",type);
session.invalidate(); //session销毁
return "behind/login";
}
*//**
* 管理员修改密码界面
* @return
*//*
@RequestMapping("/adminUptatePage")
public String adminUptatePage(Model model) {
return "behind/admin/adminUptate";
}
*//**
* 商户修改密码界面
* @return
*//*
@RequestMapping("/merchantUptate")
public String merchantUptate(Model model) {
return "behind/merchant/merchantUptate";
}
*/
}
package com.hos.hospital.controller;
Patient pa = new Patient();
pa.setPid(pid);
List<Patient> selectPatient = patientService.selectPatient(pa);
return selectPatient;
}
/**
*患者信息列表
*/
@RequestMapping("/patientList2")
public String messageList2(Model model, Patient patient, @RequestParam(value="page",defaultValue="1")Integer page,HttpServletRequest request) {
if(patient == null) {
patient = new Patient();
}
HttpSession session = request.getSession();
Patient patient1 = (Patient) session.getAttribute("PATIENT");
if(patient1 == null){
return "redirect:/login/font/index";
}
/*
* PageInfo<Patient> pageInfo =
* patientService.selectPatientList(patient,1,size); List<Patient> list =
* pageInfo.getList(); List<Patient> list2 = new ArrayList<Patient>(); Messages
* messages = new Messages(); boolean pan = false; SimpleDateFormat sdf = new
* SimpleDateFormat("yyyy-MM-dd"); for (Patient pa : list) { if(pa.getPid() !=
* null && pa.getPid() != 0){ messages.setDid(dt.getId());
* messages.setUid(pa.getPid()); messages.setUsername(pa.getName());
* List<Messages> ml = messagesService.selectMessages(messages); if(ml.size() >
* 0 ){ Date time = ml.get(0).getTime(); pa.setUsername(sdf.format(time));
* pa.setPhone(dt.getName()); pa.setIdentitys(dt.getSname()); list2.add(pa); }
*
* } } if(list2.size() <= 8) { pageInfo.setPages(1); }
*/
Messages messages = new Messages();
// messages.setTime(new Date());
messages.setType(1);
// messages.setUid(patient1.getPid());
messages.setUserid(patient1.getId());
System.out.println("-----------------1");
System.out.println(messages);
System.out.println(patient1);
System.out.println("-----------------2");
PageInfo<Messages> pageInfo = messagesService.selectMessagesList(messages, 1, size);
model.addAttribute("doctorList",pageInfo.getList());
me.setTime(new Date());
for (int i = 0; i < list.size(); i++) {
if(list.get(i).getType() == 1) {
me.setDid(list.get(i).getDid());
List<Messages> lin = messagesService.selectMessagesPai(me);
list.get(i).setAge(lin.size());
}
}
return list;
}
/**
* @throws ParseException
*/
@RequestMapping(value = "/doctortouList")
@ResponseBody
public List<Doctor> doctortouList() {
PageInfo<Doctor> pageInfo = doctorService.selectDoctorList(null,1,4);
return pageInfo.getList();
}
/**
* @throws ParseException
*/
@RequestMapping(value = "/datatimeGua")
@ResponseBody
public Integer datatimeGua(@RequestParam("datetime")String datetime,@RequestParam("did")Integer did) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date parse = sdf.parse(datetime);
Messages message = new Messages();
message.setTime(parse);
message.setDid(did);
message.setType(-1);
List<Messages> list = messagesService.selectMessages(message);
return list.size();
}
}
package com.hos.hospital.controller;
messages.setType(1);
messages.setUid(mes.getUid());
messages.setTime(new Date());
List<Messages> list = messagesService.selectMessages(messages);
return "redirect:/api/patientList2";
}
/**
*预约信息列表
* @throws ParseException
*/
@RequestMapping(value = "/messagesUidList")
@ResponseBody
public List<Messages> messagesUidList(@RequestBody Messages message) throws ParseException {
List<Messages> list = null;
if(message.getType() != null && message.getType() == 1) {
message.setTime(new Date());
list = messagesService.selectMessagesPai(message);
}else {
list = messagesService.selectMessagesTWO(message);
}
Messages me = new Messages();
me.setType(1);
me.setTime(new Date());
for (int i = 0; i < list.size(); i++) {
me.setDid(list.get(i).getDid());
List<Messages> lin = messagesService.selectMessagesPai(me);
list.get(i).setAge(lin.size());
}
return list;
}
/**
*预约信息列表
* @throws ParseException
*/
@RequestMapping(value = "/messagesList")
@ResponseBody
public List<Messages> messagesList(@RequestParam("type")Integer type,@RequestParam("uid")Integer uid) throws ParseException {
Messages message = new Messages();
List<Messages> list = null;
message.setType(type);
message.setUid(uid);
if(type != null && type == 1) {
message.setTime(new Date());
list = messagesService.selectMessagesPai(message);
Messages me = new Messages();
me.setType(1);
me.setTime(new Date());
for (int i = 0; i < list.size(); i++) {
/**
* 跳转修改科室下级界面
*/
@RequestMapping("/sectionBelowUptatePage")
public String sectionBelowUptatePage(Model model,Integer id) {
if(id != null) {
Section se = sectionService.selectByPrimaryKey(id);
Section section = sectionService.selectByPrimaryKey(se.getPid());
model.addAttribute("se",se);
model.addAttribute("sname",section.getName());
}
return "admin/sectionBelowUptate";
}
/**
* 跳转修改科室界面
*/
@RequestMapping("/sectionUptatePage")
public String sectionUptatePage(Model model,Integer id) {
if(id != null) {
Section se = sectionService.selectByPrimaryKey(id);
model.addAttribute("se",se);
}
return "admin/sectionUptate";
}
/**
* 添加科室
*/
@RequestMapping("/sectionAdd")
@ResponseBody
public Map<String,String> sectionAdd(String name) {
Map<String, String> map = new HashMap<String, String>();
if(name != null ){
Section section = new Section();
section.setName(name);
section.setType(1);
sectionService.insertSelective(section);
map.put("pan","ok");
}else{
map.put("pan","err");
}
return map;
}
/**
* 添加科室下级
File file = new File(filePath+filename);
//判断父级文件是否存在
if (!file.getParentFile().exists()) {
file.getParentFile().mkdir();
}
mufile.transferTo(file);
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
}
Doctor doctor = new Doctor();
if(id != -1){
doctor.setId(id);
doctor.setImg("/files/"+filename);
doctorService.updateByPrimaryKeySelective(doctor);
}else {
//添加图片路径
doctor.setImg("/files/"+filename);
doctorService.insertSelective(doctor);
System.out.println("id:"+doctor.getId());
map.put("id",doctor.getId());
}
return map;
}
/**
* 判断管理员账号
*/
@RequestMapping("/sectionxList")
@ResponseBody
public List<Section> sectionxList(Model model, Integer id) {
List<Section> selectByExample = null;
if(id != null) {
Section section = new Section();
section.setPid(id);
selectByExample = sectionService.selectByExample(section);
}
return selectByExample;
}
/**
* 判断管理员账号
*/
@RequestMapping("/mimaUpate")
@ResponseBody
public Map<String,String> passwordUpate(Model model, String zhanghao) {
Map<String, String> map = new HashMap<String, String>();
/**
* 判断管理员账号
*/
@RequestMapping("/sectionxList")
@ResponseBody
public List<Section> sectionxList(Model model, Integer id) {
List<Section> selectByExample = null;
if(id != null) {
Section section = new Section();
section.setPid(id);
selectByExample = sectionService.selectByExample(section);
}
return selectByExample;
}
/**
* 判断管理员账号
*/
@RequestMapping("/mimaUpate")
@ResponseBody
public Map<String,String> passwordUpate(Model model, String zhanghao) {
Map<String, String> map = new HashMap<String, String>();
Admin ad = new Admin();
ad.setUsername(zhanghao);
List<Admin> selectAdmin = adminService.selectAdmin(ad);
if(selectAdmin.size() > 0){
map.put("pan","err");
}else{
map.put("pan","ok");
}
return map;
}
/**
* 判断医生账号
*/
@RequestMapping("/panzhanghao")
@ResponseBody
public Map<String,String> panzhanghao(Model model, String zhanghao) {
Map<String, String> map = new HashMap<String, String>();
DoctorExample se = new DoctorExample();
DoctorExample.Criteria criteria = se.createCriteria();