mitao
2024-04-30 ab4ea7b8f10c9b66aed9c2ea161a08b25c3851a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.sinata.shop.modular.system.controller;
 
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.sinata.common.enums.EnumIsDelete;
import com.sinata.core.base.controller.BaseController;
import com.sinata.shop.core.common.constant.factory.PageFactory;
import com.sinata.shop.core.log.LogObjectHolder;
import com.sinata.shop.core.shiro.ShiroKit;
import com.sinata.shop.modular.mall.model.AreaCity;
import com.sinata.shop.modular.mall.model.MemMerchant;
import com.sinata.shop.modular.mall.service.IAreaCityService;
import com.sinata.shop.modular.mall.service.IMemMerchantService;
import com.sinata.shop.modular.system.model.MyDoctor;
import com.sinata.shop.modular.system.service.IMyDoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import java.util.List;
 
/**
 * 美牙医生控制器
 * @author goku
 */
@Controller
@RequestMapping("/myDoctor")
public class MyDoctorController extends BaseController {
 
    private String PREFIX = "/system/myDoctor/";
 
    @Autowired
    private IMyDoctorService myDoctorService;
 
    @Autowired
    private IMemMerchantService merchantService;
 
    @Autowired
    private IAreaCityService areaCityService;
 
    /**
     * 跳转到美牙医生首页
     */
    @RequestMapping("")
    public String index(Model model) {
        Wrapper wrapper2 = new EntityWrapper<AreaCity>().orderBy("id", false);
        wrapper2.eq("is_open",1);
        wrapper2.eq("is_delete", EnumIsDelete.EXISTED.index);
        model.addAttribute("cityAreaList",areaCityService.selectList(wrapper2));
        return PREFIX + "myDoctor.html";
    }
 
 
    /**
     * 获取美牙医生列表
     */
    @ResponseBody
    @RequestMapping(value = "/list")
    public Object list(String beginTime, String endTime, String condition,Integer cityId,Integer sex,Integer workTime) {
        Page<MyDoctor> page = new PageFactory().defaultPage();
 
        // 时间搜索
        if(!StrUtil.isEmpty(beginTime)) {
            beginTime  = beginTime + " 00:00:00";
        }
        if(!StrUtil.isEmpty(endTime)) {
            endTime = endTime + " 23:59:59";
        }
 
        // 查询数据列表
        List<MyDoctor> list = myDoctorService.queryMyDoctorList( beginTime,  endTime,  condition,  ShiroKit.getUserId(), sex, workTime,page);
 
        page.setRecords(list);
        return super.packForBT(page);
    }
 
    /**
     * 跳转美牙医生详情
     */
    @RequestMapping(value = "/detail/{myDoctorId}")
    public Object detail(@PathVariable("myDoctorId") Integer myDoctorId, Model model) {
        Page<MemMerchant> page = new PageFactory().defaultPage(999999,0);
        // 查询数据列表
        List<MemMerchant> list = merchantService.queryMerchantList(page,null,  null,  null,  null);
        model.addAttribute("merchantList",list);
        MyDoctor myDoctor = myDoctorService.selectById(myDoctorId);
        model.addAttribute("item",myDoctor);
        Wrapper wrapper2 = new EntityWrapper<AreaCity>().orderBy("id", false);
        wrapper2.eq("is_open",1);
        wrapper2.eq("is_delete", EnumIsDelete.EXISTED.index);
        model.addAttribute("cityAreaList",areaCityService.selectList(wrapper2));
        LogObjectHolder.me().set(myDoctor);
        return PREFIX + "myDoctor_detail.html";
    }
 
}