Files
gzh-server/src/main/java/com/guahao/api/walkinto/controller/WalkintoController.java
2026-01-07 10:36:02 +08:00

337 lines
11 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.guahao.api.walkinto.controller;
import com.guahao.api.carousel.service.CarouselService;
import com.guahao.api.charge.service.ChargeService;
import com.guahao.api.charge.service.ChargeTypeService;
import com.guahao.api.guide.service.GuideLabelService;
import com.guahao.api.info.model.HospitalInfo;
import com.guahao.api.info.service.HospitalInfoService;
import com.guahao.api.information.service.InformationService;
import com.guahao.api.inspect.service.InspectService;
import com.guahao.api.inspect.service.InspectSubscribeService;
import com.guahao.api.inspect.service.InspectTypeService;
import com.guahao.api.medicine.service.MedicineDoctorService;
import com.guahao.api.medicine.service.MedicineService;
import com.guahao.api.medicine.service.MedicineTypeService;
import com.guahao.api.walkinto.service.BillService;
import com.guahao.common.base.PageBean;
import com.guahao.common.response.ErrorCode;
import com.guahao.common.response.ResponseResult;
import com.guahao.h5.token.service.TokenService;
import com.guahao.h5.token.vo.TokenVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/walkinto")
public class WalkintoController {
private Logger log = LoggerFactory.getLogger(WalkintoController.class);
@Autowired
private CarouselService carouselService;
@Autowired
private InformationService informationService;
@Autowired
private MedicineDoctorService doctorService;
@Autowired
private MedicineService medicineService;
@Autowired
private MedicineTypeService medicineTypeService;
@Autowired
private ChargeTypeService chargeTypeService;
@Autowired
private HospitalInfoService hospitalInfoService;
@Autowired
private ChargeService chargeService;
@Autowired
private GuideLabelService labelService;
@Autowired
private InspectService inspectService;
@Autowired
private InspectTypeService inspectTypeService;
@Autowired
private InspectSubscribeService subscribeService;
@Autowired
private BillService billService;
@Autowired
private TokenService tokenService;
/**
* 医疗服务接口
* @return
*/
@RequestMapping("/home")
public Object home(){
try{
Map<String,Object> map=new HashMap<String,Object>();
//轮播图
List<Map<String,Object>> clist=carouselService.getList(1,5,1);
map.put("carousel",clist);
//健康咨询
List<Map<String,Object>> jklist=informationService.getList(1,10,"",1).getData();
map.put("jiankang",jklist);
return ResponseResult.success(map);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 医疗服务查询医生和科室
* @param name
* @return
*/
@RequestMapping("/selysks")
public Object selYsAndKs(@RequestParam(value="name",required = false)String name){
try{
Map<String,Object> map=new HashMap<String,Object>();
List<Map<String,Object>> yslist = doctorService.getList(1,20,0,name);
map.put("ys",yslist);
List<Map<String,Object>> kslist = medicineService.getList(1,20,0,name);
map.put("ks",kslist);
return ResponseResult.success(map);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 查询科室分类
* @return
*/
@RequestMapping(value="/getksfl",method = RequestMethod.POST)
public Object getksfl(){
try{
List<Map<String,Object>> list = medicineTypeService.getList(1,99999,"");
return ResponseResult.success(list);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 查询科室详情
* @param id 科室id
* @return
*/
@RequestMapping(value="/getksinfo",method = RequestMethod.POST)
public Object getksinfo(@RequestParam("id") int id){
try{
Map<String,Object> medicine = medicineService.getinfo(id);
List<Map<String,Object>> yslist = doctorService.getList(1,20,id,"");
medicine.put("ys",yslist);
return ResponseResult.success(medicine);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 查询走进医院
* @return
*/
@RequestMapping(value="/getzjyy",method = RequestMethod.POST)
public Object getzjyy(){
try{
Map<String,Object> map=new HashMap<String,Object>();
//医院详情
HospitalInfo hi = hospitalInfoService.getinfo();
Map<String,Object> info=new HashMap<String,Object>();
info.put("name",hi.name);
info.put("img",hi.img);
info.put("logo",hi.logo);
info.put("address",hi.address);
info.put("label",hi.label);
info.put("tel",hi.tel);
map.put("info",info);
//医生
List<Map<String,Object>> yslist = doctorService.getList(1,8,0,"");
map.put("ys",yslist);
//科室
List<Map<String,Object>> kslist = medicineService.getList(1,8,0,"");
map.put("ks",kslist);
//医院动态
List<Map<String,Object>> dtlist=informationService.getList(1,10,"",3).getData();
map.put("dt",dtlist);
//收费项目
List<Map<String,Object>> xmlist = chargeService.getList(1,8,0,"");
map.put("xm",xmlist);
return ResponseResult.success(map);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 查询收费项目分类
* @return
*/
@RequestMapping(value="/getxmfl",method = RequestMethod.POST)
public Object getxmfl(){
try{
List<Map<String,Object>> list = chargeTypeService.getList(1,99999,"");
return ResponseResult.success(list);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 查询医院导视
* @return
*/
@RequestMapping(value="/getguide",method = RequestMethod.POST)
public Object getGuide(){
try{
List<Map<String,Object>> list = labelService.getGuide();
return ResponseResult.success(list);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 体检首页查询接口
* @return
*/
@RequestMapping("/inspecthome")
public Object inspecthome(){
try{
Map<String,Object> map=new HashMap<String,Object>();
//轮播图
List<Map<String,Object>> clist=carouselService.getList(1,5,2);
map.put("carousel",clist);
//健康咨询
List<Map<String,Object>> tjlist=inspectService.getList(1,10,0,"").getData();
map.put("tijian",tjlist);
return ResponseResult.success(map);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 查询体检分类
* @return
*/
@RequestMapping(value="/gettjfl",method = RequestMethod.POST)
public Object gettjfl(){
try{
List<Map<String,Object>> list = inspectTypeService.getList(1,99999,"");
return ResponseResult.success(list);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 查询体检套餐详情
*
* @return
*/
@RequestMapping(value="/gettjinfo",method = RequestMethod.POST)
public Object gettjinfo(@RequestParam("id") int id){
try{
Map<String,Object> map = inspectService.getinfo(id);
List<Map<String,Object>> list =subscribeService.getresource(id,new SimpleDateFormat("yyyy-MM").format(new Date()));
map.put("num",list);
return ResponseResult.success(map);
}catch (Exception e){
log.error(e.getLocalizedMessage());
return ResponseResult.sysError(e.getLocalizedMessage());
}
}
/**
* 分页查询账单记录
*
* @param page 当前页数
* @param pagesize 每页显示条数
* @param uid 用户id
* @param type 查询类型0、全部 1、当日 2、当月 3当年
* @return
*/
@RequestMapping(value="/getbill",method = RequestMethod.POST)
public Object getAdminList(@RequestParam("page") int page,
@RequestParam("pagesize") int pagesize,
@RequestParam("userId")Integer uid,
@RequestParam("token")String token,
@RequestParam(value = "time",required = false)Integer type){
try{
int retToken = getUserToken(uid, token);
if (retToken == 0) {
return ResponseResult.sysLoginError();
}
PageBean<Map<String,Object>> pageBean = billService.getlist(page,pagesize,uid,type);
return pageBean;
}catch (Exception e){
log.error(e.getLocalizedMessage());
return new PageBean<>(null, ErrorCode.EXCEPTION_SYS);
}
}
/**
* token验证
*/
private int getUserToken(Integer userId, String token) throws Exception {
TokenVo tokenVo = new TokenVo(userId, token);
int result = tokenService.getUserToken(tokenVo);
return result;
}
}