| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- import { type List, type PatientModel, type PatientQuery, type PatientReportModel, type PatientTagModel, transformPatient } from '@/model';
- import request from '@/request/alova';
- import type { PatientTagVO, PatientTagDTO } from '@/model/patient.model';
- import { fromPatientTag } from '@/model/patient.model';
- export function patientsHistoryMethod(page: number, size: number, query?: PatientQuery) {
- return request.Post<List<PatientReportModel>, List<any>>(`/fdhb-pc/patientInfoManage/pageMyPatient`, query ?? {}, {
- params: { pageNum: page, pageSize: size },
- transform(data, headers) {
- return {
- total: data.total,
- data: data.data.map((item: any) =>
- Object.assign(transformPatient(item), {
- report: {
- id: item.healthAnalysisReportId,
- time: item.reportTime,
- },
- createTime: item.createTime,
- })
- ),
- };
- },
- });
- }
- export function appendPatientMethod(data: Record<string, any>) {
- const { disease: diagnosis, date: medicalTime, department: medicalDepartment, doctor: medicalDoctor, tags, ...patient } = data;
- return request.Post(`/fdhb-pc/patientMedicalManage/addPatientMedical`, { ...patient, diagnosis, medicalTime, medicalDepartment, medicalDoctor }, {});
- }
- export function patientsRoomMethod(query?: PatientQuery) {
- return request.Post<PatientReportModel[], any[]>(`/fdhb-pc/patientInfoManage/pendPatient`, query ?? {}, {
- params: {},
- transform(data, headers) {
- return data.map((item: any) =>
- Object.assign(transformPatient(item), {
- uid: item.healthAnalysisReportId,
- report: {
- id: item.healthAnalysisReportId,
- time: item.reportTime,
- },
- createTime: item.createTime,
- })
- );
- },
- cacheFor: 1000,
- });
- }
- export function patientMethod(id: string) {
- return request.Get<PatientModel, any>(`/fdhb-pc/patientInfoManage/getPatientInfoDetailById`, {
- name: 'patient-report',
- params: { patientId: id },
- transform(data, headers) {
- data.patientId ??= id;
- return transformPatient(data);
- },
- });
- }
- /**
- * @deprecated
- * @param id
- */
- export function patientTags(id: string) {
- return request.Get<PatientTagModel, any[]>(`/fdhb-pc/patientInfoManage/getPatientTag`, {
- hitSource: 'update-tags',
- params: { patientId: id },
- transform(data, headers) {
- return {
- id,
- tags: data.map(({ id, name }) => ({ id, name })),
- };
- },
- });
- }
- /**
- * @deprecated
- * @param id
- */
- export function patientTagsMethod(id: string) {
- return request.Get<PatientTagModel['tags'], any[]>(`/fdhb-pc/patientInfoManage/getPatientTag`, {
- hitSource: 'update-tags',
- params: { patientId: id },
- });
- }
- /**
- * @deprecated
- * @param id
- * @param data
- */
- export function updatePatientTagsMethod(id: string, data: string[]) {
- return request.Post(`/fdhb-pc/patientInfoManage/updatePatientTag`, { patientId: id, tagIds: data }, { name: 'update-tags' });
- }
- export function getPatientTagsMethod(id: string) {
- return request.Get<PatientTagVO[], PatientTagDTO[]>(`/fdhb-pc/patientInfoManage/getPatientTag`, {
- hitSource: 'update-tags',
- params: { patientId: id },
- transform(data) {
- return data.map(fromPatientTag);
- },
- });
- }
- export function updatePatientTagMethod(id: string, tags: PatientTagVO[]) {
- const tagIds = tags.map(({ id }) => id);
- return request.Post(
- `/fdhb-pc/patientInfoManage/updatePatientTag`,
- { patientId: id, tagIds },
- {
- name: 'update-tags',
- transform() {
- return tags;
- },
- }
- );
- }
- export function searchTagsFromSelectableMethod() {
- return request.Post<PatientTagVO[], PatientTagDTO[]>(
- `/fdhb-pc/tagManage/selectTag`,
- {},
- {
- hitSource: /tag$/,
- transform(data) {
- return data.map(fromPatientTag);
- },
- }
- );
- }
- export function patientAnalysisCountMethod(id: string) {
- return request.Get(`/fdhb-pc/patientInfoManage/rechargeUseDetail`, {
- hitSource: 'update-analysis-count',
- params: { patientId: id },
- transform(data: any) {
- return {
- total: Math.max(0, data.usedCou),
- count: Math.max(0, data.residuedCou),
- };
- },
- });
- }
- export function updatePatientAnalysisCountMethod(id: string, count: number) {
- return request.Get(`/fdhb-pc/patientInfoManage/rechargeUpdate`, {
- name: 'update-analysis-count',
- params: { patientId: id, residuedCou: count },
- cacheFor: null,
- });
- }
- // 调养
- export function carePatientMethod(id: string) {
- console.log(id, 'carePatientMethod-id');
- return request.Post(`/fdhb-pc/patientInfoManage/conditioning/${id}`, { patientId: id }, {
- transform(data) {
- return data;
- },
- });
- }
|