|
@@ -1,7 +1,7 @@
|
|
|
import React from 'react';
|
|
|
import { Row, Col, Collapse, Grid, Button, Space, Form, message } from 'antd';
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
-import { useDispatch } from 'react-redux';
|
|
|
+import { useDispatch, useSelector } from 'react-redux';
|
|
|
import { setFormData } from '@/states/patient/register/formSlice';
|
|
|
import BasicInfoForm from './components/register.form';
|
|
|
import SelectedProtocolList from './components/register.selected.view.list';
|
|
@@ -20,6 +20,8 @@ import utc from 'dayjs/plugin/utc';
|
|
|
import { View } from '@/API/patient/viewActions';
|
|
|
import BodyPositionFilter from './components/bodyPositionFilter';
|
|
|
import { omitAnimalSchemaMap } from '@/domain/animalSpecificInfo';
|
|
|
+import { RootState } from '@/states/store';
|
|
|
+import { omitHumanSchemaMap } from '@/domain/humanSpecificInfo';
|
|
|
dayjs.extend(utc);
|
|
|
|
|
|
const { useBreakpoint } = Grid;
|
|
@@ -30,6 +32,9 @@ const RegisterPage: React.FC = () => {
|
|
|
const [form] = Form.useForm();
|
|
|
const dispatch = useDispatch();
|
|
|
const { selectedViews, currentPatientType } = useRegisterState();
|
|
|
+ const productName = useSelector(
|
|
|
+ (state: RootState) => state.product.productName
|
|
|
+ );
|
|
|
|
|
|
const handleRegister = async (): Promise<{
|
|
|
success: boolean;
|
|
@@ -50,8 +55,15 @@ const RegisterPage: React.FC = () => {
|
|
|
|
|
|
values = { ...values, patient_dob: formatDob };
|
|
|
console.log(`${JSON.stringify(values, null, 2)}`);
|
|
|
- const humanSchema = registerformSchema.omit(omitAnimalSchemaMap);
|
|
|
- const validateResult = humanSchema.safeParse(values);
|
|
|
+
|
|
|
+ let validateResult;
|
|
|
+ if (productName === 'VETDROS') {
|
|
|
+ const animalSchema = registerformSchema.omit(omitHumanSchemaMap);
|
|
|
+ validateResult = animalSchema.safeParse(values);
|
|
|
+ } else {
|
|
|
+ const humanSchema = registerformSchema.omit(omitAnimalSchemaMap);
|
|
|
+ validateResult = humanSchema.safeParse(values);
|
|
|
+ }
|
|
|
if (!validateResult.success) {
|
|
|
message.error(`必填项未填写或者不合规则`);
|
|
|
// todo 更详细和人性化的提示
|