springboot医院信息管理系统

开发技术: 

ssm(springboot springmvc mybatis)  前端 freemarker

开发环境:

 eclipse或idea  mysql5.x  jdk1.8  maven

管理员:
    医生管理 患者管理  药品管理 科目查询管理 疾病管理 预约管理 病史管理 手术信息管理  管理员管理 请假管理  意见管理 
医生:
   请假  意见审批 处方药审批  就医诊断  叫号 查看患者病史
用户:
   药品 医生查询  挂号 病史查看 手术信息查看  药品购买 

备注 :用户注册时,需要管理员添加就诊信息后才可以用户注册

package com.hospital.controller;

import com.alibaba.fastjson.JSONObject;
import com.hospital.entity.*;
import com.hospital.service.*;
import com.hospital.uitls.DateUtils;
import com.hospital.uitls.DrugsUtils;
import com.hospital.uitls.PDFUtils;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Controller
public class DoctorController {
    @Autowired
    DoctorService doctorService;
    @Autowired
    AppointmentService appointmentService;
    @Autowired
    PatientService patientService;
    @Autowired
    DrugsService drugsService;
    @Autowired
    HospitalizationService hospitalizationService;
    @Autowired
    MedicalhistoryService medicalhistoryService;
    @Autowired
    OptionService optionService;
    @Autowired
    SeekService seekService;
    @Autowired
    LeaveService leaveService;
    @Autowired
    MessageService messageService;
    
    @Value("${filepath.seekpdfpath}")
    private String path;
    @RequestMapping("/admin/doctorManage")
    public String doctorManage(HttpServletRequest request,@RequestParam(value="name",required = false) String name,@RequestParam(value="certId",required = false) String certId){
        request.setAttribute("name",name);
        request.setAttribute("certId",certId);
        request.setAttribute("doctors",doctorService.getAllDoctor(name,certId));
        return "admin/doctorManage";
    }
    @RequestMapping(value = "/admin/doctor/{id}",method = RequestMethod.DELETE)
    @ResponseBody
    public JSONObject delDoctor(@PathVariable Integer id){
        JSONObject json=new JSONObject();
        json.put("message",doctorService.delDoctor(id));
        return json;
    }
    @RequestMapping(value = "/admin/doctor/{id}",method = RequestMethod.GET)
    public String doctorInfo(@PathVariable Integer id,HttpServletRequest request){
        request.setAttribute("doctor",doctorService.getDoctor(id));
        return "admin/info/doctorinfo";
    }
    @RequestMapping(value = "/admin/doctor",method = RequestMethod.POST)
    @ResponseBody
    public JSONObject AddDoctor(@RequestBody Doctor doctor){
        JSONObject json=new JSONObject();
        json.put("message",doctorService.addDoctor(doctor));
        return json;
    }
    @RequestMapping(value = "/admin/doctor",method = RequestMethod.PUT)
    @ResponseBody
    public JSONObject updateDoctor(@RequestBody Doctor doctor){
        JSONObject json=new JSONObject();
        json.put("message",doctorService.upDoctor(doctor));
        return json;
    }
    @RequestMapping("/admin/doctorAdd")
    public String doctorAddPage(){
        return "admin/add/doctoradd";
    }

    @RequestMapping("/doctor/seekMedicalAdvice")
    public String seekMedicalAdvice(HttpServletRequest request, HttpSession session,@RequestParam(value = "patientname",required = false)String patientname,@RequestParam(value = "time",required = false)String time){
        Login login=(Login)session.getAttribute("login");
        Doctor doctor=doctorService.getDoctorByLoginId(login.getId());
        request.setAttribute("appointments" ,appointmentService.selectByDoctorId(doctor.getId(),patientname,time));
        return "doctor/seekMedicalAdvice";
    }
    @RequestMapping("/doctor/seek/{id}")
    public String seek(@PathVariable Integer id,HttpServletRequest request){
        request.setAttribute("options",optionService.getAll());
        request.setAttribute("patient",patientService.getPatient(id));
        request.setAttribute("drugs",drugsService.getAllDrugs());
        return "doctor/seek";
    }
    @RequestMapping(value = "/doctor/drug",method = RequestMethod.PUT)
    @ResponseBody
    public JSONObject drug(@RequestBody Map map){
        JSONObject json=new JSONObject();
        Patient patient=new Patient();
        patient.setDrugsids(DrugsUtils.vaild(map));
        patient.setId(Integer.parseInt((String)map.get("patientid")));
        json.put("message",patientService.seek(patient));
        return json;
    }
    @RequestMapping(value = "/doctor/zation",method = RequestMethod.POST)
    @ResponseBody
    public JSONObject zation(@RequestBody Hospitalization hospitalization){
        JSONObject json=new JSONObject();
        json.put("message",hospitalizationService.AddHospitalization(hospitalization));
        return json;
    }
    @RequestMapping(value = "/doctor/medicalhistory/{id}")
    public String medicalhistory(@PathVariable Integer id,HttpServletRequest request){
        request.setAttribute("medicalhistorys",medicalhistoryService.getMedicalhistoryByPatientId(id));
        return "doctor/medicalhistory";
    }

