源码获取:俺的博客首页 "资源" 里下载!
项目介绍
基于Springboot+vue社区医院信息平台
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
技术栈
后端:SpringBoot+Mybaits
前端:Vue + elementui
使用说明
项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入地址:
前台地址:http://localhost:8080/springbootrpj39/front/index.html
后台地址
http://localhost:8080/springbootrpj39/admin/dist/index.html
管理员 abo 密码 abo
用户:用户1 密码: 123456
注意项目文件路径中不能含有中文、空格、特殊字符等,否则图片会上传不成功。
医院管理控制层:
@Controller
public class HospitalController {
@Autowired
private HospitalService hospitalService;
@Autowired
private OfficeService officeService;
@Autowired
private PageUtils pageUtils;
@Autowired
private FavouriteDao favouriteDao;
/**
* 医院主界面(推荐医院)
*
* @return
*/
@RequestMapping(value = "/hosIndex", method = RequestMethod.GET)
public String hosIdex(Model model) {
List<Hospital> hospitalRe = hospitalService.findHosByRe();
model.addAttribute("hospital", hospitalRe);
return "hospital/hosIndex";
}
/**
* 医院详情
*
* @return
*/
@RequestMapping(value = "/hosInfoShow/{id}", method = RequestMethod.GET)
public String hosInfoShow(Model model, @PathVariable(value = "id") int id,HttpSession session) {
if(session.getAttribute("userInfo") != null){
//如果用户登录
CommonUser commonUser = (CommonUser) session.getAttribute("userInfo");
int isLike = 0;
if(favouriteDao.findFavByuserIdAndHosId(commonUser.getUserId(), id) !=null){
isLike = favouriteDao.findFavByuserIdAndHosId(commonUser.getUserId(), id).getIsLike();
}
model.addAttribute("isLike", isLike);
}
// 通过传入的id返回医院的详细信息
Hospital hospital = hospitalService.findHosById(id);
// 通过医院的名称返回医院科室信息
List<Office> office = officeService.findOfficeByHosName(hospital.getHospitalName());
// 预留通知查询
model.addAttribute("hos", hospital);
model.addAttribute("office", office);
return "hospital/hosInfoShow";
}
/**
* 全部支持预约的医院
*
* @return
*/
@RequestMapping(value = "/orderHos/{page}")
public String orderHos(Model model, @PathVariable("page") int page, @ModelAttribute("province") String province,
@ModelAttribute("city") String city, @ModelAttribute("district") String district, Hospital hosp) {
// 将输入条件传回前台
CommonCondition commonCondition = new CommonCondition();
commonCondition.setProvince(province);
commonCondition.setCity(city);
commonCondition.setDistrict(district);
commonCondition.setHospitalName(hosp.getHospitalName());
commonCondition.setHospitalGrade(hosp.getHospitalGrade());
commonCondition.setHospitalNature(hosp.getHospitalNature());
// 设置页面
pageUtils.setCurrentPage(page);
pageUtils.setTotalRecord(hospitalService.findOrderHosNum(province, city, district, hosp));
int start;
if (pageUtils.getCurrentPage() == 0) {
start = 0;
} else {
start = pageUtils.getPageRecord() * (pageUtils.getCurrentPage() - 1);
}
// 查询医院数据
List<Hospital> hospital = hospitalService.findHosByConditon(province, city, district, hosp, start,
pageUtils.getPageRecord());
// 查询医院等级
List<String> hospGrade = hospitalService.findHosOpenGrade();
// 查询医院类型
List<String> hospNature = hospitalService.findHosOpenNature();
model.addAttribute("hospital", hospital);
model.addAttribute("pages", pageUtils);
model.addAttribute("hospGrade", hospGrade);
model.addAttribute("hospNature", hospNature);
// 查询条件
model.addAttribute("commonCondition", commonCondition);
return "hospital/orderHos";
}
/**
* 全部的医院
*
* @return
*/
@RequestMapping(value = "/allHos/{page}")
public String allHos(Model model, @PathVariable("page") int page, @ModelAttribute("province") String province,
@ModelAttribute("city") String city, @ModelAttribute("district") String district, Hospital hosp) {
// 将输入条件传回前台
CommonCondition commonCondition = new CommonCondition();
commonCondition.setProvince(province);
commonCondition.setCity(city);
commonCondition.setDistrict(district);
commonCondition.setHospitalName(hosp.getHospitalName());
commonCondition.setHospitalGrade(hosp.getHospitalGrade());
commonCondition.setHospitalNature(hosp.getHospitalNature());
// 设置页面
pageUtils.setCurrentPage(page);
pageUtils.setTotalRecord(hospitalService.findAllHosNum(province, city, district, hosp));
int start;
if (pageUtils.getCurrentPage() == 0) {
start = 0;
} else {
start = pageUtils.getPageRecord() * (pageUtils.getCurrentPage() - 1);
}
// 查询医院数据
List<Hospital> hospital = hospitalService.findAllHosByConditon(province, city, district, hosp, start,
pageUtils.getPageRecord());
// 查询医院等级
List<String> hospGrade = hospitalService.findHosGrade();
// 查询医院类型
List<String> hospNature = hospitalService.findHosNature();
model.addAttribute("hospital", hospital);
model.addAttribute("pages", pageUtils);
model.addAttribute("hospGrade", hospGrade);
model.addAttribute("hospNature", hospNature);
// 查询条件
model.addAttribute("commonCondition", commonCondition);
return "hospital/allHospital";
}
//关注医院
@ResponseBody
@RequestMapping(value = "/favourite", method = RequestMethod.POST)
public Map<String, Object> favourite(Model model,int hospitalId,HttpSession session ) {
//通过session信息得到userid
CommonUser commonUser = (CommonUser) session.getAttribute("userInfo");
int userId = commonUser.getUserId();
int isLike =hospitalService.favourite(userId, hospitalId);
System.out.println(isLike+"*******************************88");
Map<String, Object> rtnMap = new HashMap<String, Object>();
rtnMap.put("isLike", isLike);
return rtnMap;
}
}
医生管理控制层:
@Controller
public class DoctorController {
@Autowired
private DoctorService doctorService;
@Autowired
private HospitalService hospitalService;
@Autowired
private PageUtils pageUtils;
/**
* 医生主界面(推荐医生)
*
* @return
*/
@RequestMapping(value = "/doctorIndex/{page}")
public String officeIdex(Model model, @PathVariable("page") int page) {
// 查询推荐的医院
List<Hospital> hospitalRe = hospitalService.findHosByRe();
// 设置页面
pageUtils.setCurrentPage(page);
pageUtils.setTotalRecord(doctorService.findDoctorByReNum(hospitalRe));
int start;
if (pageUtils.getCurrentPage() == 0) {
start = 0;
} else {
start = pageUtils.getPageRecord() * (pageUtils.getCurrentPage() - 1);
}
Map<String, Object> doctorMap = new HashMap<String, Object>();
doctorMap.put("list", hospitalRe);
doctorMap.put("start", start);
doctorMap.put("size", pageUtils.getPageRecord());
List<Doctor> doctorRe = doctorService.findDoctorByRe(doctorMap);
model.addAttribute("pages", pageUtils);
model.addAttribute("doctorRe", doctorRe);
return "doctor/doctorIndex";
}
/**
* 医生详情
*
* @return
*/
@RequestMapping(value = "/doctorInfoShow/{id}", method = RequestMethod.GET)
public String hosInfoShow(Model model, @PathVariable(value = "id") int id) {
Doctor doctor = doctorService.findDoctorById(id);
Hospital hospital = hospitalService.findHosByName(doctor.getHospitalName());
model.addAttribute("hos", hospital);
model.addAttribute("doctor", doctor);
return "doctor/doctorInfoShow";
}
/**
* 全部医生
*
* @return
*/
@RequestMapping(value = "/allDoctor/{page}")
public String orderOffcie(Model model, @PathVariable("page") int page, Doctor doctor) {
// 将输入条件传回前台
CommonCondition commonCondition = new CommonCondition();
commonCondition.setHospitalName(doctor.getHospitalName());
commonCondition.setOfficesName(doctor.getOfficesName());
commonCondition.setDoctorName(doctor.getDoctorName());
commonCondition.setDoctorTitle(doctor.getDoctorTitle());
commonCondition.setDoctorDegree(doctor.getDoctorDegree());
commonCondition.setDoctorAdministrative(doctor.getDoctorAdministrative());
pageUtils.setCurrentPage(page);
pageUtils.setTotalRecord(doctorService.findDoctorNum(doctor));
int start;
if (pageUtils.getCurrentPage() == 0) {
start = 0;
} else {
start = pageUtils.getPageRecord() * (pageUtils.getCurrentPage() - 1);
}
List<Doctor> doctorRe = doctorService.findDoctorByCondition(doctor, start, pageUtils.getPageRecord());
// 查询医生的职位
List<String> doctorTitle = doctorService.findDoctorTitle();
List<String> doctorAdministrative = doctorService.findDoctorAdministrative();
List<String> doctorDegree = doctorService.findDoctorDegree();
model.addAttribute("pages", pageUtils);
model.addAttribute("doctorRe", doctorRe);
// 查询条件
model.addAttribute("commonCondition", commonCondition);
// 将查询的医生职称传到前台
model.addAttribute("doctorTitle", doctorTitle);
model.addAttribute("doctorAdministrative", doctorAdministrative);
model.addAttribute("doctorDegree", doctorDegree);
return "doctor/doctor";
}
}
科室管理控制层:
@Controller
public class OfficeController {
@Autowired
private HospitalService hospitalService;
@Autowired
private OfficeService officeService;
@Autowired
private PageUtils pageUtils;
@Autowired
private DoctorService doctorService;
/**
* 科室主界面(推荐科室)
*
* @return
*/
@RequestMapping(value = "/officeIndex/{page}")
public String officeIdex(Model model, @PathVariable("page") int page) {
// 查询推荐的医院
List<Hospital> hospitalRe = hospitalService.findHosByRe();
// 设置页面
pageUtils.setCurrentPage(page);
pageUtils.setTotalRecord(officeService.findOfficeByReNum(hospitalRe));
int start;
if (pageUtils.getCurrentPage() == 0) {
start = 0;
} else {
start = pageUtils.getPageRecord() * (pageUtils.getCurrentPage() - 1);
}
Map<String, Object> officeMap = new HashMap<String, Object>();
officeMap.put("list", hospitalRe);
officeMap.put("start", start);
officeMap.put("size", 20);
List<Office> officeRe = officeService.findOfficeByRe(officeMap);
model.addAttribute("pages", pageUtils);
model.addAttribute("officeRe", officeRe);
return "office/officeIndex";
}
/**
* 科室详情
*
* @return
*/
@RequestMapping(value = "/officeInfoShow/{id}", method = RequestMethod.GET)
public String hosInfoShow(Model model, @PathVariable(value = "id") int id) {
Office office = officeService.findOfficeById(id);
Hospital hospital = hospitalService.findHosByName(office.getHospitalName());
List<Doctor> doctor = doctorService.findAreaByHosAndOfficeName(office.getHospitalName(),
office.getOfficesName());
model.addAttribute("office", office);
model.addAttribute("hos", hospital);
model.addAttribute("doctor", doctor);
return "office/officeInfoShow";
}
/**
* 全部科室
*
* @return
*/
@RequestMapping(value = "/orderOffice/{page}")
public String orderOffcie(Model model, @PathVariable("page") int page, @ModelAttribute("province") String province,
@ModelAttribute("city") String city, @ModelAttribute("district") String district, Office office) {
// 将输入条件传回前台
CommonCondition commonCondition = new CommonCondition();
commonCondition.setHospitalName(office.getHospitalName());
commonCondition.setOfficesName(office.getOfficesName());
// 设置页面
pageUtils.setCurrentPage(page);
pageUtils.setTotalRecord(officeService.findOrderOfficeNum(office));
int start;
if (pageUtils.getCurrentPage() == 0) {
start = 0;
} else {
start = pageUtils.getPageRecord() * (pageUtils.getCurrentPage() - 1);
}
List<Office> officeRe = officeService.findOfficeByConditon(office, start, 20);
model.addAttribute("pages", pageUtils);
model.addAttribute("officeRe", officeRe);
// 查询条件
model.addAttribute("commonCondition", commonCondition);
return "office/orderOffice";
}
}
公告管理控制层:
@Controller
public class NoticeController {
@Autowired
private NoticeService noticeService;
@Autowired
private PageUtils pageUtils;
/**
* 公告首页
*
* @return
*/
@RequestMapping(value = "/noticeIndex/{page}")
public String noticeIndex(Model model, @PathVariable("page") int page) {
// 设置页面
pageUtils.setCurrentPage(page);
pageUtils.setTotalRecord(noticeService.findNoticeByTypeNum());
int start;
if (pageUtils.getCurrentPage() == 0) {
start = 0;
} else {
start = pageUtils.getPageRecord() * (pageUtils.getCurrentPage() - 1);
}
// 查询所有通知
List<Notice> notice = noticeService.findNoticeByType(start, pageUtils.getPageRecord());
System.out.println("*******************************************");
model.addAttribute("notice", notice);
model.addAttribute("pages", pageUtils);
return "notice/noticeIndex";
}
/**
* 通知详情
*
* @return
*/
@RequestMapping(value = "/noticeInfo/{id}", method = RequestMethod.GET)
public String hosInfoShow(Model model, @PathVariable(value = "id") int id) {
Notice notice = noticeService.findNoticeById(id);
model.addAttribute("notice", notice);
return "notice/noticeInfo";
}
}
源码获取:俺的博客首页 "资源" 里下载!