- 新增百色中学报名记录相关接口和数据模型 - 新增百色中学分部、班级、年代、年级管理接口 - 新增百色中学捐款记录和排行相关接口 - 新增诊所挂号和医生入驻申请接口 - 添加相应的数据传输对象和搜索参数模型 - 实现分页查询、增删改查等基础操作接口 - 集成请求处理和错误处理机制
106 lines
2.4 KiB
TypeScript
106 lines
2.4 KiB
TypeScript
import request from '@/utils/request';
|
|
import type { ApiResult, PageResult } from '@/api';
|
|
import type { ClinicReport, ClinicReportParam } from './model';
|
|
|
|
/**
|
|
* 分页查询报告
|
|
*/
|
|
export async function pageClinicReport(params: ClinicReportParam) {
|
|
const res = await request.get<ApiResult<PageResult<ClinicReport>>>(
|
|
'/clinic/clinic-report/page',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 查询报告列表
|
|
*/
|
|
export async function listClinicReport(params?: ClinicReportParam) {
|
|
const res = await request.get<ApiResult<ClinicReport[]>>(
|
|
'/clinic/clinic-report',
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 添加报告
|
|
*/
|
|
export async function addClinicReport(data: ClinicReport) {
|
|
const res = await request.post<ApiResult<unknown>>(
|
|
'/clinic/clinic-report',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 修改报告
|
|
*/
|
|
export async function updateClinicReport(data: ClinicReport) {
|
|
const res = await request.put<ApiResult<unknown>>(
|
|
'/clinic/clinic-report',
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 删除报告
|
|
*/
|
|
export async function removeClinicReport(id?: number) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
'/clinic/clinic-report/' + id
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 批量删除报告
|
|
*/
|
|
export async function removeBatchClinicReport(data: (number | undefined)[]) {
|
|
const res = await request.delete<ApiResult<unknown>>(
|
|
'/clinic/clinic-report/batch',
|
|
{
|
|
data
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
|
|
/**
|
|
* 根据id查询报告
|
|
*/
|
|
export async function getClinicReport(id: number) {
|
|
const res = await request.get<ApiResult<ClinicReport>>(
|
|
'/clinic/clinic-report/' + id
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|