index.tsx 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. /*
  2. * @Author: code4eat awesomedema@gmail.com
  3. * @Date: 2023-03-03 11:30:33
  4. * @LastEditors: code4eat awesomedema@gmail.com
  5. * @LastEditTime: 2023-10-23 16:05:32
  6. * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/pubDicTypeMana/index.tsx
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. import { createFromIconfontCN } from '@ant-design/icons';
  10. import { ModalForm, ProFormText } from '@ant-design/pro-form';
  11. import FormItem from 'antd/es/form/FormItem';
  12. import {DatePicker,Input} from 'antd';
  13. import { useEffect, useRef, useState } from 'react';
  14. import { getData, downloadTemplateReq, importDataPost } from './service';
  15. import './style.less';
  16. import moment from 'moment';
  17. import 'moment/locale/zh-cn';
  18. import locale from 'antd/es/date-picker/locale/zh_CN';
  19. import KCIMPagecontainer from '@/components/KCIMPageContainer';
  20. import { KCIMTable } from '@/components/KCIMTable';
  21. import KCIMUpload from '@/components/KCIMUpload';
  22. import { ActionType } from '@ant-design/pro-components';
  23. const IconFont = createFromIconfontCN({
  24. scriptUrl: '',
  25. });
  26. const currentData = `${new Date().getFullYear()}-${(new Date().getMonth()+1).toString().padStart(2, '0')}`
  27. export default function patientInfoImport() {
  28. const [computeDate,set_computeDate] = useState(currentData);
  29. const [tableDataFilterParams, set_tableDataFilterParams] = useState<any>({computeDate:currentData});
  30. const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState('');
  31. const tableRef = useRef<ActionType>();
  32. const columns = [
  33. {
  34. title: '住院号/门诊号',
  35. dataIndex: 'visitNo',
  36. },
  37. {
  38. title: '病人ID',
  39. dataIndex: 'patientNo',
  40. },
  41. {
  42. title: '患者姓名',
  43. dataIndex: 'name',
  44. },
  45. {
  46. title: '就诊类别',
  47. dataIndex: 'type',
  48. renderText(type: number, record: any, index: any, action: any) {
  49. if(type==1)return '门诊';
  50. if(type==3)return '住院';
  51. if(type==2)return '急诊'
  52. },
  53. },
  54. {
  55. title: '科室代码',
  56. dataIndex: 'departmentCode',
  57. },
  58. {
  59. title: '科室名称',
  60. dataIndex: 'departmentName',
  61. },
  62. {
  63. title: '主诊断代码',
  64. dataIndex: 'primaryDiagCode',
  65. },
  66. {
  67. title: '主诊断名称',
  68. dataIndex: 'primaryDiagName',
  69. },
  70. {
  71. title: '次诊断代码',
  72. ellipsis: true,
  73. dataIndex: 'secondaryDiagCode',
  74. },
  75. {
  76. title: '次诊断名称',
  77. ellipsis: true,
  78. dataIndex: 'secondaryDiagName',
  79. },
  80. {
  81. title: '主手术/操作代码',
  82. dataIndex: 'primaryOperationCode',
  83. },
  84. {
  85. title: '主手术/操作名称',
  86. dataIndex: 'primaryOperationName',
  87. },
  88. {
  89. title: '次手术/操作代码',
  90. ellipsis: true,
  91. dataIndex: 'secondaryOperationCode',
  92. },
  93. {
  94. title: '次手术/操作名称',
  95. ellipsis: true,
  96. dataIndex: 'secondaryOperationName',
  97. },
  98. {
  99. title: 'DRG/DIP分组代码',
  100. dataIndex: 'groupCode',
  101. },
  102. {
  103. title: 'DRG/DIP分组名称',
  104. dataIndex: 'groupMame',
  105. },
  106. {
  107. title: '临床路径代码',
  108. dataIndex: 'clinicalPathwayCode',
  109. },
  110. {
  111. title: '临床路径名称',
  112. dataIndex: 'clinicalPathwayName',
  113. },
  114. {
  115. title: '入院日期',
  116. dataIndex: 'inHospitalTime',
  117. },
  118. {
  119. title: '出院日期',
  120. dataIndex: 'outHospitalTime',
  121. },
  122. {
  123. title: '住院天数',
  124. dataIndex: 'inHospitalDays',
  125. },
  126. ];
  127. const getTableData = async (params:any) => {
  128. const resp = await getData({ ...params,...tableDataFilterParams});
  129. if (resp) {
  130. const { list, totalCount, pageSize, totalPage } = resp;
  131. return {
  132. data: list,
  133. success: true,
  134. total: totalCount,
  135. pageSize: pageSize,
  136. totalPage: totalPage,
  137. };
  138. }
  139. return [];
  140. };
  141. const tableDataSearchHandle = (paramName:string) => {
  142. set_tableDataFilterParams({
  143. ...tableDataFilterParams,
  144. [`${paramName}`]: tableDataSearchKeywords
  145. })
  146. }
  147. const downloadTemplate = async () => {
  148. await downloadTemplateReq();
  149. };
  150. const importData = () => {
  151. return (
  152. <ModalForm
  153. width={360}
  154. title={`导入数据`}
  155. trigger={
  156. <a className="import" key="3">
  157. 导入
  158. </a>
  159. }
  160. submitter={{
  161. render: (props, defaultDoms) => {
  162. const needBtn = defaultDoms.filter((b) => {
  163. return b.key != 'rest';
  164. });
  165. return [
  166. // <Button
  167. // key="ok"
  168. // onClick={auditType == '0' ? () => downloadTemplate(index) : () => { }}
  169. // >
  170. // 下载模板
  171. // </Button>,
  172. ...needBtn,
  173. ];
  174. },
  175. }}
  176. onFinish={async (values) => {
  177. const {
  178. importFile: { fileList },
  179. } = values;
  180. let formData = new FormData();
  181. formData.append('file', fileList[0].originFileObj);
  182. formData.append('computeDate',computeDate);
  183. const resp = await importDataPost(formData);
  184. if (resp) {
  185. tableRef.current?.reload();
  186. return true;
  187. }
  188. }}
  189. >
  190. <FormItem name={'importFile'}>
  191. <KCIMUpload downloadTemplateFile={() => downloadTemplate()} />
  192. </FormItem>
  193. </ModalForm>
  194. );
  195. };
  196. useEffect(() => {}, []);
  197. return (
  198. <KCIMPagecontainer className="patientInfoImport" title={false}>
  199. <div className="toolBar">
  200. <div className="filter">
  201. <div className="filterItem">
  202. {
  203. <div className="search">
  204. <span>核算年月:</span>
  205. <DatePicker
  206. onChange={(data, dateString) => {
  207. set_computeDate(dateString);
  208. set_tableDataFilterParams({
  209. ...tableDataFilterParams,
  210. computeDate: dateString,
  211. });
  212. }}
  213. picker="month"
  214. locale={locale}
  215. defaultValue={moment(`${new Date().getFullYear()}-${(new Date().getMonth()+1).toString().padStart(2, '0')}`, 'YYYY-MM')}
  216. format="YYYY-MM"
  217. placeholder="选择年月"
  218. />
  219. </div>
  220. }
  221. </div>
  222. <div className='filterItem' style={{ marginLeft: 16, width: 205 }}>
  223. <span className='label' style={{ whiteSpace: 'nowrap' }}> 科室名称:</span>
  224. <Input placeholder={'请输入'} allowClear
  225. suffix={
  226. <IconFont type="iconsousuo" style={{ color: '#99A6BF' }} onClick={() => tableDataSearchHandle('departmentName')} />
  227. }
  228. onChange={(e) => {
  229. set_tableDataSearchKeywords(e.target.value);
  230. if (e.target.value.length == 0) {
  231. set_tableDataFilterParams({
  232. ...tableDataFilterParams,
  233. departmentName: ''
  234. });
  235. }
  236. }}
  237. onPressEnter={(e) => {
  238. set_tableDataFilterParams({
  239. ...tableDataFilterParams,
  240. departmentName: ((e.target) as HTMLInputElement).value
  241. });
  242. }}
  243. />
  244. </div>
  245. <div className='filterItem' style={{ marginLeft: 16, width: 205 }}>
  246. <span className='label' style={{ whiteSpace: 'nowrap' }}> 患者名称:</span>
  247. <Input placeholder={'请输入'} allowClear
  248. suffix={
  249. <IconFont type="iconsousuo" style={{ color: '#99A6BF' }} onClick={() => tableDataSearchHandle('patientName')} />
  250. }
  251. onChange={(e) => {
  252. set_tableDataSearchKeywords(e.target.value);
  253. if (e.target.value.length == 0) {
  254. set_tableDataFilterParams({
  255. ...tableDataFilterParams,
  256. patientName: ''
  257. });
  258. }
  259. }}
  260. onPressEnter={(e) => {
  261. set_tableDataFilterParams({
  262. ...tableDataFilterParams,
  263. patientName: ((e.target) as HTMLInputElement).value
  264. });
  265. }}
  266. />
  267. </div>
  268. </div>
  269. <div className="btnGroup">{importData()}</div>
  270. </div>
  271. <div style={{ marginTop: 16 }}>
  272. <KCIMTable
  273. columns={columns}
  274. actionRef={tableRef}
  275. rowKey="id"
  276. scroll={{x:2500}}
  277. params={tableDataFilterParams}
  278. request={(params) => getTableData(params)}
  279. />
  280. </div>
  281. </KCIMPagecontainer>
  282. );
  283. }