Browse Source

Merge branch 'master' of http://git.ycjcjy.com/medical-plat/pc-admin into master

张延森 4 years ago
parent
commit
db07c3ea12

+ 1
- 0
package.json View File

@@ -45,6 +45,7 @@
45 45
   ],
46 46
   "dependencies": {
47 47
     "@ant-design/icons": "^4.0.0",
48
+    "@ant-design/pro-card": "^1.11.10",
48 49
     "@ant-design/pro-descriptions": "^1.2.0",
49 50
     "@ant-design/pro-form": "^1.3.0",
50 51
     "@ant-design/pro-layout": "^6.9.0",

+ 0
- 6
src/common/constants.js View File

@@ -1,6 +0,0 @@
1
-const stateOptions = {
2
-  0: { text: '未上架' },
3
-  1: { text: '已上架' },
4
-};
5
-
6
-export { stateOptions };

+ 1
- 1
src/pages/Medical/Test/List/index.jsx View File

@@ -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
         }}

+ 172
- 7
src/pages/Medical/Visit/Edit/index.jsx View File

@@ -1,19 +1,184 @@
1
-import React from 'react';
2
-import { connect } from 'umi';
1
+import React, { useEffect, useState } from 'react';
2
+import { connect, history } from 'umi';
3
+import ProCard from '@ant-design/pro-card';
3 4
 import { PageContainer } from '@ant-design/pro-layout';
5
+import Container from '@/components/Container';
6
+import { Input, Select, Form, Button, notification } from 'antd';
7
+import ProForm, { ProFormText, ProFormTextArea, ProFormSelect } from '@ant-design/pro-form';
8
+import request from '@/utils/request';
4 9
 
5
-const VisitList = () => {
10
+const { Option } = Select;
11
+const { Search } = Input;
12
+const VisitEdit = (props) => {
13
+  const { id, schoolId } = props.location.query;
14
+  const [list, setList] = useState([]);
15
+  const [searchLoading, setSearchLoading] = useState(false);
6 16
 
17
+  const [form] = Form.useForm();
7 18
 
8
- 
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
+  };
9 34
 
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])
52
+
53
+  const onSearch = (value) => {
54
+    if (value) {
55
+      getData(value);
56
+      setSearchLoading(true);
57
+    } else {
58
+      // this.setState({ data: [] });
59
+    }
60
+  };
61
+
62
+  const handleChange = (value) => {
63
+    // this.setState({ value });
64
+  };
65
+  const handleSubmit = (value) => {
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
+    });
77
+  };
10 78
   return (
11
-    <PageContainer>
12
-      234
79
+    <PageContainer
80
+      header={{
81
+        extra: [
82
+          <Button key="1" onClick={() => history.go('-1')}>
83
+            返回
84
+          </Button>,
85
+        ],
86
+      }}
87
+    >
88
+      <Container>
89
+        <ProForm form={form} submitter={!id} onFinish={handleSubmit}>
90
+          <ProCard.Group title="就诊信息" bodyStyle={{ padding: 20 }}>
91
+            {!id && (
92
+              <Search
93
+                placeholder="请输入学号"
94
+                loading={searchLoading}
95
+                style={{ width: 200, marginBottom: '20px' }}
96
+                onSearch={onSearch}
97
+              />
98
+            )}
99
+
100
+            <ProFormText
101
+              label="姓名"
102
+              placeholder="输入名称"
103
+              name="name"
104
+              fieldProps={{ bordered: !id, readOnly: !!id }}
105
+              rules={[{ required: true, message: '请填写名称' }]}
106
+            />
107
+
108
+            <ProFormSelect
109
+              options={[
110
+                {
111
+                  value: 1,
112
+                  label: '男',
113
+                },
114
+                {
115
+                  value: 2,
116
+                  label: '女',
117
+                },
118
+              ]}
119
+              name="sex"
120
+              label="性别"
121
+              fieldProps={{ bordered: !id, open: id ? false : undefined }}
122
+              rules={[{ required: true, message: '请选择性别' }]}
123
+            />
124
+
125
+            <ProFormText
126
+              label="学号"
127
+              placeholder="输入学号"
128
+              name="studentId"
129
+              fieldProps={{ bordered: !id, readOnly: !!id }}
130
+              rules={[{ required: true, message: '请填写学号' }]}
131
+            />
132
+
133
+            <ProFormText
134
+              label="联系方式"
135
+              placeholder="输入联系方式"
136
+              name="phone"
137
+              fieldProps={{ bordered: !id, readOnly: !!id }}
138
+              rules={[{ required: true, message: '请填写联系方式' }]}
139
+            />
140
+          </ProCard.Group>
141
+          <ProCard.Group title="诊断" bodyStyle={{ padding: 20 }}>
142
+            <ProFormSelect
143
+              label="就诊科室"
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: '请选择科室' }]}
165
+            />
166
+
167
+            <ProFormTextArea
168
+              label="诊断报告"
169
+              placeholder="输入诊断报告"
170
+              name="attchment"
171
+             
172
+              fieldProps={{readOnly: !!id }}
173
+              rules={[{ required: true, message: '请填写诊断报告' }]}
174
+            />
175
+          </ProCard.Group>
176
+        </ProForm>
177
+      </Container>
13 178
     </PageContainer>
14 179
   );
15 180
 };
16 181
 
17 182
 export default connect((s) => ({
18 183
   typeList: s.post.typeList,
19
-}))(VisitList);
184
+}))(VisitEdit);

+ 35
- 8
src/pages/Medical/Visit/List/index.jsx View File

@@ -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 View File

@@ -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
       />

+ 9
- 3
src/pages/Student/School/List/index.jsx View File

@@ -66,9 +66,15 @@ const SchoolList = () => {
66 66
       align: 'center',
67 67
       // hideInTable: true,
68 68
       valueType: 'select',
69
-      valueEnum: {
70
-        0: { text: '未上架' },
71
-        1: { text: '已上架' },
69
+      valueEnum:{
70
+        0: {
71
+          text: '已下架',
72
+          status: 'Processing',
73
+        },
74
+        1: {
75
+          text: '已上架',
76
+          status: 'Success',
77
+        },
72 78
       },
73 79
     },
74 80
     {

+ 4
- 4
src/pages/Student/Student/Edit/index.jsx View File

@@ -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 }}>

+ 2
- 1
src/pages/Student/Student/List/index.jsx View File

@@ -38,9 +38,10 @@ const StudentList = () => {
38 38
     },
39 39
     {
40 40
       title: '学校',
41
-      dataIndex: 'schoolName',
41
+      dataIndex: 'schoolId',
42 42
 
43 43
       align: 'center',
44
+
44 45
     },
45 46
     {
46 47
       title: '专业',