代码示例

汪靖宁 wangjingning@doc-exam.com开放平台开放平台代码示例大约 9 分钟

代码演示

认证授权
package com.yido.openapi.service;

import cn.hutool.core.lang.Console;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yido.openapi.cache.MockRedis;
import com.yido.openapi.cache.YiDoApi;
import com.yido.openapi.dto.AuthDto;
import com.yido.openapi.response.AuthRes;
import com.yido.openapi.response.R;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;

/**
 * @Desc: 认证授权
 * @Author 汪靖宁
 * @Date 2023/1/4-14:33
 */
@Service
public class AuthService {

    public void getToken(){

        AuthDto auth = new AuthDto();
        auth.setLoginName("18214887435");
        auth.setPassword("123456");

        HttpResponse execute = HttpUtil.createPost(YiDoApi.AUTH_API)
                .contentType(MediaType.APPLICATION_JSON_VALUE)
                .body(JSONUtil.toJsonStr(auth))
                .execute();

        if (execute.isOk()){
            String jsonStr = execute.body();
            R<JSONObject> r = JSONUtil.toBean(jsonStr, R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                AuthRes authRes = r.getData().toBean(AuthRes.class);
                MockRedis.DATA = authRes.getAccessToken();
                Console.log("获取得token:" + MockRedis.DATA);
            }
        }
    }
}

package com.yido.openapi.dto;

import lombok.Data;

/**
 * @Desc: 认证DTO
 * @Author 汪靖宁
 * @Date 2023/1/4-14:35
 */
@Data
public class AuthDto {

    /**
     * 机构账号
     */
    private String loginName;

    /**
     * 机构密码
     */
    private String password;

}

package com.yido.openapi.cache;

/**
 * @Desc: 模拟redis
 * @Author 汪靖宁
 * @Date 2023/1/4-16:06
 */
public class MockRedis {

    /**
     * 正式代码请切换为redis
     */
    public static String DATA = "";

}

package com.yido.openapi.response;

import java.io.Serializable;

/**
 * @Desc: 响应信息主体
 * @Author 汪靖宁
 * @Date 2023/1/4-14:43
 */
public class R<T> implements Serializable {

        private static final long serialVersionUID = 1L;

        /** 成功 */
        public static final int SUCCESS = 200;

        /** 失败 */
        public static final int FAIL = 500;

        private int code;

        private String msg;

        private T data;

        public static <T> R<T> ok()
        {
            return restResult(null, SUCCESS, null);
        }

        public static <T> R<T> ok(T data)
        {
            return restResult(data, SUCCESS, null);
        }

        public static <T> R<T> ok(T data, String msg)
        {
            return restResult(data, SUCCESS, msg);
        }

        public static <T> R<T> fail()
        {
            return restResult(null, FAIL, null);
        }

        public static <T> R<T> fail(String msg)
        {
            return restResult(null, FAIL, msg);
        }

        public static <T> R<T> fail(T data)
        {
            return restResult(data, FAIL, null);
        }

        public static <T> R<T> fail(T data, String msg)
        {
            return restResult(data, FAIL, msg);
        }

        public static <T> R<T> fail(int code, String msg)
        {
            return restResult(null, code, msg);
        }

        private static <T> R<T> restResult(T data, int code, String msg)
        {
            R<T> apiResult = new R<>();
            apiResult.setCode(code);
            apiResult.setData(data);
            apiResult.setMsg(msg);
            return apiResult;
        }

        public int getCode()
        {
            return code;
        }

        public void setCode(int code)
        {
            this.code = code;
        }

        public String getMsg()
        {
            return msg;
        }

        public void setMsg(String msg)
        {
            this.msg = msg;
        }

        public T getData()
        {
            return data;
        }

        public void setData(T data)
        {
            this.data = data;
        }

        public static boolean isSuccess(R r) {
        return r.getCode() == SUCCESS;
    }
}

职称列表
package com.yido.openapi.service;

import cn.hutool.core.lang.Console;
import cn.hutool.core.lang.ConsoleTable;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.ContentType;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yido.openapi.cache.MockRedis;
import com.yido.openapi.cache.YiDoApi;
import com.yido.openapi.response.JobRes;
import com.yido.openapi.response.R;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.List;

/**
 * @Desc: 职称
 * @Author 汪靖宁
 * @Date 2023/1/4-16:08
 */
@Service
public class JobService {


