patientType.ts 914 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import axiosInstance from './interceptor';
  2. export interface PatientTypeParams {
  3. is_enabled?: string;
  4. }
  5. export interface PatientType {
  6. id: string;
  7. patient_type_id: string;
  8. patient_type_name: string;
  9. patient_type_local: string;
  10. patient_type_description: string;
  11. sort: number;
  12. is_enabled: boolean;
  13. product: string;
  14. is_pre_install: boolean;
  15. }
  16. export interface PatientTypeResponse {
  17. code: string;
  18. description: string;
  19. solution: string;
  20. data: {
  21. patient_type_list: PatientType[];
  22. };
  23. }
  24. export async function fetchPatientTypes(): Promise<PatientType[]> {
  25. const response = await axiosInstance.get('/auth/protocol/patient_type');
  26. // 兼容接口返回结构
  27. if (
  28. response.data &&
  29. response.data.code === '0x000000' &&
  30. response.data.data &&
  31. Array.isArray(response.data.data.patient_type_list)
  32. ) {
  33. return response.data.data.patient_type_list;
  34. }
  35. return [];
  36. }