|
@@ -1,5 +1,7 @@
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
import { RegisterInfo } from '../../API/patient/workActions';
|
|
|
+import dayjs from 'dayjs';
|
|
|
+import store from '@/states/store';
|
|
|
|
|
|
interface ExtendedRegisterInfo extends RegisterInfo {
|
|
|
performed_protocol_code_value: string;
|
|
@@ -20,28 +22,33 @@ const userName = 'defaultUser'; // Placeholder for actual user name from user_in
|
|
|
* @returns 生成急诊注册信息
|
|
|
*/
|
|
|
const generateRegistrationInfo = (): RegisterInfo => {
|
|
|
+ // 获取当前产品类型
|
|
|
+ const state = store.getState();
|
|
|
+ const productName = state.product.productName;
|
|
|
+ const isHuman = productName === 'DROS';
|
|
|
+
|
|
|
const work: ExtendedRegisterInfo = {
|
|
|
patient_id: `${emergencyPrefix}_${maxNumber}`,
|
|
|
patient_name: `${emergencyPrefix}_${maxNumber}^^^^`,
|
|
|
reg_source: RegisterSource.Local.toString(),
|
|
|
operator_id: userName,
|
|
|
study_type: 'Emergency',
|
|
|
- accession_number: maxNumber,
|
|
|
+ accession_number: dayjs.utc().format('YYYYMMDDHHmmSS'),
|
|
|
performed_protocol_code_value: '',
|
|
|
performed_protocol_code_meaning: '',
|
|
|
study_description: '',
|
|
|
views: [],
|
|
|
- patient_size: '',
|
|
|
+ patient_size: 'Large',
|
|
|
patient_age: '',
|
|
|
- patient_dob: '',
|
|
|
+ patient_dob: dayjs.utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'),
|
|
|
patient_sex: '',
|
|
|
sex_neutered: '',
|
|
|
pregnancy_status: '',
|
|
|
chip_number: '',
|
|
|
variety: '',
|
|
|
- patient_type: '',
|
|
|
+ patient_type: isHuman ? 'Human' : 'Cat',
|
|
|
ref_physician: '',
|
|
|
- modality: '',
|
|
|
+ modality: 'DX',
|
|
|
weight: 0,
|
|
|
thickness: 0,
|
|
|
length: 0,
|
|
@@ -69,12 +76,26 @@ const generateRegistrationInfo = (): RegisterInfo => {
|
|
|
lastProcedure.ProcedureDescription || lastProcedure.ProcedureName;
|
|
|
|
|
|
// Placeholder for querying views based on ProcedureCode
|
|
|
- work.views = [
|
|
|
- {
|
|
|
- view_id: 'V123',
|
|
|
- procedure_id: 'P123',
|
|
|
- },
|
|
|
- ];
|
|
|
+ // 根据产品类型设置不同的 views
|
|
|
+ if (isHuman) {
|
|
|
+ work.views = [
|
|
|
+ {
|
|
|
+ procedure_id: 'P123',
|
|
|
+ view_id: 'V123',
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ work.views = [
|
|
|
+ {
|
|
|
+ procedure_id: 'P-1501',
|
|
|
+ view_id: 'View_Cat_PV_LAT_01',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ procedure_id: 'P-1501',
|
|
|
+ view_id: 'View_Cat_PV_VD_01',
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return work;
|