|
@@ -29,42 +29,46 @@ const RegisterPage: React.FC = () => {
|
|
|
const [form] = Form.useForm();
|
|
|
const { selectedViews, currentPatientType } = useRegisterState();
|
|
|
|
|
|
- const handleRegister = async () => {
|
|
|
- try {
|
|
|
- let values = form.getFieldsValue();
|
|
|
- const formatDob = values.patient_dob
|
|
|
- ? dayjs.utc(values.patient_dob).format('YYYY-MM-DDTHH:mm:ss.SSS[Z]') //values.patient_dob.toString('YYYY-MM-DD[T00:00:00.000000Z]')
|
|
|
- : '';
|
|
|
- console.log(`转换后的日期:${formatDob}`);
|
|
|
+const handleRegister = async (): Promise<void> => {
|
|
|
+ try {
|
|
|
+ let values = form.getFieldsValue();
|
|
|
+ const formatDob = values.patient_dob
|
|
|
+ ? dayjs.utc(values.patient_dob).format('YYYY-MM-DDTHH:mm:ss.SSS[Z]') //values.patient_dob.toString('YYYY-MM-DD[T00:00:00.000000Z]')
|
|
|
+ : '';
|
|
|
+ console.log(`转换后的日期:${formatDob}`);
|
|
|
|
|
|
- values = { ...values, patient_dob: formatDob };
|
|
|
- console.log(`${JSON.stringify(values, null, 2)}`);
|
|
|
+ values = { ...values, patient_dob: formatDob };
|
|
|
+ console.log(`${JSON.stringify(values, null, 2)}`);
|
|
|
|
|
|
- const validateResult = registerformSchema.safeParse(values);
|
|
|
- if (!validateResult.success) {
|
|
|
- message.error(`必填项未填写或者不合规则`);
|
|
|
- // todo 更详细和人性化的提示
|
|
|
- // message.error(JSON.stringify(validateResult.error, null, 2));
|
|
|
- console.log(JSON.stringify(validateResult.error, null, 2));
|
|
|
+ const validateResult = registerformSchema.safeParse(values);
|
|
|
+ if (!validateResult.success) {
|
|
|
+ message.error(`必填项未填写或者不合规则`);
|
|
|
+ // todo 更详细和人性化的提示
|
|
|
+ // message.error(JSON.stringify(validateResult.error, null, 2));
|
|
|
+ console.log(JSON.stringify(validateResult.error, null, 2));
|
|
|
|
|
|
- return;
|
|
|
- }
|
|
|
- const registerInfo: RegisterInfo = {
|
|
|
- ...values,
|
|
|
- patient_type: currentPatientType?.patient_type_id,
|
|
|
- modality: 'dx',
|
|
|
- study_type: 'Normal',
|
|
|
- views: selectedViews.map((view) => ({
|
|
|
- view_id: view.view_id,
|
|
|
- procedure_id: view.procedure_id,
|
|
|
- })),
|
|
|
- };
|
|
|
- const response = await registerWork(registerInfo);
|
|
|
- console.log('Work registered successfully:', response);
|
|
|
- } catch (error) {
|
|
|
- console.error('Error registering work:', error);
|
|
|
+ return;
|
|
|
}
|
|
|
- };
|
|
|
+ const registerInfo: RegisterInfo = {
|
|
|
+ ...values,
|
|
|
+ patient_type: currentPatientType?.patient_type_id,
|
|
|
+ modality: 'dx',
|
|
|
+ study_type: 'Normal',
|
|
|
+ views: selectedViews.map((view) => ({
|
|
|
+ view_id: view.view_id,
|
|
|
+ procedure_id: view.procedure_id,
|
|
|
+ })),
|
|
|
+ };
|
|
|
+ const response = await registerWork(registerInfo);
|
|
|
+ console.log('Work registered successfully:', response);
|
|
|
+ message.info('Work registered successfully');
|
|
|
+ } catch (error) {
|
|
|
+ console.error('Error registering work:', error);
|
|
|
+ message.error(
|
|
|
+ 'Error registering work, please check the console for details.'
|
|
|
+ );
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
return (
|
|
|
<>
|