最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Java實戰(zhàn)之醫(yī)院管理系統(tǒng)的實現(xiàn)

 更新時間:2022年04月22日 09:47:23   作者:qq1334611189  
這篇文章主要介紹了如何利用Java實現(xiàn)醫(yī)院管理系統(tǒng),文中用到的技術(shù)有:SpringBoot、Layui、Freemaker等,感興趣的同學(xué)可以了解一下

項目介紹

醫(yī)院管理系統(tǒng),分為管理員、醫(yī)生、病人三種角色;

管理員主要功能包括:

首頁、系統(tǒng)管理:醫(yī)生管理、患者管理、藥品管理;預(yù)約管理;病史管理;住院信息管理;管理員用戶管理;

醫(yī)生主要功能包括:首頁、就醫(yī)/查看病史;

病人主要功能包括:首頁、病史、住院信息、掛號;

環(huán)境需要

1.運行環(huán)境:最好是java jdk 1.8,我們在這個平臺上運行的。其他版本理論上也可以。

2.IDE環(huán)境:IDEA,Eclipse,Myeclipse都可以。推薦IDEA;

3.tomcat環(huán)境:Tomcat 7.x,8.x,9.x版本均可

4.硬件環(huán)境:windows 7/8/10 1G內(nèi)存以上;或者 Mac OS;

5.是否Maven項目: 是;查看源碼目錄中是否包含pom.xml;若包含,則為maven項目,否則為非maven項目

6.數(shù)據(jù)庫:MySql 5.7版本;

技術(shù)棧

1. 后端:SpringBoot

2. 前端:Layui+Freemaker

使用說明

1. 使用Navicat或者其它工具,在mysql中創(chuàng)建對應(yīng)名稱的數(shù)據(jù)庫,并導(dǎo)入項目的sql文件;

2. 使用IDEA/Eclipse/MyEclipse導(dǎo)入項目,Eclipse/MyEclipse導(dǎo)入時,若為maven項目請選擇maven;

若為maven項目,導(dǎo)入成功后請執(zhí)行maven clean;maven install命令

3. 將項目中application.yml配置文件中的數(shù)據(jù)庫配置改為自己的配置,配置tomcat,然后運行;

4. 運行項目,輸入http://localhost:8088 登錄

效果圖展示

核心代碼

用戶管理控制層

@RestController
@RequestMapping(value = "/user")
@Api(tags = "用戶管理API")
public class UserController {
 
    @Autowired
    private IUserService iUserService;
 
 
    /**
     * 登錄驗證
     *
     * @param reqVO
     * @param model
     * @return
     */
    @RequestMapping(value = "/dologin", method = RequestMethod.POST)
    public BaseResponse<String> doLogin(@RequestBody @Validated UserLoginReqVO reqVO, Model model) {
 
        return iUserService.doLogin(reqVO);
    }
 
    /**
     * 保存用戶注冊信息,向用戶發(fā)送激活鏈接
     *
     * @param reqVO
     * @return
     */
    @RequestMapping(value = "/doregister", method = RequestMethod.POST)
    public BaseResponse<String> registered(@RequestBody @Validated UserRegisterReqVO reqVO, Model model) {
 
        return iUserService.saveUserAndSendEmail(reqVO);
    }
 
 
    /**
     * 獲取登錄日志
     *
     * @param reqVO
     * @return
     */
    @RequestMapping(value = "/getLoginfor",method = RequestMethod.GET)
    public PageRspVO<LoginInforRspVO> getLoginfor(BasePageReqVO reqVO) {
 
        return iUserService.getLoginfor(reqVO);
    }
 
    /**
     * 修改密碼
     *
     * @param reqVO
     * @return
     */
    @PostMapping(value = "/changePassword")
    public BaseResponse<String> changePassword(@RequestBody @Validated ChangePasswordReqVO reqVO) {
 
        return iUserService.changePassword(reqVO);
    }
 