    /**
     * 获取职称列表
     */
    public void getJobs(){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA),"token不能为空");

        HttpResponse execute = HttpUtil.createGet(YiDoApi.JOB_API)
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.FORM_URLENCODED.getValue())
                .header("platform", "exy_tenant_mgmt")
                .execute();

        if (execute.isOk()){
            String jsonStr = execute.body();
            R<JSONArray> r = JSONUtil.toBean(jsonStr, R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONArray jsonArray = r.getData();
                List<JobRes> jobRes = jsonArray.toList(JobRes.class);
                ConsoleTable consoleTable = new ConsoleTable();
                consoleTable.addHeader("职称ID","职称类型","职称名子");
                jobRes.forEach(item -> {
                    consoleTable.addBody(item.getJobTitleId().toString(),item.getJobTitleType(),item.getTitle());
                });
                Console.table(consoleTable);
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

}

package com.yido.openapi.response;

import lombok.Data;

/**
 * @Desc: 职称响应体
 * @Author 汪靖宁
 * @Date 2023/1/4-16:10
 */
@Data
public class JobRes {

    /**
     * 职称ID
     */
    private Integer jobTitleId;

    /**
     * 职称类型
     */
    private String jobTitleType;

    /**
     * 职称名子
     */
    private String title;
}

科室列表
package com.yido.openapi.service;

import cn.hutool.core.lang.Console;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.ContentType;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.yido.openapi.cache.MockRedis;
import com.yido.openapi.cache.YiDoApi;
import com.yido.openapi.response.R;
import com.yido.openapi.response.SpecialtiesRes;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.List;

/**
 * @Desc: 科室
 * @Author 汪靖宁
 * @Date 2023/1/4-16:09
 */
@Service
public class SpecialtiesService {


    /**
     * 科室列表
     */
    public void getSpecialties(){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA),"token不能为空");

        HttpResponse execute = HttpUtil.createGet(YiDoApi.SPECIALTIES_API)
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.FORM_URLENCODED.getValue())
                .header("platform", "exy_tenant_mgmt")
                .execute();

        if (execute.isOk()){
            String jsonStr = execute.body();
            R<JSONArray> r = JSONUtil.toBean(jsonStr, R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONArray jsonArray = r.getData();
                List<SpecialtiesRes> specialtiesRes = jsonArray.toList(SpecialtiesRes.class);
                specialtiesRes.forEach(Console::log);
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }
}

package com.yido.openapi.response;

import lombok.Data;

import java.util.List;

/**
 * @Desc: 科室响应体
 * @Author 汪靖宁
 * @Date 2023/1/4-16:10
 */
@Data
public class SpecialtiesRes {

    /**
     * 科室ID
     */
    private Integer id;

    /**
     * 科室名
     */
    private String name;

    /**
     * 子科室
     */
    private List<SpecialtiesRes> children;

}

医生接口
package com.yido.openapi.service;

import cn.hutool.core.lang.Console;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.ContentType;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yido.openapi.cache.MockRedis;
import com.yido.openapi.cache.YiDoApi;
import com.yido.openapi.dto.DoctorDto;
import com.yido.openapi.response.R;

import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

/**
 * @Desc: 医生
 * @Author 汪靖宁
 * @Date 2023/1/4-16:09
 */
@Service
public class DoctorService {

