import requestV2 from "@/utils/request-v2"; import { IPage, Page } from "@/ts-type/Page"; export type searchParams = { searchValue?: string; searchId?: string; } & Page; export interface DiagnoseTemplate { /** * id */ id?: string; /** * 诊断编码 */ diagnoseCode?: string; /** * 对应的是 diagnose_to_req 的id */ templateId?: string; /** * 诊断名称 (not present in database) */ diagnoseName?: string; } export interface DiagnoseReqTemplate { /** * id */ id: string; /** * orderCode */ orderCode: string; /** * orderName (not present in database) */ orderName?: string; /** * 2-检验 -3检查 */ reqType: number; // or more specifically: 2 | -3 if these are the only possible values /** * 执行科室 (execution department) */ execDept: string; /** * 部位或者标本 (part or sample) */ partOrSample: string; /** * 对应的是 diagnose_to_req 的id (corresponds to diagnose_to_req's id) */ templateId: string; } export function createTemplate(name: string) { return requestV2({ url: "/diagnoseJyJcReqTemplate/createTemplate", method: "get", params: { name }, }); } export function getDiagnoseReqTemplateList(data: searchParams) { return requestV2({ url: "/diagnoseJyJcReqTemplate/getDiagnoseReqTemplateList", method: "post", data, }); } export function getTemplateContentById(id: string) { return requestV2<{ id: string; diagnoseList: DiagnoseTemplate[]; reqTemplates: DiagnoseReqTemplate[]; }>({ url: "/diagnoseJyJcReqTemplate/getTemplateContentById", method: "get", params: { id }, }); } export function saveTemplateContent(data: { id: string; diagnoseList: DiagnoseTemplate[]; reqTemplates: DiagnoseReqTemplate[]; }) { return requestV2({ url: "/diagnoseJyJcReqTemplate/saveTemplateContent", method: "post", data, }); } export function delTemplate(id) { return requestV2({ url: "/diagnoseJyJcReqTemplate/delTemplate", method: "get", params: { id }, }); }