    /**
     * 個人資料設(shè)置
     *
     * @return
     */
    @PostMapping(value = "/getUserInfo")
    public List<UserInfoVO> getUserInfo() {
 
        return iUserService.getUserInfo();
    }
 
    @PostMapping(value = "/changeUserInfo")
    public BaseResponse<String> changeUserInfo(@RequestBody @Validated UserInfoVO reqVO) {
 
        return  iUserService.changeUserInfo(reqVO);
    }
 
    @PostMapping(value = "/getAnnContent")
    public AnnRspVO getAnnContent(@RequestParam String id) {
 
        return iUserService.getAnnContent(id);
    }
 
    @PostMapping(value = "/addAnotherRole")
    public BaseResponse<String> addAnotherRole(@RequestBody @Validated AccountRoleVO reqVO) {
 
        return iUserService.addAnotherRole(reqVO);
    }
 
 
    /**
     * 獲取所有角色
     * @param
     * @return
     */
    @PostMapping(value = "/getAllRole")
    public List<GetAllRoleRspVO> getAllRole() {
        return iUserService.getAllRole();
    }
 
}
@Controller
public class DeptController {
    @Autowired
    private DeptService deptService;
 
    /**
     * 分頁查詢
     */
    @RequestMapping("/findDept")
    public String findDept(String deptNo, String deptName,Integer pageIndex
            , Integer pageSize, Model model,HttpSession session){
        PageInfo<Dept> de = deptService.findPageInfo(deptNo,deptName, pageIndex,pageSize);
        model.addAttribute("de",de);
        session.setAttribute("u",deptNo);
        session.setAttribute("t",deptName);
        return "Dept_list";
    }
 
    /**
     * 添加管理員信息
     */
    @RequestMapping(value = "/addDept" ,method = RequestMethod.POST)
    @ResponseBody
    public String addDept(@RequestBody Dept dept) {
        int a = deptService.addDept(dept);
        return "Dept_list";
    }
 
 
    /**
     * 修改信息
     */
    @RequestMapping( value = "/updateDept", method = RequestMethod.POST)
    public String updateDept(Dept dept) {
        int a = deptService.updateDept(dept);
        return "redirect:/findDept";
    }
 
    /**
     * 根據(jù)Id搜索;
     */
    @RequestMapping("/findDeptById")
    public String findDeptById(Integer deptId, HttpSession session) {
        Dept de2= deptService.findDeptById(deptId);
        session.setAttribute("de2",de2);
        return "Dept_edit";
    }
 
 
 
    /**
     * 導(dǎo)出Excel
     */
    @RequestMapping(value = "/exportDeptlist" , method = RequestMethod.POST)
    @ResponseBody
    public List<Dept> exportDept(){
        List<Dept> depts = deptService.getAll();
        return depts;
    }
 
 
    /**
     * 部門人員信息查詢
     */
    @RequestMapping(value = "/findDeptPersonnel")
    public String findClassStudent(Dept dept,Model model, HttpSession session) {
        List<Dept> dep = deptService.findDeptPersonnel(dept);
        model.addAttribute("dep",dep);
        return "dept_Personnellist";
    }
 
}

醫(yī)生管理控制層

/**
 * 醫(yī)生管理控制層
 */
 
@Controller
@RequestMapping("/doctor")
public class DoctorController {
 
    @Autowired
    private DoctorService doctorService;
 
    @Autowired
    private UserService userService;
 
    @Autowired
    private RoleService roleService;
 
    @Autowired
    private OperaterLogService operaterLogService;
 
    @Autowired
    private DepartmentService departmentService;
 
    @Autowired
    private OrderReceivingService orderReceivingService;
 
    @Autowired
    private BedAllotService bedAllotService;
 
    /**
     * 跳轉(zhuǎn)醫(yī)生列表頁面
     * @param model
     * @param doctor
     * @param pageBean
     * @return
     */
    @RequestMapping(value = "/list")
    public String list(Model model, Doctor doctor, PageBean<Doctor> pageBean) {
        model.addAttribute("title", "醫(yī)生列表");
        if (doctor.getUser() != null) {
            model.addAttribute("name", doctor.getUser().getName());
        }
        model.addAttribute("pageBean", doctorService.findList(doctor, pageBean));
        return "admin/doctor/list";
    }
 