    @RequestMapping( value = "/doctor/{department}",method = RequestMethod.GET)
    @ResponseBody
    public JSONObject getDoctorByDepartment(@PathVariable String department){
        JSONObject json=new JSONObject();
        json.put("doctors",doctorService.getDoctorByDepartment(department));
        return json;
    }
    @RequestMapping( value = "/doctor/seekinfo",method = RequestMethod.POST)
    @ResponseBody
    public JSONObject seekinfo(@RequestBody Map map){
        JSONObject json=new JSONObject();
        String message=doctorService.seekInfo(map);
        json.put("message",message);
        return json;
    }
    @RequestMapping( value = "/doctor/printseek/{id}",method = RequestMethod.POST)
    @ResponseBody
    public JSONObject printseek(@PathVariable Integer id,HttpSession session){
        Login login=(Login)session.getAttribute("login");
        Doctor doctor=doctorService.getDoctorByLoginId(login.getId());
        JSONObject json=new JSONObject();
        Seek seek=seekService.getSeekByPatientId(id);
        seek.setPatientname(patientService.getPatient(id).getName());
        seek.setDoctorname(doctor.getName());
        //createSeekInfo,第三个参数填空字符串就是生成在项目根目录里面,要是想生成在别的路径,例:D:\\ 就是生成在D盘根目录
        path = Thread.currentThread().getContextClassLoader().getResource("").getPath().substring(0,Thread.currentThread().getContextClassLoader().getResource("").getPath().length()-16)+"/";
        String message= PDFUtils.createSeekInfo(seek,optionService,path);
        json.put("message",message);
        return json;
    }

    
    //医生请假医生请假医生请假医生请假医生请假医生请假医生请假医生请假医生请假医生请假医生请假
    @RequestMapping("/doctor/leave")
    public String leave(HttpServletRequest request, HttpSession session){
        Login login=(Login)session.getAttribute("login");
        List<Leave> leaves = leaveService.selectByLeavename(login.getUsername());
        request.setAttribute("user",login);
        request.setAttribute("leaves",leaves);
        return "doctor/leave";
    }
    
    
    @RequestMapping("/doctor/addleave")
    public String addleave(HttpServletRequest request, HttpSession session,Leave leave){
        leave.setCreatetime(DateUtils.datetime(new Date()));
        leave.setLeavetype(0);
        leaveService.insert(leave);
        
    	Login login=(Login)session.getAttribute("login");
        List<Leave> leaves = leaveService.selectByLeavename(login.getUsername());
        request.setAttribute("user",login);
        request.setAttribute("leaves",leaves);
        return "doctor/leave";
    }

    //意见审批
     @RequestMapping("/doctor/yijianlist")
      public String yijianlist(HttpServletRequest request) {
    	  Message record = new Message();
    	  record.setAdmintype(0);
    	  record.setDoctortype(0);
    	  List<Message> messages = messageService.selectByMessage(record);
    	  request.setAttribute("messages", messages);
    	  return "doctor/message";
      }
   //意见审批
     @RequestMapping("/doctor/updateyijian")
      public String updateyijian(HttpServletRequest request,Integer id,Integer type) {
    	 Message record = messageService.selectByPrimaryKey(id);
    	 record.setDoctortype(type);
    	 messageService.updateByPrimaryKey(record);
    	  record.setAdmintype(0);
    	  record.setDoctortype(0);
    	  List<Message> messages = messageService.selectByMessage(record);
    	  request.setAttribute("messages", messages);
    	  return "doctor/message";
      }
    
}

 

 

package com.hospital.controller;

