|
@@ -0,0 +1,77 @@
|
|
|
|
+import { v4 as uuidv4 } from 'uuid';
|
|
|
|
+import { RegisterInfo } from '../../API/patient/workActions';
|
|
|
|
+
|
|
|
|
+interface ExtendedRegisterInfo extends RegisterInfo {
|
|
|
|
+ performed_protocol_code_value: string;
|
|
|
|
+ performed_protocol_code_meaning: string;
|
|
|
|
+ study_description: string;
|
|
|
|
+ reg_source: string;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+enum RegisterSource {
|
|
|
|
+ Local = 'local',
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const emergencyPrefix = 'emergency';
|
|
|
|
+const maxNumber = uuidv4();
|
|
|
|
+const userName = 'defaultUser'; // Placeholder for actual user name from user_info slice
|
|
|
|
+
|
|
|
|
+const generateRegistrationInfo = (): RegisterInfo => {
|
|
|
|
+ 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,
|
|
|
|
+ performed_protocol_code_value: '',
|
|
|
|
+ performed_protocol_code_meaning: '',
|
|
|
|
+ study_description: '',
|
|
|
|
+ views: [],
|
|
|
|
+ patient_size: '',
|
|
|
|
+ patient_age: '',
|
|
|
|
+ patient_dob: '',
|
|
|
|
+ patient_sex: '',
|
|
|
|
+ sex_neutered: '',
|
|
|
|
+ pregnancy_status: '',
|
|
|
|
+ chip_number: '',
|
|
|
|
+ variety: '',
|
|
|
|
+ patient_type: '',
|
|
|
|
+ ref_physician: '',
|
|
|
|
+ modality: '',
|
|
|
|
+ weight: 0,
|
|
|
|
+ thickness: 0,
|
|
|
|
+ length: 0,
|
|
|
|
+ comment: '',
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ // 获取用于急诊的所有procudure
|
|
|
|
+ const procedures = [
|
|
|
|
+ {
|
|
|
|
+ ProcedureCode: 'P123',
|
|
|
|
+ ProcedureDescription: 'Sample Procedure',
|
|
|
|
+ ProcedureName: 'Sample Procedure Name',
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ // 得到急诊procedure下的所有view
|
|
|
|
+
|
|
|
|
+ if (procedures.length > 0) {
|
|
|
|
+ const lastProcedure = procedures[procedures.length - 1];
|
|
|
|
+ work.performed_protocol_code_value = lastProcedure.ProcedureCode;
|
|
|
|
+ work.performed_protocol_code_meaning = lastProcedure.ProcedureCode;
|
|
|
|
+ work.study_description =
|
|
|
|
+ lastProcedure.ProcedureDescription || lastProcedure.ProcedureName;
|
|
|
|
+
|
|
|
|
+ // Placeholder for querying views based on ProcedureCode
|
|
|
|
+ work.views = [
|
|
|
|
+ {
|
|
|
|
+ view_id: 'V123',
|
|
|
|
+ procedure_id: 'P123',
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return work;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+export default generateRegistrationInfo;
|