    /**
     * 醫(yī)生添加頁面
     * @param model
     * @return
     */
    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public String add(Model model) {
 
        model.addAttribute("departments", departmentService.findAllDepartment());
        return "admin/doctor/add";
    }
 
    /**
     * 醫(yī)生添加提交
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> add(Doctor doctor) {
 
        CodeMsg validate = ValidateEntityUtil.validate(doctor);
 
        if (validate.getCode() != CodeMsg.SUCCESS.getCode()) {
            return Result.error(validate);
        }
        if(Objects.isNull(doctor.getUser().getEmail())){
            return Result.error(CodeMsg.ADMIN_PUBLIC_NO_ISEXIST_EMAIL);
        }
        if(Objects.isNull(doctor.getUser().getMobile())){
            return Result.error(CodeMsg.ADMIN_PUBLIC_NO_ISEXIST_MOBILE);
        }
 
        if (!StringUtil.emailFormat(doctor.getUser().getEmail())) {
            return Result.error(CodeMsg.ADMIN_PUBLIC_EMAIL);
        }
        if (!StringUtil.isMobile(doctor.getUser().getMobile())) {
            return Result.error(CodeMsg.ADMIN_PUBLIC_MOBILE);
        }
 
        Role role = roleService.find(Doctor.DOCTOR_ROLE_ID);
        String dNo = StringUtil.generateSn(Doctor.PATIENT_ROLE_DNO);
 
        int age = DateUtil.getAge(doctor.getUser().getBirthDay());
        if (age < 0) {
            return Result.error(CodeMsg.ADMIN_PUBLIC_AGE);
        }
 
        doctor.setDoctorDno(dNo);
        doctor.getUser().setPassword(dNo);
        doctor.getUser().setUsername(dNo);
        doctor.getUser().setRole(role);
 
        User user = doctor.getUser();
        user.setAge(age);
 
        User save = userService.save(user);
        if (userService.save(user) == null) {
            return Result.error(CodeMsg.ADMIN_USE_ADD_ERROR);
        }
        operaterLogService.add("添加用戶,用戶名:" + user.getUsername());
        doctor.setUser(save);
 
        if (doctorService.save(doctor) == null) {
            return Result.error(CodeMsg.ADMIN_DOCTOR_ADD_EXIST);
        }
        return Result.success(true);
    }
 
 
    /**
     * 醫(yī)生修改頁面
     * @param model
     * @param id
     * @return
     */
    @RequestMapping(value = "/edit", method = RequestMethod.GET)
    public String edit(Model model, @RequestParam(name = "id") Long id) {
        model.addAttribute("doctor", doctorService.find(id));
        model.addAttribute("departments", departmentService.findAllDepartment());
        return "admin/doctor/edit";
    }
 
 
    /**
     * 醫(yī)生修改提交
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> edit(Doctor doctor) {
        Doctor findDoctor = doctorService.find(doctor.getId());
 
        List<Doctor> doctors = doctorService.findByDoctorDno(findDoctor.getDoctorDno());
 
        if (doctors.size() > 1 || doctors.size() <= 0) {
            return Result.error(CodeMsg.ADMIN_PATIENT_PNO_ERROR);
        }
 
        if (doctors.get(0).getId() != doctor.getId()) {
            return Result.error(CodeMsg.ADMIN_PATIENT_PNO_ERROR);
        }
        if(Objects.isNull(doctor.getUser().getEmail())){
            return Result.error(CodeMsg.ADMIN_PUBLIC_NO_ISEXIST_EMAIL);
        }
        if(Objects.isNull(doctor.getUser().getMobile())){
            return Result.error(CodeMsg.ADMIN_PUBLIC_NO_ISEXIST_MOBILE);
        }
        if (!StringUtil.emailFormat(doctor.getUser().getEmail())) {
            return Result.error(CodeMsg.ADMIN_PUBLIC_EMAIL);
        }
        if (!StringUtil.isMobile(doctor.getUser().getMobile())) {
            return Result.error(CodeMsg.ADMIN_PUBLIC_MOBILE);
        }
 
        int age = DateUtil.getAge(doctor.getUser().getBirthDay());
        if (age < 0) {
            return Result.error(CodeMsg.ADMIN_PUBLIC_AGE);
        }
 
        findDoctor.setDepartment(doctor.getDepartment());
        findDoctor.setDescription(doctor.getDescription());
        findDoctor.setExperience(doctor.getExperience());
 
        User user = doctor.getUser();
        user.setAge(age);
 
        BeanUtils.copyProperties(user, findDoctor.getUser(), "id", "createTime", "updateTime", "password", "username", "role");
 
        userService.save(findDoctor.getUser());
        doctorService.save(findDoctor);
 
        return Result.success(true);
    }
 
 
    /**
     * 刪除醫(yī)生用戶
     * @param id
     * @return
     */
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> delete(@RequestParam(name = "id", required = true) Long id) {
        try {
            Doctor doctor = doctorService.find(id);
            doctorService.deleteById(id);
            userService.delete(doctor.getUser().getId());
        } catch (Exception e) {
            return Result.error(CodeMsg.ADMIN_DOCTOR_DELETE_ERROR);
        }
        operaterLogService.add("添加用戶,用戶ID:" + id);
        return Result.success(true);
    }
 
