123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- package com.caimei.controller.auth;
- import com.alibaba.fastjson.JSONObject;
- import com.caimei.model.ResponseJson;
- import com.caimei.model.po.CmBrandDoctorPo;
- import com.caimei.model.vo.DoctorFormVo;
- import com.caimei.model.vo.DoctorListVo;
- import com.caimei.service.auth.DoctorService;
- import com.github.pagehelper.PageInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import java.util.Map;
- /**
- * 供应商API
- *
- * @author : Aslee
- * @date : 2021/5/11
- */
- @Api(tags = "医师API")
- @Slf4j
- @RestController
- @RequiredArgsConstructor
- @RequestMapping("/doctor")
- public class DoctorApi {
- private final DoctorService doctorService;
- @ApiOperation("医师列表")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "listType", required = false, value = "列表类型:1医师列表,2医师审核列表"),
- @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
- @ApiImplicitParam(name = "doctorType", required = false, value = "医师类型:1操作医师,2培训医师"),
- @ApiImplicitParam(name = "doctorName", required = false, value = "医师姓名"),
- @ApiImplicitParam(name = "certificateNo", required = false, value = "从业资格证编号"),
- @ApiImplicitParam(name = "status", required = false, value = "上线状态:0已下线,1已上线,2待上线"),
- @ApiImplicitParam(name = "auditStatus", required = false, value = "审核状态:0审核未通过,1审核通过,2待审核"),
- @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
- @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
- })
- @GetMapping("/list")
- public ResponseJson<PageInfo<DoctorListVo>> getDoctorList(Integer listType, Integer authUserId, Integer doctorType, String doctorName, String certificateNo, Integer status, Integer auditStatus,
- @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
- @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
- return doctorService.getDoctorList(listType, authUserId, doctorType, doctorName, certificateNo, status, auditStatus, pageNum, pageSize);
- }
- /**
- * 更新医师状态
- */
- @ApiOperation("更新医师状态")
- @ApiImplicitParam(name = "params", value = "doctorId:医师id;status:医师状态:0停用 1启用;", required = true)
- @PostMapping("/update/status")
- public ResponseJson updateDoctorStatus(@RequestBody Map<String,Integer> params) {
- Integer doctorId = params.get("doctorId");
- Integer status = params.get("status");
- return doctorService.updateDoctorStatus(doctorId, status);
- }
- /**
- * 删除医师
- */
- @ApiOperation("删除医师")
- @ApiImplicitParam(name = "params", value = "doctorId:医师id", required = true)
- @PostMapping("/delete")
- public ResponseJson deleteDoctor(@RequestBody Map<String,Integer> params) {
- Integer doctorId = params.get("doctorId");
- return doctorService.deleteDoctor(doctorId);
- }
- /**
- * 医师回显数据
- */
- @ApiOperation("医师回显数据")
- @ApiImplicitParam(name = "doctorId", required = true, value = "医师id")
- @GetMapping("/form/data")
- public ResponseJson<DoctorFormVo> getDoctorFormData(Integer doctorId) {
- return doctorService.getDoctorFormData(doctorId);
- }
- /**
- * 添加/编辑医师
- */
- @ApiOperation("添加/编辑医师")
- @ApiImplicitParam(name = "params", value = "doctorId:医师id;authUserId:供应商用户id;authId:机构id;doctorType:医师类型:1操作医师,2培训医师;" +
- "doctorName:医师姓名;" +"certificateNo:从业资格证编号;clubName:所在机构;createBy:创建人id;" +
- "bannerList:轮播图列表;" +"doctorImage:医师照片;equipmentList([{equipmentName:'',brand:'',image:''}]);" +
- "tagList(['标签1','标签2'];" + "paramList([{name:'参数1',content:'内容1'}..]))", required = true)
- @PostMapping("/save")
- public ResponseJson saveDoctor(@RequestBody String params) {
- JSONObject paramsMap = JSONObject.parseObject(params);
- Integer doctorId = paramsMap.getInteger("doctorId");
- Integer authUserId = paramsMap.getInteger("authUserId");
- Integer authId = paramsMap.getInteger("authId");
- Integer doctorType = paramsMap.getInteger("doctorType");
- String doctorName = paramsMap.getString("doctorName");
- String certificateNo = paramsMap.getString("certificateNo");
- String clubName = paramsMap.getString("clubName");
- String doctorImage = paramsMap.getString("doctorImage");
- Integer createBy = paramsMap.getInteger("createBy");
- List<String> bannerList = (List<String>) paramsMap.get("bannerList");
- List<String> tagList = (List<String>) paramsMap.get("tagList");
- List<Map<String,Object>> equipmentList = (List<Map<String,Object>>) paramsMap.get("equipmentList");
- List<Map<String,String>> paramList = (List<Map<String,String>>) paramsMap.get("paramList");
- /*
- 组装医师数据
- */
- CmBrandDoctorPo doctor = new CmBrandDoctorPo();
- doctor.setId(doctorId);
- doctor.setAuthUserId(authUserId);
- doctor.setAuthId(authId);
- doctor.setDoctorType(doctorType);
- doctor.setName(doctorName);
- doctor.setImage(doctorImage);
- doctor.setCertificateNo(certificateNo);
- doctor.setClubName(clubName);
- doctor.setCreateBy(createBy);
- return doctorService.saveDoctor(doctor, bannerList, equipmentList, tagList, paramList);
- }
- /**
- * 审核医师
- */
- @ApiOperation("审核医师")
- @ApiImplicitParam(name = "params", value = "doctorId:医师id;auditStatus:审核状态:0审核未通过,1审核通过,2待审核;invalidReason:审核不通过原因;auditBy:审核人用户id", required = true)
- @PostMapping("/audit")
- public ResponseJson auditDoctor(@RequestBody String params) {
- JSONObject paramsMap = JSONObject.parseObject(params);
- Integer doctorId = paramsMap.getInteger("doctorId");
- Integer auditStatus = paramsMap.getInteger("auditStatus");
- String invalidReason = paramsMap.getString("invalidReason");
- Integer auditBy = paramsMap.getInteger("auditBy");
- return doctorService.auditDoctor(doctorId, auditStatus, invalidReason, auditBy);
- }
- }
|