index.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. import React, { useState, useEffect, useRef } from 'react';
  2. import { Form, Input, Button, Table, Row, Col, Select, Modal, DatePicker, Space, message } from 'antd';
  3. import moment from "moment";
  4. import "moment/locale/zh-cn"
  5. import '@common/common.less';
  6. import './index.less'
  7. import apiObj from '@api/index';
  8. import EditBlock from './editBlock';
  9. import BlockContext from './block-context';
  10. import { disabledDate, getValueFromEvent } from '@utils/index'
  11. const { post, api, xPost } = apiObj;
  12. const { RangePicker } = DatePicker;
  13. const { Option } = Select;
  14. function BlockLossManage() {
  15. useEffect(() => {
  16. getBlockLossPage();
  17. blockLossTypeGather(date)
  18. }, []);
  19. const [blockList, setBlockList] = useState([]);
  20. const [total, setTotal] = useState(0);
  21. const [title, setTitle] = useState(0);
  22. const [visible, setVisible] = useState(false);
  23. const [size, setSize] = useState(15);
  24. const [current, setCurrent] = useState(1);
  25. const [type, setType] = useState(null);
  26. const [blockData, setBlockData] = useState({});
  27. const [blockDetail, setBlockDetail] = useState(null);//详情数据
  28. const [params, setParams] = useState({
  29. pages: 1,
  30. current: 1,
  31. size: 15,
  32. desc:['status','gmt_create'],
  33. startDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
  34. endDate: getCurrentData().split('/').join('-') + ' 23:23:59'
  35. });
  36. const [form] = Form.useForm();
  37. let data = {
  38. pages: 1,
  39. current: 1,
  40. size: size,
  41. desc:['status','gmt_create'],
  42. startDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
  43. endDate: getCurrentData().split('/').join('-') + ' 23:23:59'
  44. }
  45. let date = {
  46. startDate: getCurrentDataFront().split('/').join('-') + ' 00:00:00',
  47. endDate: getCurrentData().split('/').join('-') + ' 23:23:59'
  48. }
  49. //表格数据
  50. function getBlockLossPage(param) {
  51. post(api.getBlockLossPage, param || params).then((res) => {
  52. if (res.data.code === 200) {
  53. const data = res.data.data;
  54. setBlockList(data.records);
  55. setTotal(data.total)
  56. }
  57. })
  58. }
  59. //丢失量分类汇总
  60. function blockLossTypeGather(param) {
  61. post(api.blockLossTypeGather, param).then((res) => {
  62. if (res.data.code === 200) {
  63. const data = res.data.data;
  64. setBlockData(data)
  65. }
  66. })
  67. }
  68. //修改
  69. function showModal(title, row, type) {
  70. setVisible(true)
  71. setBlockDetail(row)
  72. setTitle(title)
  73. setType(type)
  74. }
  75. function onSizeChange(current, pageSize) {
  76. params.current = current
  77. params.size = pageSize
  78. setSize(pageSize)
  79. setCurrent(current)
  80. setParams(params)
  81. getBlockLossPage()
  82. }
  83. function changePage(page, pageSize) {
  84. params.current = page
  85. params.size = pageSize
  86. setParams(params)
  87. setCurrent(page)
  88. getBlockLossPage()
  89. }
  90. //返回
  91. function cancel() {
  92. setVisible(false)
  93. setBlockDetail(null)
  94. }
  95. function userChange() {
  96. setVisible(false)
  97. getBlockLossPage();
  98. setBlockDetail(null)
  99. }
  100. const onFinish = (value) => {
  101. if (value.time) {
  102. value.startDate = moment(value.time[0]).format('YYYY-MM-DD 00:00:00');
  103. value.endDate = moment(value.time[1]).format('YYYY-MM-DD 23:23:59');
  104. }
  105. delete value.time
  106. const param = {
  107. ...data,
  108. ...value,
  109. }
  110. setCurrent(1)
  111. setParams(param)
  112. getBlockLossPage(param);
  113. blockLossTypeGather({startDate:value.startDate, endDate:value.endDate})
  114. };
  115. const onReset = () => {
  116. setCurrent(1)
  117. setParams(data)
  118. form.resetFields();
  119. getBlockLossPage(data);
  120. blockLossTypeGather(date)
  121. };
  122. function getCurrentDataFront() {
  123. let time = new Date((new Date() - 30 * 24 * 3600 * 1000)).toLocaleDateString()
  124. return time
  125. }
  126. // 结束时间
  127. function getCurrentData() {
  128. let time = new Date().toLocaleDateString()
  129. return time
  130. }
  131. const columns = [
  132. { title: '序号', dataIndex: 'index', render: (text, record, index) => (current - 1) * params.size + index + 1 },
  133. { title: '住院序号', dataIndex: 'behospitalCode', key: 'behospitalCode' },
  134. { title: '文书编号', dataIndex: 'recId', key: 'recId' },
  135. { title: '文书标题', dataIndex: 'recTitle', key: 'recTitle' },
  136. {
  137. title: '丢失原因', dataIndex: 'lossCause', key: 'lossCause', render: (text, record) => {
  138. return record.lossCause || '-';
  139. }
  140. },
  141. {
  142. title: '丢失类型', dataIndex: 'lossType', key: 'lossType', render: (text, record) => {
  143. return (<span>{record.lossType == 0 ? '文书丢失' : record.lossType == 1 ? '病案首页丢失' : record.lossType == 2 ? '患者信息丢失' : '-'}</span>);
  144. }
  145. },
  146. {
  147. title: '丢失途径', dataIndex: 'lossWay', key: 'lossWay', render: (text, record) => {
  148. return (<span>{record.lossWay == 0 ? '外部丢失' : record.lossWay == 1 ? '内部丢失' : '-'}</span>);
  149. }
  150. },
  151. {
  152. title: '更新时间', dataIndex: 'auditTime', key: 'auditTime', render: (text, record) => {
  153. return record.auditTime || '-';
  154. }
  155. },
  156. {
  157. title: '状态', key: 'status', render: (text, record) => {
  158. return (<span className={record.status === '0' ? 'Delete' : 'Adopt'}>{record.status == 0 ? '已丢失' : record.status == 1 ? '已恢复' : '-'}</span>);
  159. }
  160. },
  161. {
  162. title: '核查结果', key: 'isAudited', render: (text, record) => {
  163. return (<span className={(record.isAudited === '0') ? 'delete' : (record.isAudited === '1') ? 'adopt' : 'disable'}>{record.isAudited == 0 ? '审核未通过' : record.isAudited == 1 ? '审核通过' : record.isAudited == 2 ? '未核查' : '-'}</span>);
  164. }
  165. },
  166. {
  167. title: '操作', dataIndex: 'key', render: (text, record) => (
  168. <Space size="middle">
  169. <a onClick={e => showModal('修改病历数据块丢失明细', record, 3)}>修改</a>
  170. </Space>
  171. )
  172. }
  173. ];
  174. return (
  175. <div className="wrapper">
  176. <div className="filter-box">
  177. <Form
  178. form={form}
  179. name="normal_login"
  180. onFinish={onFinish}
  181. initialValues={{ lossType: '', lossWay: '', isAudited: '', status: '', time: [moment(getCurrentDataFront()), moment(getCurrentData())] }}
  182. >
  183. <Row gutter={24}>
  184. <Col span={6} key={0}>
  185. <Form.Item label="日期" name="time">
  186. <RangePicker
  187. disabledDate={disabledDate} // 限制日期不可选
  188. placeholder={['开始时间', '结束时间']}
  189. />
  190. </Form.Item>
  191. </Col>
  192. <Col span={5} key={1}>
  193. <Form.Item label="住院序号" name="behospitalCode" getValueFromEvent={getValueFromEvent}>
  194. <Input placeholder="住院序号" autoComplete='off' allowClear maxLength='30' />
  195. </Form.Item>
  196. </Col>
  197. <Col span={5} key={2}>
  198. <Form.Item label="文书编号" name="recId" getValueFromEvent={getValueFromEvent}>
  199. <Input placeholder="文书编号" autoComplete='off' allowClear maxLength='30' />
  200. </Form.Item>
  201. </Col>
  202. <Col span={5} key={3}>
  203. <Form.Item label="文书标题" name="recTitle" getValueFromEvent={getValueFromEvent}>
  204. <Input placeholder="文书标题" autoComplete='off' allowClear maxLength='30' />
  205. </Form.Item>
  206. </Col>
  207. <Col span={5} key={4}>
  208. <Form.Item label="丢失类型" name="lossType">
  209. <Select
  210. placeholder="请选择"
  211. allowClear
  212. >
  213. <Option value="" key={3}>全部</Option>
  214. <Option value="0" key={0}>文书丢失</Option>
  215. <Option value="1" key={1}>病案首页丢失</Option>
  216. <Option value="2" key={2}>患者信息丢失</Option>
  217. </Select>
  218. </Form.Item>
  219. </Col>
  220. <Col span={5} key={5}>
  221. <Form.Item label="丢失途径" name="lossWay">
  222. <Select
  223. placeholder="请选择"
  224. allowClear
  225. >
  226. <Option value="" key={2}>全部</Option>
  227. <Option value="0" key={0}>外部丢失</Option>
  228. <Option value="1" key={1}>内部丢失</Option>
  229. </Select>
  230. </Form.Item>
  231. </Col>
  232. <Col span={5} key={6}>
  233. <Form.Item label="核查结果" name="isAudited">
  234. <Select
  235. placeholder="请选择"
  236. allowClear
  237. >
  238. <Option value="" key={3}>全部</Option>
  239. <Option value="0" key={0}>未通过</Option>
  240. <Option value="1" key={1}>已通过</Option>
  241. <Option value="2" key={2}>未核查</Option>
  242. </Select>
  243. </Form.Item>
  244. </Col>
  245. <Col span={5} key={7}>
  246. <Form.Item label="状态" name="status">
  247. <Select
  248. placeholder="请选择"
  249. allowClear
  250. >
  251. <Option value="" key={3}>全部</Option>
  252. <Option value="0" key={0}>已丢失</Option>
  253. <Option value="1" key={1}>已恢复</Option>
  254. </Select>
  255. </Form.Item>
  256. </Col>
  257. <Col span={4} key={8}>
  258. <Form.Item>
  259. <Button type="primary" htmlType="submit">
  260. 查询
  261. </Button>
  262. <Button onClick={onReset}>
  263. 重置
  264. </Button>
  265. </Form.Item>
  266. </Col>
  267. </Row>
  268. </Form>
  269. </div>
  270. <div className="table">
  271. <div className="table-header">
  272. <h2 className="table-title">病历数据块丢失明细</h2>
  273. <Space size="middle">
  274. <Button type="primary" onClick={() => showModal('数据补录设置', { behospitalCode: '', time: '' }, 1)}>数据补录</Button>
  275. <Button type="primary" onClick={() => showModal('数据对比设置', { behospitalCode: '', time: '' }, 2)}>数据对比</Button>
  276. </Space>
  277. </div>
  278. <div className="table-data">
  279. <Row className="data-box">
  280. <Col span={6} order={1} className="data-item">
  281. <p>{blockData.hisNum || blockData.hisNum == 0 ? blockData.hisNum : '-'}</p>
  282. <p>HIS</p>
  283. </Col>
  284. <Col span={6} order={2} className="data-item">
  285. <p>{blockData.logNum || blockData.logNum == 0 ? blockData.logNum : '-'}</p>
  286. <p>接口日志</p>
  287. </Col>
  288. <Col span={6} order={3} className="data-item">
  289. <p>{blockData.realNum || blockData.realNum == 0 ? blockData.realNum : '-'}</p>
  290. <p>实际</p>
  291. </Col>
  292. <Col span={6} order={4} className="data-item item" >
  293. <p>{blockData.allLossNum || blockData.allLossNum == 0 ? blockData.allLossNum : '-'}</p>
  294. <p>合计丢失</p>
  295. </Col>
  296. </Row>
  297. <Row className="data-box">
  298. <Col span={6} order={1} className="box-item">
  299. <p>{blockData.outRecNum || blockData.outRecNum == 0 ? blockData.outRecNum : '-'}</p>
  300. <p>文书丢失</p>
  301. </Col>
  302. <Col span={6} order={2} className="box-item">
  303. <p>{blockData.outHomePageNum || blockData.outHomePageNum == 0 ? blockData.outHomePageNum : '-'}</p>
  304. <p>病案首页丢失</p>
  305. </Col>
  306. <Col span={6} order={3} className="box-item">
  307. <p>{blockData.outCodeNum || blockData.outCodeNum == 0 ? blockData.outCodeNum : '-'}</p>
  308. <p>病历号丢失</p>
  309. </Col>
  310. <Col span={6} order={4} className="box-item box">
  311. <p>{blockData.outLossNum || blockData.outLossNum == 0 ? blockData.outLossNum : '-'}</p>
  312. <p>外部丢失</p>
  313. </Col>
  314. </Row>
  315. <Row className="data-box">
  316. <Col span={6} order={1} className="box-item">
  317. <p>{blockData.inRecNum || blockData.inRecNum == 0 ? blockData.inRecNum : '-'}</p>
  318. <p>文书丢失</p>
  319. </Col>
  320. <Col span={6} order={2} className="box-item">
  321. <p>{blockData.inHomePageNum || blockData.inHomePageNum == 0 ? blockData.inHomePageNum : '-'}</p>
  322. <p>病案首页丢失</p>
  323. </Col>
  324. <Col span={6} order={3} className="box-item">
  325. <p>{blockData.inCodeNum || blockData.inCodeNum == 0 ? blockData.inCodeNum : '-'}</p>
  326. <p>病历号丢失</p>
  327. </Col>
  328. <Col span={6} order={4} className="box-item box">
  329. <p>{blockData.inLossNum || blockData.inLossNum == 0 ? blockData.inLossNum : '-'}</p>
  330. <p>内部丢失</p>
  331. </Col>
  332. </Row>
  333. </div>
  334. <Table
  335. columns={columns}
  336. scroll={{ y: 'calc(100vh - 470px)' }}
  337. dataSource={blockList}
  338. rowKey={record => record.id}
  339. pagination={{
  340. pageSize: size,
  341. size: 'small',
  342. current: current,
  343. showSizeChanger: true,
  344. pageSizeOptions: ['15', '30', '60', '120'],
  345. showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条数据`,
  346. onShowSizeChange: (current, pageSize) => onSizeChange(current, pageSize), // 改变每页数量时更新显示
  347. onChange: (page, pageSize) => changePage(page, pageSize),//点击页码事件
  348. total: total
  349. }} />
  350. </div>
  351. {visible && blockDetail ?
  352. <Modal
  353. title={title}
  354. okText='确定'
  355. cancelText='取消'
  356. width="500px"
  357. visible={visible}
  358. onCancel={cancel}
  359. footer={null}
  360. forceRender={true}
  361. maskClosable={false}
  362. >
  363. <BlockContext.Provider value={{ blockDetail, type }}>
  364. <EditBlock userChange={userChange} />
  365. </BlockContext.Provider>
  366. </Modal>
  367. : ''}
  368. </div >
  369. )
  370. }
  371. export default BlockLossManage;