    /**
     * 修改個人出診狀態(tài)頁面
     * @param model
     * @return
     */
    @RequestMapping(value = "/updateStatus", method = RequestMethod.GET)
    public String updateDoctorStatus(Model model) {
        Doctor doctor = doctorService.findByLoginDoctorUser();
        model.addAttribute("title","個人出診信息修改");
        model.addAttribute("doctor", doctor);
        return "admin/doctor/visitingStatus";
    }
 
    /**
     * 提交修改個人出診狀態(tài)
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/updateStatus", method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> editStatus(Doctor doctor) {
        Doctor doc = doctorService.findByLoginDoctorUser();
        if(Objects.isNull(doctor.getUser().getEmail())){
            return Result.error(CodeMsg.ADMIN_PUBLIC_NO_ISEXIST_EMAIL);
        }
        if(Objects.isNull(doctor.getUser().getMobile())){
            return Result.error(CodeMsg.ADMIN_PUBLIC_NO_ISEXIST_MOBILE);
        }
        if (!StringUtil.isMobile(doctor.getUser().getMobile())) {
            return Result.error(CodeMsg.ADMIN_PUBLIC_MOBILE);
        }
        if (!StringUtil.emailFormat(doctor.getUser().getEmail())) {
            return Result.error(CodeMsg.ADMIN_PUBLIC_EMAIL);
        }
        User user = doc.getUser();
        user.setEmail(doctor.getUser().getEmail());
        user.setMobile(doctor.getUser().getMobile());
        user.setStatus(doctor.getStatus());
        doc.setStatus(doctor.getStatus());
        doc.setDescription(doctor.getDescription());
        doc.setExperience(doctor.getExperience());
        BeanUtils.copyProperties(user, doctor.getUser(), "id", "createTime", "updateTime", "password", "username", "role", "sex", "age", "birthday");
        doctorService.save(doc);
        return Result.success(true);
    }
 
    /**
     * 醫(yī)生查詢接單記錄
     * @param model
     * @param pageBean
     * @return
     */
    @RequestMapping(value = "/orderRecord",method = RequestMethod.GET)
    public String doctorOrderRecords(Model model, PageBean<OrderReceiving> pageBean) {
        //獲取醫(yī)生登錄的信息
        Doctor loginDoctorUser = doctorService.findByLoginDoctorUser();
        model.addAttribute("title", "出診信息");
        model.addAttribute("pageBean", orderReceivingService.findByDoctorId(pageBean,loginDoctorUser.getId()));
        return "admin/doctor/orderRecord";
    }
 
