123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910 |
- /**
- * Mock handlers for date range query testing
- * 用于测试按日期范围查询 study 的功能
- */
- import dayjs from 'dayjs';
- // ============ Aliases ============
- const aliasOfFetchTodayStudies = 'fetchTodayStudies';
- export const FetchTodayStudies = `@${aliasOfFetchTodayStudies}`;
- const aliasOfFetch7DaysStudies = 'fetch7DaysStudies';
- export const Fetch7DaysStudies = `@${aliasOfFetch7DaysStudies}`;
- const aliasOfFetchAllStudies = 'fetchAllStudies';
- export const FetchAllStudies = `@${aliasOfFetchAllStudies}`;
- const aliasOfFetchCustomRangeStudies = 'fetchCustomRangeStudies';
- export const FetchCustomRangeStudies = `@${aliasOfFetchCustomRangeStudies}`;
- const aliasOfFetchEmptyResult = 'fetchEmptyResult';
- export const FetchEmptyResult = `@${aliasOfFetchEmptyResult}`;
- const aliasOfFetchCombinedQuery = 'fetchCombinedQuery';
- export const FetchCombinedQuery = `@${aliasOfFetchCombinedQuery}`;
- // ============ Mock Functions ============
- /**
- * Mock: 查询今天的 study(Worklist)
- */
- export function mockFetchTodayStudiesWorklist() {
- const today = dayjs().format('YYYY-MM-DD');
- cy.intercept('GET', '/dr/api/v1/auth/study*', (req) => {
- const url = new URL(req.url);
- const status = url.searchParams.get('status');
- const startTime = url.searchParams.get('start_time');
- // 只匹配包含今天日期范围的请求
- if (status === 'Arrived,InProgress' && startTime?.includes(today)) {
- req.reply({
- statusCode: 200,
- body: {
- code: '0x000000',
- description: 'Success',
- solution: '',
- data: {
- '@type': 'type.googleapis.com/dr.study.StudyList',
- count: 2,
- studies: [
- {
- study_instance_uid: '2.25.TODAY.001',
- study_id: 'TODAY001',
- public_study_id: '',
- specific_character_set: 'ISO_IR 192',
- accession_number: 'ACC_TODAY_001',
- ref_physician: 'Dr. Wang',
- patient_id: 'PT_TODAY_001',
- patient_name: '今天患者1',
- patient_english_name: 'Today Patient 1',
- patient_former_name: '',
- patient_size: 'Medium',
- other_patient_ids: '',
- other_patient_names: '',
- patient_age: '35Y',
- patient_dob: '1990-01-01T00:00:00Z',
- patient_sex: 'M',
- sex_neutered: '',
- pregnancy_status: '',
- patient_state: '',
- admitting_time: null,
- priority: '',
- reg_source: '',
- study_description: '',
- study_start_datetime: `${today}T08:00:00Z`,
- study_end_datetime: null,
- scheduled_procedure_step_start_date: null,
- performed_physician: '',
- study_lock: 'Unlocked',
- folder_path: '',
- operator_name: 'OP001',
- modality: 'DX',
- weight: 70,
- thickness: 20,
- length: 175,
- patient_type: 'Human',
- study_type: 'Normal',
- owner_name: '',
- chip_number: '',
- variety: '',
- is_anaesthesia: false,
- is_sedation: false,
- mwl: '',
- is_exported: false,
- is_edited: false,
- is_appended: false,
- department: '',
- mapped_status: false,
- qc_result: false,
- comment: '今天的检查1',
- study_status: 'Arrived',
- sort: 0,
- product: 'DROS',
- series: [],
- },
- {
- study_instance_uid: '2.25.TODAY.002',
- study_id: 'TODAY002',
- public_study_id: '',
- specific_character_set: 'ISO_IR 192',
- accession_number: 'ACC_TODAY_002',
- ref_physician: 'Dr. Wang',
- patient_id: 'PT_TODAY_002',
- patient_name: '今天患者2',
- patient_english_name: 'Today Patient 2',
- patient_former_name: '',
- patient_size: 'Medium',
- other_patient_ids: '',
- other_patient_names: '',
- patient_age: '40Y',
- patient_dob: '1985-01-01T00:00:00Z',
- patient_sex: 'F',
- sex_neutered: '',
- pregnancy_status: '',
- patient_state: '',
- admitting_time: null,
- priority: '',
- reg_source: '',
- study_description: '',
- study_start_datetime: `${today}T10:00:00Z`,
- study_end_datetime: null,
- scheduled_procedure_step_start_date: null,
- performed_physician: '',
- study_lock: 'Unlocked',
- folder_path: '',
- operator_name: 'OP002',
- modality: 'DX',
- weight: 65,
- thickness: 18,
- length: 165,
- patient_type: 'Human',
- study_type: 'Normal',
- owner_name: '',
- chip_number: '',
- variety: '',
- is_anaesthesia: false,
- is_sedation: false,
- mwl: '',
- is_exported: false,
- is_edited: false,
- is_appended: false,
- department: '',
- mapped_status: false,
- qc_result: false,
- comment: '今天的检查2',
- study_status: 'InProgress',
- sort: 0,
- product: 'DROS',
- series: [],
- },
- ],
- },
- },
- });
- }
- }).as(aliasOfFetchTodayStudies);
- }
- /**
- * Mock: 查询最近7天的 study(Worklist)
- */
- export function mockFetch7DaysStudiesWorklist() {
- const today = dayjs();
- const sevenDaysAgo = today.subtract(7, 'day');
- cy.intercept('GET', '/dr/api/v1/auth/study*', (req) => {
- const url = new URL(req.url);
- const status = url.searchParams.get('status');
- const startTime = url.searchParams.get('start_time');
- // 只匹配包含7天前日期的请求
- if (
- status === 'Arrived,InProgress' &&
- startTime?.includes(sevenDaysAgo.format('YYYY-MM-DD'))
- ) {
- req.reply({
- statusCode: 200,
- body: {
- code: '0x000000',
- description: 'Success',
- solution: '',
- data: {
- '@type': 'type.googleapis.com/dr.study.StudyList',
- count: 5,
- studies: [
- // 今天
- {
- study_instance_uid: '2.25.7DAYS.001',
- study_id: '7DAYS001',
- patient_name: '7天患者1',
- patient_id: 'PT_7D_001',
- accession_number: 'ACC_7D_001',
- study_start_datetime: today.format('YYYY-MM-DD') + 'T08:00:00Z',
- study_status: 'Arrived',
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- // 3天前
- {
- study_instance_uid: '2.25.7DAYS.002',
- study_id: '7DAYS002',
- patient_name: '7天患者2',
- patient_id: 'PT_7D_002',
- accession_number: 'ACC_7D_002',
- study_start_datetime:
- today.subtract(3, 'day').format('YYYY-MM-DD') + 'T10:00:00Z',
- study_status: 'InProgress',
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- // 5天前
- {
- study_instance_uid: '2.25.7DAYS.003',
- study_id: '7DAYS003',
- patient_name: '7天患者3',
- patient_id: 'PT_7D_003',
- accession_number: 'ACC_7D_003',
- study_start_datetime:
- today.subtract(5, 'day').format('YYYY-MM-DD') + 'T14:00:00Z',
- study_status: 'Arrived',
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- // 6天前
- {
- study_instance_uid: '2.25.7DAYS.004',
- study_id: '7DAYS004',
- patient_name: '7天患者4',
- patient_id: 'PT_7D_004',
- accession_number: 'ACC_7D_004',
- study_start_datetime:
- today.subtract(6, 'day').format('YYYY-MM-DD') + 'T09:00:00Z',
- study_status: 'InProgress',
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- // 7天前
- {
- study_instance_uid: '2.25.7DAYS.005',
- study_id: '7DAYS005',
- patient_name: '7天患者5',
- patient_id: 'PT_7D_005',
- accession_number: 'ACC_7D_005',
- study_start_datetime:
- today.subtract(7, 'day').format('YYYY-MM-DD') + 'T11:00:00Z',
- study_status: 'Arrived',
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- ].map((study) => ({
- ...study,
- specific_character_set: 'ISO_IR 192',
- ref_physician: 'Dr. Li',
- patient_english_name: study.patient_name + ' EN',
- patient_former_name: '',
- patient_size: 'Medium',
- other_patient_ids: '',
- other_patient_names: '',
- patient_age: '35Y',
- patient_dob: '1990-01-01T00:00:00Z',
- patient_sex: 'M',
- sex_neutered: '',
- pregnancy_status: '',
- patient_state: '',
- admitting_time: null,
- priority: '',
- reg_source: '',
- study_description: '',
- study_end_datetime: null,
- scheduled_procedure_step_start_date: null,
- performed_physician: '',
- folder_path: '',
- operator_name: 'OP001',
- weight: 70,
- thickness: 20,
- length: 175,
- study_type: 'Normal',
- owner_name: '',
- chip_number: '',
- variety: '',
- is_anaesthesia: false,
- is_sedation: false,
- mwl: '',
- is_exported: false,
- is_edited: false,
- is_appended: false,
- department: '',
- mapped_status: false,
- qc_result: false,
- comment: '',
- sort: 0,
- public_study_id: '',
- })),
- },
- },
- });
- }
- }).as(aliasOfFetch7DaysStudies);
- }
- /**
- * Mock: 查询所有 study(不限日期)
- */
- export function mockFetchAllStudiesWorklist() {
- cy.intercept('GET', '/dr/api/v1/auth/study*', (req) => {
- const url = new URL(req.url);
- const status = url.searchParams.get('status');
- const startTime = url.searchParams.get('start_time');
- const endTime = url.searchParams.get('end_time');
- // 匹配不包含日期范围参数的请求
- if (status === 'Arrived,InProgress' && !startTime && !endTime) {
- req.reply({
- statusCode: 200,
- body: {
- code: '0x000000',
- description: 'Success',
- solution: '',
- data: {
- '@type': 'type.googleapis.com/dr.study.StudyList',
- count: 10,
- studies: Array.from({ length: 10 }, (_, index) => ({
- study_instance_uid: `2.25.ALL.${String(index + 1).padStart(3, '0')}`,
- study_id: `ALL${String(index + 1).padStart(3, '0')}`,
- public_study_id: '',
- specific_character_set: 'ISO_IR 192',
- accession_number: `ACC_ALL_${String(index + 1).padStart(3, '0')}`,
- ref_physician: 'Dr. Zhang',
- patient_id: `PT_ALL_${String(index + 1).padStart(3, '0')}`,
- patient_name: `所有患者${index + 1}`,
- patient_english_name: `All Patient ${index + 1}`,
- patient_former_name: '',
- patient_size: 'Medium',
- other_patient_ids: '',
- other_patient_names: '',
- patient_age: '35Y',
- patient_dob: '1990-01-01T00:00:00Z',
- patient_sex: index % 2 === 0 ? 'M' : 'F',
- sex_neutered: '',
- pregnancy_status: '',
- patient_state: '',
- admitting_time: null,
- priority: '',
- reg_source: '',
- study_description: '',
- study_start_datetime: dayjs()
- .subtract(index * 2, 'day')
- .format('YYYY-MM-DD') + 'T10:00:00Z',
- study_end_datetime: null,
- scheduled_procedure_step_start_date: null,
- performed_physician: '',
- study_lock: 'Unlocked',
- folder_path: '',
- operator_name: 'OP001',
- modality: 'DX',
- weight: 70,
- thickness: 20,
- length: 175,
- patient_type: 'Human',
- study_type: 'Normal',
- owner_name: '',
- chip_number: '',
- variety: '',
- is_anaesthesia: false,
- is_sedation: false,
- mwl: '',
- is_exported: false,
- is_edited: false,
- is_appended: false,
- department: '',
- mapped_status: false,
- qc_result: false,
- comment: `检查记录${index + 1}`,
- study_status: index % 2 === 0 ? 'Arrived' : 'InProgress',
- sort: 0,
- product: 'DROS',
- series: [],
- })),
- },
- },
- });
- }
- }).as(aliasOfFetchAllStudies);
- }
- /**
- * Mock: 自定义日期范围查询
- */
- export function mockFetchCustomRangeStudies(startDate: string, endDate: string) {
- cy.intercept('GET', '/dr/api/v1/auth/study*', (req) => {
- const url = new URL(req.url);
- const status = url.searchParams.get('status');
- const startTime = url.searchParams.get('start_time');
- // 匹配包含指定日期范围的请求
- if (status && startTime?.includes(startDate)) {
- req.reply({
- statusCode: 200,
- body: {
- code: '0x000000',
- description: 'Success',
- solution: '',
- data: {
- '@type': 'type.googleapis.com/dr.study.StudyList',
- count: 3,
- studies: [
- {
- study_instance_uid: '2.25.CUSTOM.001',
- study_id: 'CUSTOM001',
- patient_name: '自定义范围患者1',
- patient_id: 'PT_CUSTOM_001',
- accession_number: 'ACC_CUSTOM_001',
- study_start_datetime: startDate + 'T08:00:00Z',
- study_status: 'Arrived',
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- {
- study_instance_uid: '2.25.CUSTOM.002',
- study_id: 'CUSTOM002',
- patient_name: '自定义范围患者2',
- patient_id: 'PT_CUSTOM_002',
- accession_number: 'ACC_CUSTOM_002',
- study_start_datetime:
- dayjs(startDate).add(2, 'day').format('YYYY-MM-DD') + 'T10:00:00Z',
- study_status: 'InProgress',
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- {
- study_instance_uid: '2.25.CUSTOM.003',
- study_id: 'CUSTOM003',
- patient_name: '自定义范围患者3',
- patient_id: 'PT_CUSTOM_003',
- accession_number: 'ACC_CUSTOM_003',
- study_start_datetime:
- dayjs(startDate).add(5, 'day').format('YYYY-MM-DD') + 'T14:00:00Z',
- study_status: 'Arrived',
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- ].map((study) => ({
- ...study,
- specific_character_set: 'ISO_IR 192',
- ref_physician: 'Dr. Custom',
- patient_english_name: study.patient_name + ' EN',
- patient_former_name: '',
- patient_size: 'Medium',
- other_patient_ids: '',
- other_patient_names: '',
- patient_age: '35Y',
- patient_dob: '1990-01-01T00:00:00Z',
- patient_sex: 'M',
- sex_neutered: '',
- pregnancy_status: '',
- patient_state: '',
- admitting_time: null,
- priority: '',
- reg_source: '',
- study_description: '',
- study_end_datetime: null,
- scheduled_procedure_step_start_date: null,
- performed_physician: '',
- folder_path: '',
- operator_name: 'OP001',
- weight: 70,
- thickness: 20,
- length: 175,
- study_type: 'Normal',
- owner_name: '',
- chip_number: '',
- variety: '',
- is_anaesthesia: false,
- is_sedation: false,
- mwl: '',
- is_exported: false,
- is_edited: false,
- is_appended: false,
- department: '',
- mapped_status: false,
- qc_result: false,
- comment: '',
- sort: 0,
- public_study_id: '',
- })),
- },
- },
- });
- }
- }).as(aliasOfFetchCustomRangeStudies);
- }
- /**
- * Mock: 空结果(无数据)
- */
- export function mockFetchEmptyResult() {
- cy.intercept('GET', '/dr/api/v1/auth/study*', {
- statusCode: 200,
- body: {
- code: '0x000000',
- description: 'Success',
- solution: '',
- data: {
- '@type': 'type.googleapis.com/dr.study.StudyList',
- count: 0,
- studies: [],
- },
- },
- }).as(aliasOfFetchEmptyResult);
- }
- /**
- * Mock: 组合查询(日期范围 + 患者名称)
- */
- export function mockFetchCombinedQuery() {
- const today = dayjs().format('YYYY-MM-DD');
- cy.intercept('GET', '/dr/api/v1/auth/study*', (req) => {
- const url = new URL(req.url);
- const status = url.searchParams.get('status');
- const startTime = url.searchParams.get('start_time');
- const patientName = url.searchParams.get('patient_name');
- // 匹配包含日期范围和患者名称的请求
- if (status && startTime?.includes(today) && patientName) {
- req.reply({
- statusCode: 200,
- body: {
- code: '0x000000',
- description: 'Success',
- solution: '',
- data: {
- '@type': 'type.googleapis.com/dr.study.StudyList',
- count: 1,
- studies: [
- {
- study_instance_uid: '2.25.COMBINED.001',
- study_id: 'COMBINED001',
- public_study_id: '',
- specific_character_set: 'ISO_IR 192',
- accession_number: 'ACC_COMBINED_001',
- ref_physician: 'Dr. Combined',
- patient_id: 'PT_COMBINED_001',
- patient_name: patientName,
- patient_english_name: patientName + ' EN',
- patient_former_name: '',
- patient_size: 'Medium',
- other_patient_ids: '',
- other_patient_names: '',
- patient_age: '35Y',
- patient_dob: '1990-01-01T00:00:00Z',
- patient_sex: 'M',
- sex_neutered: '',
- pregnancy_status: '',
- patient_state: '',
- admitting_time: null,
- priority: '',
- reg_source: '',
- study_description: '',
- study_start_datetime: today + 'T09:00:00Z',
- study_end_datetime: null,
- scheduled_procedure_step_start_date: null,
- performed_physician: '',
- study_lock: 'Unlocked',
- folder_path: '',
- operator_name: 'OP001',
- modality: 'DX',
- weight: 70,
- thickness: 20,
- length: 175,
- patient_type: 'Human',
- study_type: 'Normal',
- owner_name: '',
- chip_number: '',
- variety: '',
- is_anaesthesia: false,
- is_sedation: false,
- mwl: '',
- is_exported: false,
- is_edited: false,
- is_appended: false,
- department: '',
- mapped_status: false,
- qc_result: false,
- comment: '组合查询结果',
- study_status: 'Arrived',
- sort: 0,
- product: 'DROS',
- series: [],
- },
- ],
- },
- },
- });
- }
- }).as(aliasOfFetchCombinedQuery);
- }
- // ============ History Mock Functions ============
- /**
- * Mock: 查询今天的 study(History - Completed)
- */
- export function mockFetchTodayStudiesHistory() {
- const today = dayjs().format('YYYY-MM-DD');
- cy.intercept('GET', '/dr/api/v1/auth/study*', (req) => {
- const url = new URL(req.url);
- const status = url.searchParams.get('status');
- const startTime = url.searchParams.get('start_time');
- if (status === 'Completed' && startTime?.includes(today)) {
- req.reply({
- statusCode: 200,
- body: {
- code: '0x000000',
- description: 'Success',
- solution: '',
- data: {
- '@type': 'type.googleapis.com/dr.study.StudyList',
- count: 2,
- studies: [
- {
- study_instance_uid: '2.25.HIST.TODAY.001',
- study_id: 'HIST_TODAY001',
- patient_name: 'History今天患者1',
- patient_id: 'PT_HIST_TODAY_001',
- accession_number: 'ACC_HIST_TODAY_001',
- study_start_datetime: today + 'T08:00:00Z',
- study_status: 'Completed',
- is_exported: true,
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- {
- study_instance_uid: '2.25.HIST.TODAY.002',
- study_id: 'HIST_TODAY002',
- patient_name: 'History今天患者2',
- patient_id: 'PT_HIST_TODAY_002',
- accession_number: 'ACC_HIST_TODAY_002',
- study_start_datetime: today + 'T10:00:00Z',
- study_status: 'Completed',
- is_exported: true,
- patient_type: 'Human',
- modality: 'DX',
- study_lock: 'Unlocked',
- product: 'DROS',
- series: [],
- },
- ].map((study) => ({
- ...study,
- specific_character_set: 'ISO_IR 192',
- ref_physician: 'Dr. History',
- patient_english_name: study.patient_name + ' EN',
- patient_former_name: '',
- patient_size: 'Medium',
- other_patient_ids: '',
- other_patient_names: '',
- patient_age: '35Y',
- patient_dob: '1990-01-01T00:00:00Z',
- patient_sex: 'M',
- sex_neutered: '',
- pregnancy_status: '',
- patient_state: '',
- admitting_time: null,
- priority: '',
- reg_source: '',
- study_description: '',
- study_end_datetime: null,
- scheduled_procedure_step_start_date: null,
- performed_physician: '',
- folder_path: '',
- operator_name: 'OP001',
- weight: 70,
- thickness: 20,
- length: 175,
- study_type: 'Normal',
- owner_name: '',
- chip_number: '',
- variety: '',
- is_anaesthesia: false,
- is_sedation: false,
- mwl: '',
- is_edited: false,
- is_appended: false,
- department: '',
- mapped_status: true,
- qc_result: true,
- comment: '',
- sort: 0,
- public_study_id: '',
- })),
- },
- },
- });
- }
- }).as(aliasOfFetchTodayStudies);
- }
- /**
- * Mock: 查询最近7天的 study(History - Completed)
- */
- export function mockFetch7DaysStudiesHistory() {
- const today = dayjs();
- const sevenDaysAgo = today.subtract(7, 'day');
- cy.intercept('GET', '/dr/api/v1/auth/study*', (req) => {
- const url = new URL(req.url);
- const status = url.searchParams.get('status');
- const startTime = url.searchParams.get('start_time');
- if (
- status === 'Completed' &&
- startTime?.includes(sevenDaysAgo.format('YYYY-MM-DD'))
- ) {
- req.reply({
- statusCode: 200,
- body: {
- code: '0x000000',
- description: 'Success',
- solution: '',
- data: {
- '@type': 'type.googleapis.com/dr.study.StudyList',
- count: 4,
- studies: Array.from({ length: 4 }, (_, index) => ({
- study_instance_uid: `2.25.HIST.7DAYS.${String(index + 1).padStart(3, '0')}`,
- study_id: `HIST_7DAYS${String(index + 1).padStart(3, '0')}`,
- public_study_id: '',
- specific_character_set: 'ISO_IR 192',
- accession_number: `ACC_HIST_7D_${String(index + 1).padStart(3, '0')}`,
- ref_physician: 'Dr. History7D',
- patient_id: `PT_HIST_7D_${String(index + 1).padStart(3, '0')}`,
- patient_name: `History7天患者${index + 1}`,
- patient_english_name: `History 7Days Patient ${index + 1}`,
- patient_former_name: '',
- patient_size: 'Medium',
- other_patient_ids: '',
- other_patient_names: '',
- patient_age: '35Y',
- patient_dob: '1990-01-01T00:00:00Z',
- patient_sex: 'M',
- sex_neutered: '',
- pregnancy_status: '',
- patient_state: '',
- admitting_time: null,
- priority: '',
- reg_source: '',
- study_description: '',
- study_start_datetime:
- today.subtract(index + 1, 'day').format('YYYY-MM-DD') + 'T10:00:00Z',
- study_end_datetime: null,
- scheduled_procedure_step_start_date: null,
- performed_physician: '',
- study_lock: 'Unlocked',
- folder_path: '',
- operator_name: 'OP001',
- modality: 'DX',
- weight: 70,
- thickness: 20,
- length: 175,
- study_type: 'Normal',
- owner_name: '',
- chip_number: '',
- variety: '',
- is_anaesthesia: false,
- is_sedation: false,
- mwl: '',
- is_exported: true,
- is_edited: false,
- is_appended: false,
- department: '',
- mapped_status: true,
- qc_result: true,
- comment: '',
- study_status: 'Completed',
- sort: 0,
- product: 'DROS',
- series: [],
- })),
- },
- },
- });
- }
- }).as(aliasOfFetch7DaysStudies);
- }
- /**
- * Mock: 查询所有 study(History - Completed)
- */
- export function mockFetchAllStudiesHistory() {
- cy.intercept('GET', '/dr/api/v1/auth/study*', (req) => {
- const url = new URL(req.url);
- const status = url.searchParams.get('status');
- const startTime = url.searchParams.get('start_time');
- const endTime = url.searchParams.get('end_time');
- // 匹配不包含日期范围参数的请求
- if (status === 'Completed' && !startTime && !endTime) {
- req.reply({
- statusCode: 200,
- body: {
- code: '0x000000',
- description: 'Success',
- solution: '',
- data: {
- '@type': 'type.googleapis.com/dr.study.StudyList',
- count: 8,
- studies: Array.from({ length: 8 }, (_, index) => ({
- study_instance_uid: `2.25.HIST.ALL.${String(index + 1).padStart(3, '0')}`,
- study_id: `HIST_ALL${String(index + 1).padStart(3, '0')}`,
- public_study_id: '',
- specific_character_set: 'ISO_IR 192',
- accession_number: `ACC_HIST_ALL_${String(index + 1).padStart(3, '0')}`,
- ref_physician: 'Dr. HistoryAll',
- patient_id: `PT_HIST_ALL_${String(index + 1).padStart(3, '0')}`,
- patient_name: `History所有患者${index + 1}`,
- patient_english_name: `History All Patient ${index + 1}`,
- patient_former_name: '',
- patient_size: 'Medium',
- other_patient_ids: '',
- other_patient_names: '',
- patient_age: '35Y',
- patient_dob: '1990-01-01T00:00:00Z',
- patient_sex: index % 2 === 0 ? 'M' : 'F',
- sex_neutered: '',
- pregnancy_status: '',
- patient_state: '',
- admitting_time: null,
- priority: '',
- reg_source: '',
- study_description: '',
- study_start_datetime:
- dayjs()
- .subtract(index * 3, 'day')
- .format('YYYY-MM-DD') + 'T10:00:00Z',
- study_end_datetime: null,
- scheduled_procedure_step_start_date: null,
- performed_physician: '',
- study_lock: 'Unlocked',
- folder_path: '',
- operator_name: 'OP001',
- modality: 'DX',
- weight: 70,
- thickness: 20,
- length: 175,
- patient_type: 'Human',
- study_type: 'Normal',
- owner_name: '',
- chip_number: '',
- variety: '',
- is_anaesthesia: false,
- is_sedation: false,
- mwl: '',
- is_exported: true,
- is_edited: false,
- is_appended: false,
- department: '',
- mapped_status: true,
- qc_result: true,
- comment: `History检查记录${index + 1}`,
- study_status: 'Completed',
- sort: 0,
- product: 'DROS',
- series: [],
- })),
- },
- },
- });
- }
- }).as(aliasOfFetchAllStudies);
- }
|