patient.model.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import type { PeopleModel } from '@/model/people.model';
  2. import type { ReportModel } from '@/model/report.model';
  3. import dayjs from 'dayjs';
  4. export interface PatientQuery {
  5. patientName?: string;
  6. phone?: string;
  7. cardno?: string;
  8. isHaveHealthAnalysisReport?: boolean;
  9. tags?: string[];
  10. count?: number;
  11. }
  12. export interface PatientModel extends PeopleModel {
  13. tags?: string[];
  14. status?: string;
  15. [key: string]: any;
  16. }
  17. export interface EditPatientModel {
  18. patientId:number
  19. name: string;
  20. cardno: string;
  21. age: string;
  22. sex: string;
  23. height: string;
  24. weight: string;
  25. womenSpecialPeriod: string;
  26. foodAllergy: string;
  27. hobbyFlavor: string;
  28. drinkState: string;
  29. smokeState: string;
  30. detailAddress: string;
  31. job: string;
  32. provinceName: string;
  33. provinceCode: string;
  34. cityName: string;
  35. cityCode: string;
  36. areaCode: string;
  37. areaName: string;
  38. updateBy: string;
  39. }
  40. export interface PatientReportModel extends PatientModel {
  41. uid: string;
  42. report: ReportModel;
  43. }
  44. export interface PatientRecordModel extends PatientModel {
  45. recordDate: string;
  46. }
  47. export function transformPatient(data: any): PatientModel {
  48. return {
  49. ...data,
  50. id: data?.patientId ?? '',
  51. name: data?.patientName ?? data?.name ?? '',
  52. gender: data?.sex,
  53. age: data?.age,
  54. tags: data?.tags ?? [],
  55. foodAllergy2: data?.foodAllergy?.replace?.('8:', '') ?? '',
  56. };
  57. }
  58. export function transformPatientRecord(data: any): PatientRecordModel {
  59. return {
  60. ...transformPatient(data),
  61. recordDate: data?.analysisEndTime ?? dayjs(data.createTime).format('YYYY/MM/DD'),
  62. };
  63. }
  64. export interface PatientTagDTO {
  65. id: string;
  66. name: string;
  67. type: PatientTagVO['category'];
  68. status: string;
  69. }
  70. export interface PatientTagVO {
  71. id: string;
  72. name: string;
  73. category: '1' | '2';
  74. disabled?: boolean;
  75. color: string;
  76. }
  77. export function fromPatientTag(data: PatientTagDTO): PatientTagVO {
  78. return {
  79. id: data.id,
  80. name: data.name,
  81. category: data.type,
  82. disabled: data.status === '1',
  83. color: { 1: 'pink', 2: 'blue' }[data.type],
  84. }
  85. }