zlisen 4 år sedan
förälder
incheckning
94de4291b4

+ 1
- 1
src/pages/Medical/Test/List/index.jsx Visa fil

@@ -101,7 +101,7 @@ const VisitList = () => {
101 101
         request={queryTable('/testLog')}
102 102
         formRef={ref}
103 103
         rowKey="serialNo"
104
-        headerTitle="就诊列表"
104
+        headerTitle="体检列表"
105 105
         search={{
106 106
           labelWidth: '4em',
107 107
         }}

+ 100
- 78
src/pages/Medical/Visit/Edit/index.jsx Visa fil

@@ -1,51 +1,59 @@
1
-import React, { useState } from 'react';
1
+import React, { useEffect, useState } from 'react';
2 2
 import { connect, history } from 'umi';
3 3
 import ProCard from '@ant-design/pro-card';
4 4
 import { PageContainer } from '@ant-design/pro-layout';
5 5
 import Container from '@/components/Container';
6
-import { Input, Select, Form, Button } from 'antd';
6
+import { Input, Select, Form, Button, notification } from 'antd';
7 7
 import ProForm, { ProFormText, ProFormTextArea, ProFormSelect } from '@ant-design/pro-form';
8 8
 import request from '@/utils/request';
9 9
 
10 10
 const { Option } = Select;
11 11
 const { Search } = Input;
12
-const VisitEdit = () => {
12
+const VisitEdit = (props) => {
13
+  const { id, schoolId } = props.location.query;
13 14
   const [list, setList] = useState([]);
14 15
   const [searchLoading, setSearchLoading] = useState(false);
15 16
 
16 17
   const [form] = Form.useForm();
17
-  // state = {
18
-  //   data: [],
19
-  //   value: undefined,
20
-  // };
21 18
 
22
-  // const changeStatus = (hospital) => {
23
-  //   // 0 变 1, 1 变 0
24
-  //   // eslint-disable-next-line no-bitwise
25
-  //   const status = hospital.status ^ 1;
26
-  //   const data = { ...hospital, status }
27
-
28
-  //   request(`/hospital/${hospital.hospitalId}`, {
29
-  //     method: 'put',
30
-  //     data,
31
-  //   })
32
-  //     .then(() => {
33
-  //       tableRef.current.reload();
34
-  //       notification.success({ message: '操作成功' });
35
-  //     })
36
-  //     .catch((e) => {
37
-  //       notification.error({ message: e.message });
38
-  //     });
19
+  const getData = (id) => {
20
+    if (id) {
21
+      request(`/student/${id}`)
22
+        .then((res) => {
23
+          console.log(res, 'res');
24
+          form.setFieldsValue(res);
25
+          setSearchLoading(false);
26
+        })
27
+        .catch((e) => {
28
+          setSearchLoading(false);
29
+        });
30
+    } else {
31
+      // this.setState({ data: [] });
32
+    }
33
+  };
39 34
 
40
-  // };
35
+  useEffect(()=>{
36
+if(id){
37
+  if (id) {
38
+    request(`/medical-log/${id}`)
39
+      .then((res) => {
40
+        console.log(res, 'res');
41
+        form.setFieldsValue(res);
42
+        setSearchLoading(false);
43
+      })
44
+      .catch((e) => {
45
+        setSearchLoading(false);
46
+      });
47
+  } else {
48
+    // this.setState({ data: [] });
49
+  }
50
+}
51
+  },[id])
41 52
 
42 53
   const onSearch = (value) => {
43 54
     if (value) {
44
-      request(`/student/${value}`)
45
-        .then((res) => {
46
-          form.setFieldsValue(res)
47
-        })
48
-        .catch((e) => {});
55
+      getData(value);
56
+      setSearchLoading(true);
49 57
     } else {
50 58
       // this.setState({ data: [] });
51 59
     }
@@ -56,6 +64,16 @@ const VisitEdit = () => {
56 64
   };
57 65
   const handleSubmit = (value) => {
58 66
     // this.setState({ value });
67
+    console.log(value, 'handleSubmit');
68
+    request('/medicalLog', { method: 'post', data: {schoolId, ...value } })
69
+    .then(() => {
70
+
71
+      notification.success({ message: '新建成功' });
72
+      history.go('-1')
73
+    })
74
+    .catch((e) => {
75
+      notification.error({ message: e.message });
76
+    });
59 77
   };
60 78
   return (
61 79
     <PageContainer
@@ -68,87 +86,91 @@ const VisitEdit = () => {
68 86
       }}
69 87
     >
70 88
       <Container>
71
-        <ProForm form={form} onFinish={handleSubmit}>
89
+        <ProForm form={form} submitter={!id} onFinish={handleSubmit}>
72 90
           <ProCard.Group title="就诊信息" bodyStyle={{ padding: 20 }}>
73
-            <Search
74
-              placeholder="请输入学号"
75
-              loading={searchLoading}
76
-              style={{ width: 200 }}
77
-              onSearch={onSearch}
78
-            />
91
+            {!id && (
92
+              <Search
93
+                placeholder="请输入学号"
94
+                loading={searchLoading}
95
+                style={{ width: 200, marginBottom: '20px' }}
96
+                onSearch={onSearch}
97
+              />
98
+            )}
79 99
 
80 100
             <ProFormText
81 101
               label="姓名"
82 102
               placeholder="输入名称"
83 103
               name="name"
104
+              fieldProps={{ bordered: !id, readOnly: !!id }}
84 105
               rules={[{ required: true, message: '请填写名称' }]}
85 106
             />
86 107
 
87 108
             <ProFormSelect
88 109
               options={[
89 110
                 {
90
-                  value: '6',
91
-                  label: '6%',
111
+                  value: 1,
112
+                  label: '',
92 113
                 },
93 114
                 {
94
-                  value: '12',
95
-                  label: '12%',
115
+                  value: 2,
116
+                  label: '',
96 117
                 },
97 118
               ]}
98
-              initialValue="6"
99
-              name="taxRate"
119
+              name="sex"
100 120
               label="性别"
121
+              fieldProps={{ bordered: !id, open: id ? false : undefined }}
122
+              rules={[{ required: true, message: '请选择性别' }]}
101 123
             />
102 124
 
103 125
             <ProFormText
104 126
               label="学号"
105
-              placeholder="输入名称"
106
-              name="name"
107
-              rules={[{ required: true, message: '请填写名称' }]}
127
+              placeholder="输入学号"
128
+              name="studentId"
129
+              fieldProps={{ bordered: !id, readOnly: !!id }}
130
+              rules={[{ required: true, message: '请填写学号' }]}
108 131
             />
109 132
 
110 133
             <ProFormText
111 134
               label="联系方式"
112
-              placeholder="输入名称"
113
-              name="name"
114
-              rules={[{ required: true, message: '请填写名称' }]}
135
+              placeholder="输入联系方式"
136
+              name="phone"
137
+              fieldProps={{ bordered: !id, readOnly: !!id }}
138
+              rules={[{ required: true, message: '请填写联系方式' }]}
115 139
             />
116
-
117
-            {/* {list.map((d) => (
118
-              <Option key={d.value}>{d.text}</Option>
119
-            ))} */}
120
-            {/* {options} */}
121
-
122
-            {/* <ProFormSelect
123
-                options={[
124
-                  {
125
-                    value: '6',
126
-                    label: '6%',
127
-                  },
128
-                  {
129
-                    value: '12',
130
-                    label: '12%',
131
-                  },
132
-                ]}
133
-                initialValue="6"
134
-                width="xs"
135
-                name="taxRate"
136
-                label="税率"
137
-              /> */}
138 140
           </ProCard.Group>
139 141
           <ProCard.Group title="诊断" bodyStyle={{ padding: 20 }}>
140
-            <ProFormText
142
+            <ProFormSelect
141 143
               label="就诊科室"
142
-              placeholder="输入名称"
143
-              name="name"
144
-              rules={[{ required: true, message: '请填写名称' }]}
144
+              placeholder="输选择"
145
+              name="hospitalId"
146
+              fieldProps={{ bordered: !id, open: id ? false : undefined }}
147
+              request={async ({ keyWords }) => {
148
+                // console.log()
149
+                // if (keyWords) {
150
+                return request('/hospital', {
151
+                  method: 'get',
152
+                  params: { name: keyWords, schoolId, pageNum: 1, pageSize: 1000 },
153
+                })
154
+                  .then((res) => {
155
+                    return res?.records?.map((x) => {
156
+                      return { label: x.name, value: x.hospitalId };
157
+                    });
158
+                  })
159
+                  .catch((e) => {
160
+                    return Promise.reject(e.message);
161
+                  });
162
+                // }
163
+              }}
164
+              rules={[{ required: true, message: '请选择科室' }]}
145 165
             />
146 166
 
147 167
             <ProFormTextArea
148 168
               label="诊断报告"
149
-              placeholder="输入简介"
150
-              name="desc"
151
-              rules={[{ required: true, message: '请填写简介' }]}
169
+              placeholder="输入诊断报告"
170
+              name="attchment"
171
+             
172
+              fieldProps={{readOnly: !!id }}
173
+              rules={[{ required: true, message: '请填写诊断报告' }]}
152 174
             />
153 175
           </ProCard.Group>
154 176
         </ProForm>

+ 35
- 8
src/pages/Medical/Visit/List/index.jsx Visa fil

@@ -1,24 +1,49 @@
1
-import React, { useRef, useCallback } from 'react';
1
+import React, { useRef,useState, useCallback } from 'react';
2 2
 import { connect, history } from 'umi';
3 3
 import { PageContainer } from '@ant-design/pro-layout';
4 4
 import ProTable from '@ant-design/pro-table';
5 5
 import { PlusOutlined } from '@ant-design/icons';
6 6
 import { Button,  Space } from 'antd';
7 7
 import  { queryTable } from '@/utils/request';
8
+import School from '@/components/School';
8 9
 
9 10
 const VisitList = () => {
10 11
 
11 12
 
12 13
   const ref = useRef();
13
-  const handleMedicalClick = useCallback((id) => {
14
-    history.push(id ? `/medical/visit/edit?id=${id}` : '/medical/visit/edit');
15
-  }, []);
14
+  const [school, setSchool] = useState({});
15
+
16
+  const handleMedicalClick = (id) => {
17
+    console.log(school,'school')
18
+    history.push(id ? `/medical/visit/edit?id=${id}&schoolId=${school?.schoolId}` : `/medical/visit/edit?schoolId=${school?.schoolId}`);
19
+  }
16 20
 
17 21
   const actions = [   
18 22
     <Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => handleMedicalClick()}>
19 23
       新建
20 24
     </Button>,
21 25
   ];
26
+
27
+  const queryFunc = (params, page, sort, filter) => {
28
+    if (!school.schoolId) {
29
+      return Promise.resolve({ data: [], success: true, total: 0 });
30
+    }
31
+    console.log(school,'queryFunc')
32
+    const newParams = { ...params, schoolId: school.schoolId };
33
+    return queryTable('/medicalLog')(newParams, page, sort, filter);
34
+  };
35
+
36
+  const renderFormItem = (item, config, form) => {
37
+    const handleSchoolChange = (schoolId, schoolInfo) => {
38
+      form.setFieldsValue({ schoolId });
39
+      form.submit();
40
+      console.log(schoolInfo,'schoolInfo')
41
+      setSchool({...schoolInfo});
42
+    };
43
+
44
+    return <School onChange={handleSchoolChange} />;
45
+  };
46
+
22 47
   const columns = [
23 48
     {
24 49
       title: '就诊编号',
@@ -28,9 +53,11 @@ const VisitList = () => {
28 53
       align: 'center',
29 54
     },
30 55
     {
31
-      title: '学校名称',
32
-      dataIndex: 'schoolName',
33
-      align: 'center',
56
+      title: '所属学校',
57
+      key: 'schoolId',
58
+      dataIndex: 'schoolId',
59
+      valueType: 'select',
60
+      renderFormItem,
34 61
     },
35 62
 
36 63
     {
@@ -98,7 +125,7 @@ const VisitList = () => {
98 125
     <PageContainer>
99 126
       <ProTable
100 127
         columns={columns}
101
-        request={queryTable('/medicalLog')}
128
+        request={queryFunc}
102 129
         formRef={ref}
103 130
         rowKey="serialNo"
104 131
         headerTitle="就诊列表"

+ 1
- 1
src/pages/Student/School/Edit/Specialty.jsx Visa fil

@@ -115,7 +115,7 @@ const Specialty = (props) => {
115 115
         actionRef={ref}
116 116
         search={false}
117 117
         rowKey="specialtyId"
118
-        // headerTitle="专业列表"
118
+        headerTitle={props.data.name}
119 119
 
120 120
         toolBarRender={() => actions}
121 121
       />

+ 4
- 4
src/pages/Student/Student/Edit/index.jsx Visa fil

@@ -34,12 +34,12 @@ const BannerEdit = (props) => {
34 34
         </div>
35 35
 
36 36
         <Card bordered={false}>
37
-          <div style={{ display: 'flex' }}>
37
+          {/* <div style={{ display: 'flex' }}>
38 38
             <div>
39 39
               <Image src={data.avatar} width={200}></Image>
40
-            </div>
40
+            </div> */}
41 41
 
42
-            <Descriptions title="学生信息" style={{ marginBottom: 32, marginLeft: 40 }}>
42
+            <Descriptions title="学生信息" style={{ marginBottom: 32 }}>
43 43
               <Descriptions.Item label="姓名">{data.name}</Descriptions.Item>
44 44
               <Descriptions.Item label="性别">{data.sex}</Descriptions.Item>
45 45
               <Descriptions.Item label="积分">{data.createDate}</Descriptions.Item>
@@ -47,7 +47,7 @@ const BannerEdit = (props) => {
47 47
               <Descriptions.Item label="联系方式">{data.phone}</Descriptions.Item>
48 48
               <Descriptions.Item label="邮箱">{data.eMail}</Descriptions.Item>
49 49
             </Descriptions>
50
-          </div>
50
+          {/* </div> */}
51 51
 
52 52
           <Divider style={{ marginBottom: 32 }} />
53 53
           <Descriptions title="学校信息" style={{ marginBottom: 32 }}>