    /**
     * 新增医生
     */
    public void addDoctor() {

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA), "token不能为空");

        DoctorDto doctorDto = new DoctorDto();
        doctorDto.setAvatar("http://yidong-dev.oss-cn-shanghai.aliyuncs.com/ExyTenant/operate/图片3.jpg");
        doctorDto.setName("大大汪同志");
        doctorDto.setPhone("17314887435");
        doctorDto.setGender("MALE");
        doctorDto.setIdCard("340833199122335544");
        doctorDto.setAddress("上海");
        doctorDto.setSchool("上海大学");
        doctorDto.setEducation("DOCTORATE");
        doctorDto.setGoodAt("擅长");
        doctorDto.setEmployer("医东");
        doctorDto.setSpecialtiesId("1");
        doctorDto.setJobTitleId("1");
        doctorDto.setEducationTitle("PROFESSOR");
        doctorDto.setIdCardFrontPic("http://yidong-dev.oss-cn-shanghai.aliyuncs.com/ExyTenant/operate/图片3.jpg");
        doctorDto.setCertificatePic("http://yidong-dev.oss-cn-shanghai.aliyuncs.com/ExyTenant/operate/图片3.jpg");
        doctorDto.setIntroduction("简介");
        doctorDto.setDoctorCode("12121212");

        HttpResponse execute = HttpUtil.createPost(YiDoApi.ADD_DOCTOR_API)
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.JSON.getValue())
                .header("platform", "exy_tenant_mgmt")
                .body(JSONUtil.toJsonStr(doctorDto))
                .execute();

        if (execute.isOk()){
            R<JSONObject> r = JSONUtil.toBean(execute.body(), R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONObject jsonObject = r.getData();
                Console.log(jsonObject.getRaw());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

    /**
     * 编辑医生
     */
    public void editDoctor() {

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA), "token不能为空");

        DoctorDto doctorDto = new DoctorDto();
        doctorDto.setAvatar("http://yidong-dev.oss-cn-shanghai.aliyuncs.com/ExyTenant/operate/图片3.jpg");
        doctorDto.setName("大大汪同志");
        doctorDto.setPhone("17414887435");
        doctorDto.setGender("MALE");
        doctorDto.setIdCard("340833199122335544");
        doctorDto.setAddress("上海");
        doctorDto.setSchool("上海大学");
        doctorDto.setEducation("DOCTORATE");
        doctorDto.setGoodAt("擅长11");
        doctorDto.setEmployer("医东");
        doctorDto.setSpecialtiesId("1");
        doctorDto.setJobTitleId("1");
        doctorDto.setEducationTitle("PROFESSOR");
        doctorDto.setIdCardFrontPic("http://yidong-dev.oss-cn-shanghai.aliyuncs.com/ExyTenant/operate/图片3.jpg");
        doctorDto.setCertificatePic("http://yidong-dev.oss-cn-shanghai.aliyuncs.com/ExyTenant/operate/图片3.jpg");
        doctorDto.setIntroduction("简介");
        HttpResponse execute = HttpUtil.createRequest(Method.PUT,String.format(YiDoApi.EDIT_DOCTOR_API,"9498"))
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.JSON.getValue())
                .header("platform", "exy_tenant_mgmt")
                .body(JSONUtil.toJsonStr(doctorDto))
                .execute();

        if (execute.isOk()){
            R<JSONObject> r = JSONUtil.toBean(execute.body(), R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONObject jsonObject = r.getData();
                Console.log(jsonObject.getRaw());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

    /**
     * 查询医生接口
     */
    public void getDoctor() {

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA), "token不能为空");

        HttpResponse execute = HttpUtil.createGet(String.format(YiDoApi.INFO_DOCTOR_API,"9498"))
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.FORM_URLENCODED.getValue())
                .header("platform", "exy_tenant_mgmt")
                .execute();

        if (execute.isOk()){
            R<JSONObject> r = JSONUtil.toBean(execute.body(), R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONObject jsonObject = r.getData();
                Console.log(jsonObject.getRaw());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

}


package com.yido.openapi.dto;

import lombok.Data;

@Data
public class DoctorDto {

    private String address;
    private String avatar;
    private String certificatePic;
    private String education;
    private String educationTitle;
    private String employer;
    private String gender;
    private String goodAt;
    private String idCard;
    private String idCardFrontPic;
    private String introduction;
    private String jobTitleId;
    private String jobTitlePic;
    private String licensePic;
    private String name;
    private String phone;
    private String school;
    private String sort;
    private String specialtiesId;
    private String doctorCode;
}

挂号相关接口
package com.yido.openapi.service;

import cn.hutool.core.lang.Console;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.ContentType;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yido.openapi.cache.MockRedis;
import com.yido.openapi.cache.YiDoApi;
import com.yido.openapi.response.R;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.*;

/**
 * @Desc: 挂号
 * @Author 汪靖宁
 * @Date 2023/1/6-15:44
 */
@Service
public class RegisterService {

    /**
     * 挂号列表接口
     */
    public void getRegister(){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA),"token不能为空");

        Map<String, Object> map = new HashMap<>();
        map.put("page",0);
        map.put("size",10);
        map.put("doctorId",37700);

        HttpResponse execute = HttpUtil.createGet(YiDoApi.REGISTER_API)
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.FORM_URLENCODED.getValue())
                .header("platform", "exy_tenant_mgmt")
                .form(map)
                .execute();

        if (execute.isOk()){
            String jsonStr = execute.body();
            R<JSONObject> r = JSONUtil.toBean(jsonStr, R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONObject jsonObject = r.getData();
                Console.log(jsonObject.getRaw());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

    /**
     * 创建医生挂号信息接口
     */
    public void addRegister(){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA),"token不能为空");

        Map<String,Object> map = new HashMap<>();
        map.put("doctorId",37700);
        map.put("medicalInsurancePrice",3000);
        map.put("personalPrice",1000);
        map.put("place","上海");
        map.put("stock",10);
        map.put("type","自费");

        HttpResponse execute = HttpUtil.createPost(YiDoApi.ADD_REGISTER_API)
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.JSON.getValue())
                .header("platform", "exy_tenant_mgmt")
                .body(JSONUtil.toJsonStr(map))
                .execute();

        if (execute.isOk()){
            String jsonStr = execute.body();
            R<JSONObject> r = JSONUtil.toBean(jsonStr, R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONObject jsonObject = r.getData();
                Console.log(jsonObject.getRaw());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

    /**
     * 编辑医生挂号信息接口
     */
    public void editRegister(String id){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA),"token不能为空");

        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("medicalInsurancePrice",30001);
        map.put("personalPrice",10001);
        map.put("place","上海1");
        map.put("stock",101);
        map.put("type","自费");

        HttpResponse execute = HttpUtil.createRequest(Method.PUT,String.format(YiDoApi.EDIT_REGISTER_API,id))
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.JSON.getValue())
                .header("platform", "exy_tenant_mgmt")
                .body(JSONUtil.toJsonStr(map))
                .execute();

        if (execute.isOk()){
            String jsonStr = execute.body();
            R<JSONObject> r = JSONUtil.toBean(jsonStr, R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONObject jsonObject = r.getData();
                Console.log(jsonObject.getRaw());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

    /**
     * 查看单个挂号信息
     */
    public void infoRegister(String id){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA),"token不能为空");

        HttpResponse execute = HttpUtil.createGet(String.format(YiDoApi.INFO_REGISTER_API,id))
                .bearerAuth(MockRedis.DATA)
                .header("platform", "exy_tenant_mgmt")
                .execute();

        if (execute.isOk()){
            String jsonStr = execute.body();
            R<JSONObject> r = JSONUtil.toBean(jsonStr, R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONObject jsonObject = r.getData();
                Console.log(jsonObject.getRaw());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }


    /**
     * 批量删除挂号信息
     */
    public void delRegister(String id){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA),"token不能为空");


        List<String> ids = new ArrayList<>();
        ids.add(id);

        HttpResponse execute = HttpUtil.createRequest(Method.DELETE,YiDoApi.DEL_BATCH_REGISTER_API)
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.JSON.getValue())
                .header("platform", "exy_tenant_mgmt")
                .body(JSONUtil.toJsonStr(ids))
                .execute();

        if (execute.isOk()){
            String jsonStr = execute.body();
            R<Boolean> r = JSONUtil.toBean(jsonStr, R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                Console.log(r.getData());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

}

挂号相关接口
package com.yido.openapi.service;

import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.ContentType;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yido.openapi.cache.MockRedis;
import com.yido.openapi.cache.YiDoApi;
import com.yido.openapi.response.R;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Desc: 排班
 * @Author 汪靖宁
 * @Date 2023/1/6-14:58
 */
@Service
public class HospitalService {

    /**
     * 工作时间列表接口地址
     */
    public void getWorkTime(){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA), "token不能为空");

        HttpResponse execute = HttpUtil.createGet(YiDoApi.WORK_TIME_API)
                .bearerAuth(MockRedis.DATA)
                .header("platform", "exy_tenant_mgmt")
                .execute();

        if (execute.isOk()){
            R<JSONArray> r = JSONUtil.toBean(execute.body(), R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                JSONArray jsonArray = r.getData();
                jsonArray.forEach(item -> {
                    Console.log(item.toString());
                });
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

    /**
     * 批量创建医生排班接口地址
     */
    public void batchAddHospital(){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA), "token不能为空");

        List<Map<String,Object>> list = new ArrayList<>();
        Map<String,Object> map = new HashMap<>();
        map.put("doctorRegisterId",598);
        map.put("schedulingDate","2022-12-31");
        map.put("workPeriodId",602);
        map.put("stock","10");
        map.put("place","上海");

        Map<String,Object> map1 = new HashMap<>();
        map1.put("doctorRegisterId",598);
        map1.put("schedulingDate","2022-12-30");
        map1.put("workPeriodId",602);
        map1.put("stock","10");
        map1.put("place","上海");

        list.add(map1);
        list.add(map);

        HttpResponse execute = HttpUtil.createPost(YiDoApi.BATCH_ADD_SCHEDULING_API)
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.JSON.getValue())
                .header("platform", "exy_tenant_mgmt")
                .body(JSONUtil.toJsonStr(list))
                .execute();

        if (execute.isOk()){
            R<Boolean> r = JSONUtil.toBean(execute.body(), R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                Console.log(r.getData());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

    /**
     * 获取排班信息列表接口
     */
    public void infoListHospital(){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA), "token不能为空");

        Map<String,Object> map = new HashMap<>();
        map.put("page",0);
        map.put("size",10);
        map.put("sort","SCHEDULING_TIME_DESC");

        HttpResponse execute = HttpUtil.createGet(YiDoApi.INFO_SCHEDULING_LIST_API)
                .bearerAuth(MockRedis.DATA)
                .header("platform", "exy_tenant_mgmt")
                .form(map)
                .execute();

        if (execute.isOk()){
            R<JSONObject> r = JSONUtil.toBean(execute.body(), R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                Console.log(r.getData().getRaw());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }


    /**
     * 删除医生排班接口
     */
    public void delHospital(String id){

        Assert.isTrue(StrUtil.isNotEmpty(MockRedis.DATA), "token不能为空");

        Map<String,Object> map = new HashMap<>();
        List<String> ids = ListUtil.of(id);
        map.put("ids",ids);

        HttpResponse execute = HttpUtil.createRequest(Method.DELETE,YiDoApi.DEL_SCHEDULING_API)
                .bearerAuth(MockRedis.DATA)
                .contentType(ContentType.JSON.getValue())
                .header("platform", "exy_tenant_mgmt")
                .body(JSONUtil.toJsonStr(map))
                .execute();

        if (execute.isOk()){
            R<Boolean> r = JSONUtil.toBean(execute.body(), R.class);
            if (R.FAIL == r.getCode()){
                Console.error(r.getMsg());
            }else {
                Console.log(r.getData());
            }
        }
        if (execute.getStatus() == 401){
            // 重新登录缓存token

        }
    }

}

接口列表
package com.yido.openapi.cache;

/**
 * @Desc: 医东API常量
 * @Author 汪靖宁
 * @Date 2023/1/4-14:41
 */
public interface YiDoApi {

    /**
     * 认证授权接口
     */
//    String AUTH_API = "http://localhost:8080/user/v1/auth/open/access-token";
    String AUTH_API = "https://cloud-dev.yixiecloud.com/user/v1/auth/open/access-token";
    /**
     * 职称列表接口
     */
//    String JOB_API = "http://localhost:8080/organization/v1/org/open/job/title/items?jobTitleType=MEDICAL_ORG";
    String JOB_API = "https://cloud-dev.yixiecloud.com/organization/v1/org/open/job/title/items?jobTitleType=MEDICAL_ORG";
    /**
     * 科室列表接口
     */
//    String SPECIALTIES_API = "http://localhost:8080/organization/v1/org/open/specialties/items";
    String SPECIALTIES_API = "https://cloud-dev.yixiecloud.com/organization/v1/org/open/specialties/items";
    /**
     * 新增医生接口
     */
    String ADD_DOCTOR_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/member/open";
//    String ADD_DOCTOR_API = "http://localhost:8080/organization/v1/admin/member/open";
    /**
     * 编辑医生接口
     */
    String EDIT_DOCTOR_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/member/open/%s";
    /**
     * 查询医生接口
     */
    String INFO_DOCTOR_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/member/open/%s";
    /**
     * 工作时间列表接口地址
     */
    String WORK_TIME_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/hospital/work/period/open/list";
    /**
     * 批量创建医生排班接口地址
     */
    String BATCH_ADD_SCHEDULING_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/doctor/scheduling/open/batch/add";
    /**
     * 获取排班信息列表接口
     */
    String INFO_SCHEDULING_LIST_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/doctor/scheduling/open/item";
    /**
     * 删除医生排班接口
     */
    String DEL_SCHEDULING_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/doctor/scheduling/open";
    /**
     * 挂号列表接口
     */
    String REGISTER_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/doctor/register/open/item";
    /**
     * 创建医生挂号信息接口
     */
    String ADD_REGISTER_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/doctor/register/open";
    /**
     * 编辑医生挂号信息接口
     */
    String EDIT_REGISTER_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/doctor/register/open/update/%s";
    /**
     * 查看单个挂号信息
     */
    String INFO_REGISTER_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/doctor/register/open/%s";
    /**
     * 批量删除挂号信息
     */
    String DEL_BATCH_REGISTER_API = "https://cloud-dev.yixiecloud.com/organization/v1/admin/doctor/register/open";
}