296 lines
6.3 KiB
TypeScript
296 lines
6.3 KiB
TypeScript
// api/health/chronic.ts
|
|
import request from "@/utils/request";
|
|
|
|
const ChronicAPI = {
|
|
/**
|
|
* 获取慢性疾病列表
|
|
*
|
|
* @returns 慢性疾病列表
|
|
*/
|
|
getChronicDiseases(): Promise<ChronicDiseaseListResult> {
|
|
return request<ChronicDiseaseListResult>({
|
|
url: "/api/v1/health/chronic/diseases",
|
|
method: "GET",
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 添加慢性疾病
|
|
*
|
|
* @param data 疾病数据
|
|
* @returns 疾病信息
|
|
*/
|
|
addChronicDisease(data: ChronicDiseaseData): Promise<ChronicDiseaseResult> {
|
|
return request<ChronicDiseaseResult>({
|
|
url: "/api/v1/health/chronic/diseases",
|
|
method: "POST",
|
|
data: data,
|
|
header: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 更新慢性疾病
|
|
*
|
|
* @param diseaseId 疾病ID
|
|
* @param data 更新数据
|
|
* @returns 疾病信息
|
|
*/
|
|
updateChronicDisease(
|
|
diseaseId: string,
|
|
data: Partial<ChronicDiseaseData>
|
|
): Promise<ChronicDiseaseResult> {
|
|
return request<ChronicDiseaseResult>({
|
|
url: `/api/v1/health/chronic/diseases/${diseaseId}`,
|
|
method: "PUT",
|
|
data: data,
|
|
header: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 记录血糖
|
|
*
|
|
* @param data 血糖数据
|
|
* @returns 血糖记录
|
|
*/
|
|
recordBloodSugar(data: BloodSugarData): Promise<BloodSugarResult> {
|
|
return request<BloodSugarResult>({
|
|
url: "/api/v1/health/chronic/blood-sugar",
|
|
method: "POST",
|
|
data: data,
|
|
header: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 获取血糖记录
|
|
*
|
|
* @param params 查询参数
|
|
* @returns 血糖记录列表
|
|
*/
|
|
getBloodSugarRecords(params: BloodSugarQueryParams): Promise<BloodSugarListResult> {
|
|
return request<BloodSugarListResult>({
|
|
url: "/api/v1/health/chronic/blood-sugar/history",
|
|
method: "GET",
|
|
data: params,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 记录血压
|
|
*
|
|
* @param data 血压数据
|
|
* @returns 血压记录
|
|
*/
|
|
recordBloodPressure(data: BloodPressureData): Promise<BloodPressureResult> {
|
|
return request<BloodPressureResult>({
|
|
url: "/api/v1/health/chronic/blood-pressure",
|
|
method: "POST",
|
|
data: data,
|
|
header: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 获取血压记录
|
|
*
|
|
* @param params 查询参数
|
|
* @returns 血压记录列表
|
|
*/
|
|
getBloodPressureRecords(params: BloodPressureQueryParams): Promise<BloodPressureListResult> {
|
|
return request<BloodPressureListResult>({
|
|
url: "/api/v1/health/chronic/blood-pressure/history",
|
|
method: "GET",
|
|
data: params,
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 获取用药提醒
|
|
*
|
|
* @returns 用药提醒列表
|
|
*/
|
|
getMedicationReminders(): Promise<MedicationReminderListResult> {
|
|
return request<MedicationReminderListResult>({
|
|
url: "/api/v1/health/chronic/medication/reminders",
|
|
method: "GET",
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 更新用药状态
|
|
*
|
|
* @param medicationId 药物ID
|
|
* @param data 状态数据
|
|
*/
|
|
updateMedicationStatus(medicationId: string, data: MedicationStatusData): Promise<void> {
|
|
return request({
|
|
url: `/api/v1/health/chronic/medication/${medicationId}/status`,
|
|
method: "POST",
|
|
data: data,
|
|
header: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
});
|
|
},
|
|
};
|
|
|
|
export default ChronicAPI;
|
|
|
|
/** 慢性疾病数据 */
|
|
export interface ChronicDiseaseData {
|
|
name: string;
|
|
type: "diabetes" | "hypertension" | "heart_disease" | "other";
|
|
diagnosisDate: string;
|
|
severity: "mild" | "moderate" | "severe";
|
|
currentStatus: "stable" | "improving" | "worsening";
|
|
medications: MedicationData[];
|
|
targetValues: Record<string, number>;
|
|
}
|
|
|
|
/** 慢性疾病信息 */
|
|
export interface ChronicDisease {
|
|
id: string;
|
|
name: string;
|
|
type: "diabetes" | "hypertension" | "heart_disease" | "other";
|
|
diagnosisDate: string;
|
|
severity: "mild" | "moderate" | "severe";
|
|
currentStatus: "stable" | "improving" | "worsening";
|
|
medications: Medication[];
|
|
targetValues: Record<string, number>;
|
|
}
|
|
|
|
/** 药物数据 */
|
|
export interface MedicationData {
|
|
name: string;
|
|
type: string;
|
|
dosage: string;
|
|
frequency: string;
|
|
startDate: string;
|
|
endDate?: string;
|
|
reminders: boolean;
|
|
sideEffects?: string[];
|
|
}
|
|
|
|
/** 药物信息 */
|
|
export interface Medication {
|
|
id: string;
|
|
name: string;
|
|
type: string;
|
|
dosage: string;
|
|
frequency: string;
|
|
startDate: string;
|
|
endDate?: string;
|
|
reminders: boolean;
|
|
sideEffects?: string[];
|
|
}
|
|
|
|
/** 慢性疾病列表响应 */
|
|
export interface ChronicDiseaseListResult {
|
|
list: ChronicDisease[];
|
|
}
|
|
|
|
/** 慢性疾病响应 */
|
|
export interface ChronicDiseaseResult {
|
|
disease: ChronicDisease;
|
|
}
|
|
|
|
/** 血糖数据 */
|
|
export interface BloodSugarData {
|
|
value: number;
|
|
measureTime: string;
|
|
mealRelation: "fasting" | "before_meal" | "after_meal" | "bedtime";
|
|
notes?: string;
|
|
}
|
|
|
|
/** 血糖记录 */
|
|
export interface BloodSugarRecord {
|
|
id: string;
|
|
userId: string;
|
|
value: number;
|
|
measureTime: string;
|
|
mealRelation: "fasting" | "before_meal" | "after_meal" | "bedtime";
|
|
notes?: string;
|
|
}
|
|
|
|
/** 血糖响应 */
|
|
export interface BloodSugarResult {
|
|
record: BloodSugarRecord;
|
|
}
|
|
|
|
/** 血糖查询参数 */
|
|
export interface BloodSugarQueryParams {
|
|
startDate?: string;
|
|
endDate?: string;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
/** 血糖列表响应 */
|
|
export interface BloodSugarListResult {
|
|
list: BloodSugarRecord[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
/** 血压数据 */
|
|
export interface BloodPressureData {
|
|
systolic: number;
|
|
diastolic: number;
|
|
heartRate: number;
|
|
measureTime: string;
|
|
notes?: string;
|
|
}
|
|
|
|
/** 血压记录 */
|
|
export interface BloodPressureRecord {
|
|
id: string;
|
|
userId: string;
|
|
systolic: number;
|
|
diastolic: number;
|
|
heartRate: number;
|
|
measureTime: string;
|
|
notes?: string;
|
|
}
|
|
|
|
/** 血压响应 */
|
|
export interface BloodPressureResult {
|
|
record: BloodPressureRecord;
|
|
}
|
|
|
|
/** 血压查询参数 */
|
|
export interface BloodPressureQueryParams {
|
|
startDate?: string;
|
|
endDate?: string;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
/** 血压列表响应 */
|
|
export interface BloodPressureListResult {
|
|
list: BloodPressureRecord[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
/** 用药提醒列表响应 */
|
|
export interface MedicationReminderListResult {
|
|
list: Medication[];
|
|
}
|
|
|
|
/** 用药状态数据 */
|
|
export interface MedicationStatusData {
|
|
taken: boolean;
|
|
}
|