import type { PeopleModel } from '@/model/people.model'; import type { ReportModel } from '@/model/report.model'; import dayjs from 'dayjs'; export interface PatientQuery { patientName?: string; phone?: string; cardno?: string; isHaveHealthAnalysisReport?: boolean; tags?: string[]; count?: number; } export interface PatientModel extends PeopleModel { tags?: string[]; status?: string; [key: string]: any; } export interface EditPatientModel { patientId:number name: string; cardno: string; age: string; sex: string; height: string; weight: string; womenSpecialPeriod: string; foodAllergy: string; hobbyFlavor: string; drinkState: string; smokeState: string; detailAddress: string; job: string; provinceName: string; provinceCode: string; cityName: string; cityCode: string; areaCode: string; areaName: string; updateBy: string; } export interface PatientReportModel extends PatientModel { uid: string; report: ReportModel; } export interface PatientRecordModel extends PatientModel { recordDate: string; } export function transformPatient(data: any): PatientModel { return { ...data, id: data?.patientId ?? '', name: data?.patientName ?? data?.name ?? '', gender: data?.sex, age: data?.age, tags: data?.tags ?? [], foodAllergy2: data?.foodAllergy?.replace?.('8:', '') ?? '', }; } export function transformPatientRecord(data: any): PatientRecordModel { return { ...transformPatient(data), recordDate: data?.analysisEndTime ?? dayjs(data.createTime).format('YYYY/MM/DD'), }; } export interface PatientTagDTO { id: string; name: string; type: PatientTagVO['category']; status: string; } export interface PatientTagVO { id: string; name: string; category: '1' | '2'; disabled?: boolean; color: string; } export function fromPatientTag(data: PatientTagDTO): PatientTagVO { return { id: data.id, name: data.name, category: data.type, disabled: data.status === '1', color: { 1: 'pink', 2: 'blue' }[data.type], } }