    /**
     * 查看自己科室所有醫(yī)生信息
     * @param model
     * @param pageBean
     * @return
     */
    @RequestMapping(value = "/findByDepartment", method = RequestMethod.GET)
    public String AllDoctorByDepartment(Model model,PageBean<Doctor> pageBean) {
        Doctor loginDoctorUser = doctorService.findByLoginDoctorUser();
        model.addAttribute("title", "本科室所有醫(yī)生列表");
        model.addAttribute("pageBean", doctorService.findAllByDepartment(pageBean, loginDoctorUser.getDepartment().getId()));
        return "admin/doctor/doctorInformation";
    }
 
    /**
     * 醫(yī)生完成出診訂單
     * @param id
     * @return
     */
    @RequestMapping(value = "/orderRecord",method = RequestMethod.POST)
    @ResponseBody
    public Result<Boolean>modifyVisitStatus(Long id){
        boolean flag = doctorService.modifyVisitStatus(id);
        if (flag){
          return Result.success(true);
        }
        return Result.error(CodeMsg.ADMIN_DOCTOR_CANNOT_REPEATED);
    }
 
    /**
     * 管理員查看所有訂單信息
     * @param model
     * @param orderReceiving
     * @param pageBean
     * @return
     */
    @RequestMapping(value="/allOrderInformation",method = RequestMethod.GET)
    public String findAll(Model model,OrderReceiving orderReceiving, PageBean<OrderReceiving> pageBean){
        model.addAttribute("title","出診信息");
        model.addAttribute("pageBean",orderReceivingService.findList(orderReceiving,pageBean));
        return "admin/doctor/allOrderInformation";
    }
 
 
    /**
     * 醫(yī)生查詢負責(zé)的住院信息
     */
    @RequestMapping(value="/bedAllot")
    public String bedAllotSelf(Model model,PageBean<BedAllot> pageBean){
        Doctor loginDoctorUser = doctorService.findByLoginDoctorUser();
        Long doctorId = loginDoctorUser.getId();
        model.addAttribute("title","住院信息");
        model.addAttribute("pageBean",bedAllotService.findByDoctor(pageBean,doctorId));
        return "admin/doctor/bedAllot";
    }
 
 
}

病房管理控制層

/***
 * 病房管理控制層
 */
@Controller
@RequestMapping("/room")
public class RoomController {
    @Autowired
    private RoomService roomService;
    @Autowired
    private OperaterLogService operaterLogService;
    @Autowired
    private BedService bedService;
    @Autowired
    private RoomTypeService roomTypeService;
 
 
    /***
     * 病房分頁查詢
     * @param model
     * @param pageBean
     * @param room
     * @return
     */
    @RequestMapping("/list")
    String list(Model model, PageBean<Room> pageBean, Room room){
        model.addAttribute("title","病房列表");
        model.addAttribute("roomNo", room.getRoomNo());
        model.addAttribute("pageBean",roomService.findAll(room,pageBean));
        return "admin/room/list";
    }
    /**
     * 新增病房頁面
     * @param model
     * @return
     */
    @RequestMapping(value="/add")
    public String add(Model model){
        model.addAttribute("roomType",roomTypeService.findList());
        return "admin/room/add";
    }
 