import com.alibaba.fastjson.JSONObject;
import com.hospital.entity.Appointment;
import com.hospital.entity.Hospitalization;
import com.hospital.entity.Login;
import com.hospital.entity.Patient;
import com.hospital.service.*;
import com.hospital.uitls.PDFUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class PatientController {
    @Autowired
    PatientService patientService;
    @Autowired
    DoctorService doctorService;
    @Autowired
    AppointmentService appointmentService;
    @Autowired
    HospitalizationService hospitalizationService;
    @Autowired
    MedicalhistoryService medicalhistoryService;
    @Value("${filepath.appointpdf}")
    private String path;
    @RequestMapping("/admin/patientManage")
    public String patientlist(HttpServletRequest request,@RequestParam(value="name",required = false) String name,@RequestParam(value="certId",required = false) String certId){
        request.setAttribute("name",name);
        request.setAttribute("certId",certId);
        request.setAttribute("patients",patientService.getAllPatients(name,certId));
        return "admin/patientManage";
    }
    @RequestMapping(value = "/admin/patient/{id}",method = RequestMethod.DELETE)
    @ResponseBody
    public JSONObject delPatient(@PathVariable Integer id){
        JSONObject json=new JSONObject();
        json.put("message",patientService.delPatient(id));
        return json;
    }
    @RequestMapping(value = "/admin/patient/{id}",method = RequestMethod.GET)
    public String patientInfo(@PathVariable Integer id,HttpServletRequest request){
        request.setAttribute("patient",patientService.getPatient(id));
        request.setAttribute("appointments",appointmentService.getPatientMessage(id));
        request.setAttribute("hospitalizations",hospitalizationService.getPatientMessage(id));
        request.setAttribute("doctors",doctorService.getAllDoctor());
        return "admin/info/patientinfo";
    }
    @RequestMapping(value = "/admin/patientAdd",method = RequestMethod.GET)
    public String patientAddPage(){
        return "admin/add/patientadd";
    }
    @RequestMapping(value = "/admin/patient",method = RequestMethod.PUT)
    @ResponseBody
    public JSONObject patientInfo(@RequestBody Patient patient){
        JSONObject json=new JSONObject();
        json.put("message",patientService.updatePatient(patient));
        return json;
    }
    @RequestMapping(value = "/admin/patient",method = RequestMethod.POST)
    @ResponseBody
    public JSONObject delPatient(@RequestBody Patient patient){
        JSONObject json=new JSONObject();
        json.put("message",patientService.addPatient(patient));
        return json;
    }
    @RequestMapping(value = "/patient/medicalhistory")
    public String medicalhistory(HttpSession session,HttpServletRequest request){
        Login login=(Login)session.getAttribute("login");
        Patient patient=patientService.findPatientByLoginId(login.getId());
        request.setAttribute("medicalhistorys",medicalhistoryService.getMedicalhistoryByPatientId(patient.getId()));
        return "patient/medicalhistory";
    }
    @RequestMapping(value = "/patient/hospitalization")
    public String hospitalization(HttpSession session,HttpServletRequest request){
        Login login=(Login)session.getAttribute("login");
        Patient patient=patientService.findPatientByLoginId(login.getId());
        request.setAttribute("theLast",hospitalizationService.findTheLastHospitalization(patient.getHospitalizationid()));
        Hospitalization hospitalization=new Hospitalization();
        hospitalization.setPatientid(patient.getId());
        hospitalization.setId(patient.getHospitalizationid());
        request.setAttribute("others",hospitalizationService.findOtherHospitalization(hospitalization));
        return "patient/hospitalization";
    }
    @RequestMapping(value = "/patient/appointment")
    public String appointmentInfo(HttpServletRequest request,HttpSession session){
        Login login=(Login)session.getAttribute("login");
        Patient patient=patientService.findPatientByLoginId(login.getId());
        request.setAttribute("patientid",patient.getId());
        request.setAttribute("doctors",doctorService.getAllDoctor());
        return "patient/appointment";
    }
    @RequestMapping(value = "/patient/appointment",method = RequestMethod.POST)
    @ResponseBody
    public JSONObject appointment(@RequestBody Appointment appointment){
        JSONObject json=new JSONObject();
        Patient patient=new Patient();
        String message=appointmentService.addAppointment(appointment);
        patient.setAppointmentid(appointmentService.selectTheLastAppointment(appointment.getPatientid()));
        patient.setId(appointment.getPatientid());
        patientService.updateAppointMent(patient);
        json.put("message",message);
        return json;
    }
    @RequestMapping(value="/patient/search",method=RequestMethod.GET)
    public String search(){
        return "/patient/search";
    }
    @RequestMapping(value="/patient/searchinfo",method=RequestMethod.GET)
    @ResponseBody
    public JSONObject searchinfo(@RequestParam("name")String name,@RequestParam("type")String type){
        JSONObject json=new JSONObject();
        json.put("map",patientService.serrchInfo(name,type));
        return json;
    }
    @RequestMapping(value = "/hospital/{view}")
    public String test(@PathVariable String view){
        return "patient/"+view;
    }
    @RequestMapping(value = "/patient/downloadpdf",method = RequestMethod.POST)
    @ResponseBody
    public JSONObject downloadpdf(HttpSession session){
        JSONObject json=new JSONObject();
        Login login=(Login)session.getAttribute("login");
        Patient patient=patientService.findPatientByLoginId(login.getId());
        Integer idlast=appointmentService.selectTheLastAppointment(patient.getId());
        Appointment appointment=appointmentService.getAppointment(idlast);
        //createAppointMent,第三个参数填空字符串就是生成在项目根目录里面,要是想生成在别的路径,例:D:\\ 就是生成在D盘根目录
        path = Thread.currentThread().getContextClassLoader().getResource("").getPath().substring(0,Thread.currentThread().getContextClassLoader().getResource("").getPath().length()-16);
        json.put("message",PDFUtils.createAppointMent(appointment,path));
        return json;
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值