    /**
     * 病房添加表單提交處理
     * @param room
     * @return
     */
    @RequestMapping(value="/add",method= RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> add(Room room){
        //用統(tǒng)一驗證實體方法驗證是否合法
        CodeMsg validate = ValidateEntityUtil.validate(room);
        if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
            return Result.error(validate);
        }
        //設(shè)置可用床數(shù)
        int total = room.getTotal();
            room.setUsable(total);
        if(Objects.isNull(room.getRoomNo())){
            return Result.error(CodeMsg.ADMIN_ROOM_NO_ISEXIST);
        }
        if(roomService.isExistRoomNo(room.getRoomNo(),0L)){
            return Result.error(CodeMsg.ADMIN_ROOM_EXIST);
        }
        //到這說明一切符合條件,進行數(shù)據(jù)庫新增
        if(roomService.save(room) == null){
            return Result.error(CodeMsg.ADMIN_ROOM_ADD_ERROR);
        }
 
      /*  //判斷是否床位存在
        if(bedService.find(room.getId())!=null){
            return Result.error(CodeMsg.ADMIN_BED_EXIST);
        }*/
        //循環(huán)total向床位表添加相應(yīng)床位
        for (int i = 0 ;i<total ; i++ ){
            Bed bed = new Bed();
            bed.setBedNo(i+1);// 1 2 3 4
            bed.setRoom(room);
            //進行數(shù)據(jù)庫新增
            bedService.save(bed);
        }
        operaterLogService.add("添加病房,病房號:" + room.getRoomNo());
        return Result.success(true);
    }
 
   /* *//**
     * 病房編輯頁面
     * @param model
     * @return
     *//*
    @RequestMapping(value="/edit",method=RequestMethod.GET)
    public String edit(Model model,@RequestParam(name="id",required=true)Long id){
        model.addAttribute("roomType",roomTypeService.findList());
        model.addAttribute("room",roomService.find(id));
        return "admin/room/edit";
    }
    *//**
     * 編輯病房類型信息表單提交處理
     * @param room
     * @return
     *//*
    @RequestMapping(value="/edit",method=RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> edit(Room room){
        //用統(tǒng)一驗證實體方法驗證是否合法
        CodeMsg validate = ValidateEntityUtil.validate(room);
        if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
            return Result.error(validate);
        }
        if(room.getId() == null || room.getId().longValue() <= 0){
            return Result.error(CodeMsg.ADMIN_ROOM_NO_EXIST);
        }
        if(roomService.isExistRoomNo(room.getRoomNo(),room.getId())){
            return Result.error(CodeMsg.ADMIN_ROOM_EXIST);
        }
        //到這說明一切符合條件,進行數(shù)據(jù)庫保存
        Room findById = roomService.find(room.getId());
        //將提交的科室信息指定字段復(fù)制到已存在的RoomType對象中,該方法會覆蓋新字段內(nèi)容
        BeanUtils.copyProperties(room, findById, "id","createTime","updateTime","total","usable");
        if(roomService.save(findById) == null){
            return Result.error(CodeMsg.ADMIN_ROOM_EDIT_ERROR);
        }
        operaterLogService.add("編輯病房,病房號:" + room.getRoomNo());
        return Result.success(true);
    }*/
 
    /**
     * 刪除病房
     * @param id
     * @return
     */
    @RequestMapping(value="/delete",method=RequestMethod.POST)
    @ResponseBody
    public Result<Boolean> delete(@RequestParam(name="id",required=true)Long id){
        try {
            roomService.delete(id);
        } catch (Exception e) {
            return Result.error(CodeMsg.ADMIN_ROOM_DELETE_ERROR);
        }
        operaterLogService.add("刪除病房,病房ID:" + id);
        return Result.success(true);
    }
}

以上就是Java實戰(zhàn)之醫(yī)院管理系統(tǒng)的實現(xiàn)的詳細內(nèi)容,更多關(guān)于Java醫(yī)院管理系統(tǒng)的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評論

东乌珠穆沁旗| 伊吾县| 得荣县| 花莲市| 临朐县| 安庆市| 明光市| 鄱阳县| 青阳县| 河池市| 进贤县| 宜宾市| 米林县| 延津县| 怀宁县| 珲春市| 友谊县| 顺昌县| 兖州市| 砀山县| 祥云县| 黄山市| 图木舒克市| 稻城县| 宁化县| 保山市| 淅川县| 浙江省| 五指山市| 辽中县| 青冈县| 鄢陵县| 革吉县| 营山县| 大荔县| 香港 | 通道| 利川市| 乌什县| 海晏县| 治多县|