patients.vue 40KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351
  1. <template>
  2. <div class="main-contain">
  3. <el-dialog
  4. title="提示"
  5. :visible.sync="dialogVisible"
  6. width="40%"
  7. >
  8. <span>您提交的文档不是系统标准导入模板,请检查您的文档或重新 <a href="https://kuyi.shengws.com/patient_template.xlsx" style="color: blue"
  9. download="template">下载导入模板</a></span>
  10. <span slot="footer" class="dialog-footer">
  11. <el-button @click="dialogVisible = false">取 消</el-button>
  12. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  13. </span>
  14. </el-dialog>
  15. <el-dialog
  16. title="提示"
  17. :visible.sync="exportLogVisible"
  18. width="40%"
  19. >
  20. <div v-for="(item,index) in logs" :key="index">
  21. <span> {{ item.export_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}</span>
  22. <br/>
  23. <br/>
  24. <span>{{getContent(item)}}</span>
  25. <span style="color:blue" @click="generateTxt(item)">点击</span>
  26. <span>查看详情</span>
  27. <br/>
  28. <br/>
  29. </div>
  30. <span slot="footer" class="dialog-footer">
  31. <el-button @click="exportLogVisible = false">取 消</el-button>
  32. <el-button type="primary" @click="exportLogVisible = false">确 定</el-button>
  33. </span>
  34. </el-dialog>
  35. <div class="position">
  36. <bread-crumb :crumbs="crumbs"></bread-crumb>
  37. <upload-excel style="float:right;" :on-success='handleSuccess' :before-upload="beforeUpload"></upload-excel>
  38. <div style="float:right;"
  39. >
  40. <el-link target="_blank" href="https://kuyi.shengws.com/patient_template.xlsx" :underline="false"
  41. style="margin-left:15px">
  42. <el-button
  43. class="filter-item"
  44. type="primary"
  45. size="small"
  46. >下载模版
  47. </el-button>
  48. </el-link>
  49. <el-button
  50. @click="generateLog()"
  51. class="filter-item"
  52. type="primary"
  53. size="small"
  54. >下载错误日志
  55. </el-button>
  56. <el-button
  57. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  58. @click="$router.push({ path: '/patients/create' })"
  59. class="filter-item"
  60. type="primary"
  61. icon="el-icon-circle-plus-outline"
  62. size="small"
  63. >新增
  64. </el-button>
  65. </div>
  66. </div>
  67. <div class="app-container">
  68. <div class="cell clearfix">
  69. <!-- <label class="title"><span class="name">病人搜索</span> : </label> -->
  70. <el-input
  71. style="width: 400px;"
  72. v-model.trim="searchKey"
  73. class="filter-item"
  74. placeholder="病人姓名/透析号"
  75. size="small"
  76. />
  77. <el-button
  78. class="filter-item"
  79. type="primary"
  80. icon="el-icon-search"
  81. @click="search"
  82. size="small"
  83. >搜索
  84. </el-button
  85. >
  86. </div>
  87. <div class="cell clearfix">
  88. <label class="title"><span class="name">日期查询</span> : </label>
  89. <el-date-picker
  90. size="small"
  91. clearable
  92. v-model="listQuery.start_time"
  93. prefix-icon="el-icon-date"
  94. @change="changeTimeOne"
  95. :editable="false"
  96. style="width: 196px;"
  97. type="date"
  98. placeholder="选择日期时间"
  99. align="right"
  100. format="yyyy-MM-dd"
  101. value-format="yyyy-MM-dd"
  102. >
  103. </el-date-picker>
  104. <span class="cellLine"> - </span>
  105. <el-date-picker
  106. size="small"
  107. clearable
  108. v-model="listQuery.end_time"
  109. prefix-icon="el-icon-date"
  110. @change="changeTime"
  111. :editable="false"
  112. style="width: 196px;"
  113. type="date"
  114. placeholder="选择日期时间"
  115. align="right"
  116. format="yyyy-MM-dd"
  117. value-format="yyyy-MM-dd"
  118. >
  119. </el-date-picker>
  120. </div>
  121. <div class="cell clearfix">
  122. <label class="title"><span class="name">排班班次</span> : </label>
  123. <div class="time ">
  124. <ul class="">
  125. <li
  126. :class="item.value == schedulType ? 'active' : ''"
  127. @click="selectSchedulType(item.value)"
  128. v-for="item in schedulArr"
  129. :key="item.value"
  130. >
  131. {{ item.label }}
  132. </li>
  133. </ul>
  134. </div>
  135. </div>
  136. <div class="cell clearfix">
  137. <label class="title"><span class="name">状态</span> : </label>
  138. <div class="time ">
  139. <ul class="">
  140. <li
  141. :class="item.value == systemType ? 'active' : ''"
  142. @click="selectSystemType(item.value)"
  143. v-for="item in systemArr"
  144. :key="item.value"
  145. >
  146. {{ item.label }}
  147. </li>
  148. </ul>
  149. </div>
  150. </div>
  151. <div class="cell clearfix">
  152. <label class="title"><span class="name">转归情况</span> : </label>
  153. <div class="time ">
  154. <ul class="">
  155. <li
  156. :class="item.lapseto == lapsetoType ? 'active' : ''"
  157. @click="selectLapseTo(item.lapseto)"
  158. v-for="item in lapsetoArr"
  159. :key="item.value"
  160. >
  161. {{ item.label }}
  162. </li>
  163. </ul>
  164. </div>
  165. </div>
  166. <div class="cell clearfix">
  167. <label class="title"><span class="name">病人来源</span> : </label>
  168. <div class="time ">
  169. <ul class="">
  170. <li
  171. :class="item.source == sourceType ? 'active' : ''"
  172. @click="selectSource(item.source)"
  173. v-for="item in sourceArr"
  174. :key="item.value"
  175. >
  176. {{ item.label }}
  177. </li>
  178. </ul>
  179. </div>
  180. </div>
  181. <div class="cell clearfix">
  182. <label class="title"><span class="name">其它查询</span> : </label>
  183. <el-select
  184. v-model="listQuery.contagion"
  185. size="small"
  186. clearable
  187. placeholder="传染病"
  188. @change="changeOtherSearch"
  189. >
  190. <el-option
  191. v-for="item in contagionList"
  192. :key="item.id"
  193. :label="item.name"
  194. :value="item.id"
  195. >
  196. </el-option>
  197. </el-select>
  198. <el-select
  199. style="margin-left: 10px;"
  200. v-model="listQuery.reimbursement_way"
  201. size="small"
  202. clearable
  203. placeholder="付费方式"
  204. @change="changeOtherSearch"
  205. >
  206. <el-option
  207. v-for="item in reimbursement_ways"
  208. :key="item.id"
  209. :label="item.name"
  210. :value="item.id"
  211. >
  212. </el-option>
  213. </el-select>
  214. <el-select
  215. v-model="listQuery.isscheduling"
  216. collapse-tags
  217. style="margin-left: 10px;"
  218. clearable
  219. placeholder="排班情况"
  220. size="small"
  221. @change="changeOtherSearch"
  222. >
  223. <el-option
  224. v-for="item in scheduling"
  225. :key="item.value"
  226. :label="item.label"
  227. :value="item.value"
  228. >
  229. </el-option>
  230. </el-select>
  231. <el-select
  232. v-model="listQuery.isprescription"
  233. collapse-tags
  234. style="margin-left:10px;"
  235. clearable
  236. placeholder="透析处方"
  237. size="small"
  238. @change="changeOtherSearch"
  239. >
  240. <el-option
  241. v-for="item in prescription"
  242. :key="item.value"
  243. :label="item.label"
  244. :value="item.value"
  245. >
  246. </el-option>
  247. </el-select>
  248. </div>
  249. <el-table
  250. ref="multipleTable"
  251. :row-style="{ color: '#303133' }"
  252. :header-cell-style="{
  253. backgroundColor: 'rgb(245, 247, 250)',
  254. color: '#606266'
  255. }"
  256. :data="tableData"
  257. border
  258. fit
  259. highlight-current-row
  260. style="width: 100%;margin-top: 10px;"
  261. @selection-change="handleSelectionChange"
  262. >
  263. <el-table-column
  264. align="center"
  265. label="全选"
  266. width="60px"
  267. type="selection"
  268. ></el-table-column>
  269. <el-table-column
  270. type="index"
  271. label="序号"
  272. width="60px"
  273. align="center"
  274. ></el-table-column>
  275. <el-table-column
  276. label="透析号"
  277. min-width="80"
  278. property="dialysis_no"
  279. align="center"
  280. style="color:red"
  281. ></el-table-column>
  282. <el-table-column
  283. label="住院号"
  284. min-width="80"
  285. property="admission_number"
  286. align="center"
  287. >
  288. </el-table-column>
  289. <el-table-column
  290. property="name"
  291. label="姓名"
  292. min-width="80"
  293. align="center"
  294. >
  295. <template slot-scope="scope">
  296. <router-link
  297. :to="'/patients/patient/' + scope.row.id"
  298. style="color:#409eff"
  299. >{{ scope.row.name }}
  300. </router-link
  301. >
  302. </template>
  303. </el-table-column>
  304. <el-table-column label="性别" min-width="80" align="center">
  305. <template slot-scope="scope">
  306. <span v-if="scope.row.gender == 1">男</span>
  307. <span v-else-if="scope.row.gender == 2">女</span>
  308. <span v-else>未知</span>
  309. </template>
  310. </el-table-column>
  311. <el-table-column label="来源" min-width="80" align="center">
  312. <template slot-scope="scope">
  313. <span v-if="scope.row.source == 1">门诊</span>
  314. <span v-else-if="scope.row.source == 2">住院</span>
  315. <span v-else>未知</span>
  316. </template>
  317. </el-table-column>
  318. <el-table-column label="透析次数" min-width="94" align="center">
  319. <template slot-scope="scope">
  320. <span>{{ getCount(scope.row) }}</span>
  321. </template>
  322. </el-table-column>
  323. <!-- <el-table-column min-width="150" label="二维码" align="center">
  324. <template slot-scope="scope" type="text">
  325. <a style="color:#409eff" v-if="scope.row.binding_state==1" @click="openWechatBindDialog">已绑定</a>
  326. <a style="color:#409eff" v-else @click="openWechatBindDialog">生成</a>
  327. </template>
  328. </el-table-column> -->
  329. <el-table-column label="日期" min-width="144" align="center">
  330. <template slot-scope="scope">
  331. <span>{{ scope.row.created_time | parseTime('{y}-{m}-{d}') }}</span>
  332. </template>
  333. </el-table-column>
  334. <el-table-column label="转归" align="center">
  335. <template slot-scope="scope">
  336. <span>{{ LapsetoInfo(scope.row) }}</span>
  337. </template>
  338. </el-table-column>
  339. <el-table-column label="操作" align="center" min-width="140">
  340. <template slot-scope="scope">
  341. <el-tooltip
  342. class="item"
  343. effect="dark"
  344. content="转归"
  345. placement="top"
  346. >
  347. <el-button
  348. type="primary"
  349. icon="el-icon-edit"
  350. size="small"
  351. @click="OpenSetLapseto(scope.row, scope.$index)"
  352. ></el-button>
  353. </el-tooltip>
  354. <el-tooltip
  355. class="item"
  356. effect="dark"
  357. content="预览"
  358. placement="top"
  359. >
  360. <el-button
  361. type="danger"
  362. icon="el-icon-tickets"
  363. size="small"
  364. @click="
  365. OpenView(scope.row.name, scope.row.dialysis_no, scope.row.id)
  366. "
  367. ></el-button>
  368. </el-tooltip>
  369. </template>
  370. </el-table-column>
  371. </el-table>
  372. <!-- <pagi-nation title="分页"></pagi-nation> -->
  373. <el-pagination
  374. @size-change="handleSizeChange"
  375. @current-change="handleCurrentChange"
  376. :current-page="listQuery.pate"
  377. :page-sizes="[10, 20, 50, 100]"
  378. :page-size="10"
  379. background
  380. style="margin-top:20px;"
  381. align="right"
  382. layout="total, sizes, prev, pager, next, jumper"
  383. :total="total"
  384. >
  385. </el-pagination>
  386. <el-dialog
  387. title="微信绑定"
  388. :visible.sync="bindWechatDialog"
  389. width="30%"
  390. center
  391. >
  392. <img :src="wechatbindimg" width="100%" alt="" v-if="wechatbindimg"/>
  393. <i class="el-icon-loading" v-else></i>
  394. <span slot="footer" class="dialog-footer">
  395. <el-button type="primary" @click="bindWechatDialog = false"
  396. >关闭</el-button
  397. >
  398. </span>
  399. </el-dialog>
  400. <el-dialog title="转归" :visible.sync="LapsetoDialogVisible">
  401. <el-form
  402. :model="lapsetoForm"
  403. :rules="lapsetoRules"
  404. ref="lapsetoForm"
  405. label-width="140px"
  406. >
  407. <el-form-item label="治疗状态(转归):" prop="lapseto_type" required>
  408. <el-radio-group v-model="lapsetoForm.lapseto_type">
  409. <el-radio
  410. v-for="item in lapsetoOptions"
  411. :key="item.value"
  412. :label="item.value"
  413. :value="item.value"
  414. >{{ item.label }}
  415. </el-radio
  416. >
  417. </el-radio-group>
  418. </el-form-item>
  419. <el-form-item label="转归时间 :" prop="lapseto_time" required>
  420. <el-date-picker
  421. v-model="lapsetoForm.lapseto_time"
  422. type="datetime"
  423. format="yyyy-MM-dd HH:mm:ss"
  424. value-format="yyyy-MM-dd HH:mm:ss"
  425. placeholder="选择日期时间"
  426. default-time="12:00:00"
  427. >
  428. </el-date-picker>
  429. </el-form-item>
  430. </el-form>
  431. <div slot="footer" class="dialog-footer">
  432. <el-button @click="LapsetoDialogVisible = false">取 消</el-button>
  433. <el-button type="primary" @click="EditLapseto()">保 存</el-button>
  434. </div>
  435. </el-dialog>
  436. <el-dialog
  437. title="签到卡"
  438. :visible.sync="centerDialogVisible"
  439. :close-on-click-modal="false"
  440. @opened="ShowQRCode()"
  441. width="30%"
  442. center
  443. >
  444. <div align="center" style="margin-bottom:6px;font-size:20px">
  445. <!-- 姓名:<el-input v-model="name" size="small" style="width:200px"></el-input><br> -->
  446. 姓名:<span>{{ this.name }}</span>
  447. </div>
  448. <div align="center" style="margin-bottom:10px;font-size:20px">
  449. <!-- 透析号:<el-input v-model="dialysis_no" size="small" style="width:200px"></el-input><br> -->
  450. 透析号:<span>{{ this.dialysis_no }}</span>
  451. </div>
  452. <div id="qrcode" align="center"></div>
  453. <span slot="footer" class="dialog-footer">
  454. <!-- <el-button type="primary" @click="download()">下载</el-button> -->
  455. <el-button type="primary" @click="print()">打印</el-button>
  456. </span>
  457. </el-dialog>
  458. <div hidden="hidden">
  459. <div id="print-card-info">
  460. <div
  461. class="order_title"
  462. align="center"
  463. style="margin-bottom:20px;font-size:35px"
  464. >
  465. 签到卡
  466. </div>
  467. <div align="center" style="margin-bottom:4px;font-size:25px">
  468. 姓名:<span>&nbsp;&nbsp;{{ this.name }}</span
  469. ><br/>
  470. </div>
  471. <div align="center" style="margin-bottom:20px;font-size:25px">
  472. 透析号:<span>&nbsp;&nbsp;{{ this.dialysis_no }}</span>
  473. </div>
  474. <div>
  475. <div id="code" align="center"></div>
  476. </div>
  477. </div>
  478. </div>
  479. </div>
  480. </div>
  481. </template>
  482. <script>
  483. import { code, EditLapseto, fetchList, OpenView, postExportPatients } from '@/api/patient'
  484. import { generateLog } from '@/api/config'
  485. import QRCode from 'qrcodejs2'
  486. import Vue from 'vue'
  487. import { Base64 } from 'js-base64'
  488. import { uParseTime } from '@/utils/tools'
  489. import { log } from 'util'
  490. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  491. import UploadExcel from '@/xt_pages/components/UploadExcel'
  492. export default {
  493. name: 'Patient',
  494. components: {
  495. UploadExcel,
  496. BreadCrumb
  497. },
  498. data() {
  499. return {
  500. logs: [],
  501. downloadUrl: 'https://kuyi.shengws.com/patient_template.xltx',
  502. crumbs: [
  503. { path: false, name: '病人管理' },
  504. { path: '/patients/patients', name: '病人管理' }
  505. ],
  506. lapsetoRules: {
  507. lapseto_type: [{ required: true, message: '请选择治疗状态' }],
  508. lapseto_time: [{ required: true, message: '请选择转归时间' }]
  509. },
  510. currentIndex: -1,
  511. LapsetoDialogVisible: false,
  512. centerDialogVisible: false,
  513. checkAll: false,
  514. isIndeterminate: true,
  515. dialogVisible: false,
  516. exportLogVisible: false,
  517. wechatbindimg: '',
  518. active: true,
  519. schedulType: 0,
  520. lapsetoForm: {
  521. lapseto_type: 0,
  522. lapseto_time: '',
  523. patient_id: 0
  524. },
  525. schedulArr: [
  526. { value: 0, label: '全部' },
  527. { value: 1, label: '上午' },
  528. { value: 2, label: '下午' },
  529. { value: 3, label: '晚上' }
  530. ],
  531. lapsetoOptions: [
  532. { value: 1, label: '留治' },
  533. { value: 2, label: '转出' }
  534. ],
  535. systemType: 0,
  536. systemArr: [
  537. { value: 0, label: '全部' },
  538. { value: 1, label: '已绑定' },
  539. { value: 2, label: '未绑定' }
  540. ],
  541. sourceType: 0,
  542. sourceID: 0,
  543. lapsetoType: 0,
  544. sourceArr: [
  545. { value: 0, label: '全部', source: 0, lapseto: 0 },
  546. // { value: 1, label: "转出", source: 0, lapseto: 2 },
  547. // { value: 2, label: "留治", source: 0, lapseto: 1 },
  548. { value: 3, label: '门诊', source: 1, lapseto: 1 },
  549. { value: 4, label: '住院', source: 2, lapseto: 1 }
  550. ],
  551. lapsetoArr: [
  552. { value: 0, label: '全部', source: 0, lapseto: 0 },
  553. { value: 1, label: '转出', source: 0, lapseto: 2 },
  554. { value: 2, label: '留治', source: 0, lapseto: 1 }
  555. // { value: 3, label: "门诊", source: 1, lapseto: 1 },
  556. // { value: 4, label: "住院", source: 2, lapseto: 1 }
  557. ],
  558. scheduling: [
  559. {
  560. value: 1,
  561. label: '已排班'
  562. },
  563. {
  564. value: 2,
  565. label: '未排班'
  566. }
  567. ],
  568. prescription: [
  569. {
  570. value: 1,
  571. label: '有处方'
  572. },
  573. {
  574. value: 2,
  575. label: '无处方'
  576. }
  577. ],
  578. tableData: null,
  579. searchKey: '',
  580. // value2: '',
  581. total: 0,
  582. pageTotal: 0,
  583. pageSelect: 0,
  584. listQuery: {
  585. page: 1,
  586. limit: 10,
  587. schedul_type: 0,
  588. binding_state: 0,
  589. lapseto: 0,
  590. source: 0,
  591. start_time: '',
  592. end_time: '',
  593. keywords: '',
  594. contagion: '',
  595. reimbursement_way: '',
  596. isscheduling: '',
  597. isprescription: ''
  598. },
  599. multipleSelection: [],
  600. bindWechatDialog: false,
  601. contagionList: [],
  602. reimbursement_ways: [],
  603. patient: null,
  604. id: '',
  605. name: '',
  606. dialysis_no: '',
  607. patientPrint: {},
  608. patient_id: '',
  609. gender: '',
  610. idcardno: '',
  611. phone: '',
  612. healthcareno: '',
  613. startTime: '',
  614. export_date: []
  615. }
  616. },
  617. created() {
  618. this.getList()
  619. this.contagionList = this.$store.getters.contagions
  620. this.reimbursement_ways = this.$store.getters.reimbursement_ways
  621. const keyword = this.$route.query && this.$route.query.keyword
  622. if (typeof keyword === 'string' && keyword.length > 0) {
  623. this.listQuery.keywords = keyword
  624. this.searchKey = keyword
  625. }
  626. },
  627. methods: {
  628. generateTxt:function(log) {
  629. var content = ''
  630. var errlog = log.err_logs
  631. for (let i = 0; i< errlog.length; i++){
  632. if (content.length == 0) {
  633. content = errlog[i].err_msg
  634. }else{
  635. content = content +"\n"+errlog[i].err_msg
  636. }
  637. }
  638. var url = new Blob(['\ufeff' + content], { type: 'text/txt,charset=UTF-8' })
  639. if (typeof url === 'object' && url instanceof Blob) {
  640. url = URL.createObjectURL(url) // 创建blob地址
  641. }
  642. const aLink = document.createElement('a')
  643. aLink.href = url
  644. aLink.download = this.timestampToTime(log.export_time)+'错误日志'
  645. aLink.click()
  646. },
  647. getContent(log) {
  648. return '您导入的文档共' + log.total_num + '条患者数据' + ',' + '已成功导入' + log.success_num + '条,导入失败' + log.fail_num + '条,'
  649. },
  650. timestampToTime(timestamp) {
  651. var date = new Date(timestamp * 1000)//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  652. var Y = date.getFullYear() + '年'
  653. var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月'
  654. var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日 '
  655. var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + '时'
  656. var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + '分'
  657. var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds())+'秒'
  658. return Y + M + D + h + m + s
  659. },
  660. generateLog() {
  661. let params = {
  662. 'log_type': 1
  663. }
  664. generateLog(params).then(
  665. response => {
  666. if (response.data.state === 1) {
  667. this.logs = response.data.data.logs
  668. this.exportLogVisible = true
  669. } else {
  670. this.$message.error(response.data.msg)
  671. }
  672. }
  673. )
  674. },
  675. handleSuccess({ results, header }) {
  676. if (header != undefined && header.length > 0) {
  677. var isHasName = header.includes('*姓名')
  678. var isHasGender = header.includes('*性别')
  679. var isHasPhone = header.includes('*手机号')
  680. var isHasIdCard = header.includes('*身份证号')
  681. var isHasDate = header.includes('*首次肾脏治疗时间')
  682. var isHasSource = header.includes('*患者来源')
  683. var isHasLapseto = header.includes('*治疗状态')
  684. var isHasInfectious = header.includes('*传染病')
  685. var isHasDiagnose = header.includes('诊断')
  686. if (!(isHasName && isHasGender && isHasPhone && isHasIdCard && isHasDate && isHasSource && isHasLapseto && isHasInfectious && isHasDiagnose)) {
  687. this.dialogVisible = true
  688. return
  689. }
  690. }else{
  691. this.dialogVisible = true
  692. return
  693. }
  694. this.export_date = []
  695. for (let i = 1; i < results.length; i++) {
  696. let obj = {}
  697. for (var key in results[i]) {
  698. if (results[i]['*姓名'] === undefined) {
  699. obj['name'] = ''
  700. } else {
  701. if (key == '*姓名') {
  702. obj['name'] = results[i][key]
  703. }
  704. }
  705. if (results[i]['*性别'] === undefined) {
  706. obj['gender'] = '0'
  707. } else {
  708. if (key == '*性别') {
  709. if (results[i][key] == '男') {
  710. obj['gender'] = '1'
  711. } else if (results[i][key] == '女') {
  712. obj['gender'] = '2'
  713. } else {
  714. obj['gender'] = '0'
  715. }
  716. }
  717. }
  718. if (results[i]['*手机号'] === undefined) {
  719. obj['phone'] = ''
  720. } else {
  721. if (key == '*手机号') {
  722. obj['phone'] = results[i][key].trim()
  723. }
  724. }
  725. if (results[i]['*身份证号'] === undefined) {
  726. obj['id_card_no'] = ''
  727. } else {
  728. if (key == '*身份证号') {
  729. obj['id_card_no'] = results[i][key].trim()
  730. }
  731. }
  732. if (results[i]['*首次肾脏治疗时间'] === undefined) {
  733. obj['first_treatment_date'] = ''
  734. } else {
  735. if (key == '*首次肾脏治疗时间') {
  736. var month = parseInt(results[i][key].trim().split('/')[0])
  737. var day = parseInt(results[i][key].trim().split('/')[1])
  738. var year = parseInt(results[i][key].trim().split('/')[2])
  739. if (day < 10) {
  740. day = '0' + day
  741. }
  742. if (month < 10) {
  743. month = '0' + month
  744. }
  745. obj['first_treatment_date'] = '20' + year + '/' + month + '/' + day
  746. }
  747. }
  748. if (results[i]['*患者来源'] === undefined) {
  749. obj['source'] = '0'
  750. } else {
  751. if (key == '*患者来源') {
  752. if (results[i][key] == '门诊') {
  753. obj['source'] = '1'
  754. } else if (results[i][key] == '住院') {
  755. obj['source'] = '2'
  756. } else {
  757. obj['source'] = '0'
  758. }
  759. }
  760. }
  761. if (results[i]['*治疗状态'] === undefined) {
  762. obj['lapseto'] = '0'
  763. } else {
  764. if (key == '*治疗状态') {
  765. if (results[i][key] == '留治') {
  766. obj['lapseto'] = '1'
  767. } else if (results[i][key] == '转归') {
  768. obj['lapseto'] = '2'
  769. } else {
  770. obj['lapseto'] = '0'
  771. }
  772. }
  773. }
  774. if (results[i]['*传染病'] === undefined) {
  775. let contagions = []
  776. obj['is_infectious'] = '0'
  777. obj['contagions'] = contagions
  778. } else {
  779. if (key == '*传染病') {
  780. if (results[i][key] == '无') {
  781. let contagions = []
  782. obj['is_infectious'] = '1'
  783. obj['contagions'] = contagions
  784. } else if (results[i][key] == '乙肝') {
  785. let contagions = []
  786. contagions.push(2)
  787. obj['is_infectious'] = '2'
  788. obj['contagions'] = contagions
  789. } else if (results[i][key] == '丙肝') {
  790. let contagions = []
  791. contagions.push(3)
  792. obj['is_infectious'] = '2'
  793. obj['contagions'] = contagions
  794. } else if (results[i][key] == '艾滋病') {
  795. let contagions = []
  796. contagions.push(4)
  797. obj['is_infectious'] = '2'
  798. obj['contagions'] = contagions
  799. } else if (results[i][key] == '肺结核') {
  800. let contagions = []
  801. contagions.push(5)
  802. obj['is_infectious'] = '2'
  803. obj['contagions'] = contagions
  804. } else if (results[i][key] == '梅毒') {
  805. let contagions = []
  806. contagions.push(6)
  807. obj['is_infectious'] = '2'
  808. obj['contagions'] = contagions
  809. } else {
  810. let contagions = []
  811. obj['is_infectious'] = '0'
  812. obj['contagions'] = contagions
  813. }
  814. }
  815. }
  816. if (results[i]['诊断'] === undefined) {
  817. obj['diagnose'] = ''
  818. } else {
  819. if (key == '诊断') {
  820. obj['diagnose'] = results[i][key]
  821. }
  822. }
  823. }
  824. this.export_date.push(obj)
  825. }
  826. let params = {
  827. 'patients': this.export_date
  828. }
  829. postExportPatients(params).then(
  830. response => {
  831. if (response.data.state === 1) {
  832. this.getList()
  833. } else {
  834. this.$message.error(response.data.msg)
  835. }
  836. }
  837. )
  838. },
  839. getCount(row) {
  840. console.log(row)
  841. return row.total_dialysis + row.user_sys_before_count
  842. },
  843. EditLapseto() {
  844. if (this.lapsetoForm.lapseto_time == '') {
  845. this.$message.error('请选择时间')
  846. return
  847. }
  848. EditLapseto(this.lapsetoForm.patient_id, this.lapsetoForm).then(
  849. response => {
  850. if (response.data.state === 1) {
  851. this.$notify({
  852. title: '成功',
  853. message: '转归设置完成',
  854. type: 'success',
  855. duration: 2000
  856. })
  857. this.tableData[
  858. this.currentIndex
  859. ].lapseto = this.lapsetoForm.lapseto_type
  860. this.currentIndex = -1
  861. this.LapsetoDialogVisible = false
  862. } else {
  863. this.$message.error(response.data.msg)
  864. }
  865. }
  866. )
  867. },
  868. OpenSetLapseto(row, index) {
  869. this.patient = row
  870. this.currentIndex = index
  871. this.lapsetoForm.lapseto_time = ''
  872. this.lapsetoForm.lapseto_type = row.lapseto
  873. this.lapsetoForm.patient_id = row.id
  874. this.LapsetoDialogVisible = true
  875. },
  876. LapsetoInfo(row) {
  877. if (
  878. typeof row.lapseto === 'undefined' ||
  879. (row.lapseto !== 1 && row.lapseto !== 2)
  880. ) {
  881. return '未设置'
  882. } else if (row.lapseto === 1) {
  883. return '留治'
  884. } else {
  885. return '转出'
  886. }
  887. },
  888. openWechatBindDialog() {
  889. this.bindWechatDialog = true
  890. },
  891. handleCheckAllChange(val) {
  892. console.log(val)
  893. console.log(this.checkAll)
  894. console.log(this.isIndeterminate)
  895. },
  896. handleSelectionChange(val) {
  897. this.multipleSelection = val
  898. this.pageSelect = this.multipleSelection.length
  899. },
  900. handleCheckedCitiesChange(value) {
  901. const checkedCount = value.length;
  902. this.checkAll = checkedCount === this.cities.length;
  903. this.isIndeterminate =
  904. checkedCount > 0 && checkedCount < this.cities.length;
  905. },
  906. handleSizeChange(val) {
  907. this.listQuery.limit = val;
  908. this.getList();
  909. },
  910. handleCurrentChange(val) {
  911. this.listQuery.page = val;
  912. this.getList();
  913. },
  914. changeCategoryId(categoryId) {
  915. this.categoryId = categoryId;
  916. },
  917. selectSchedulType(scheduleType) {
  918. // alert(scheduleType);/
  919. this.schedulType = scheduleType;
  920. this.listQuery.schedul_type = scheduleType;
  921. this.getList();
  922. },
  923. selectSystemType(systemType) {
  924. this.systemType = systemType;
  925. this.listQuery.binding_state = systemType;
  926. this.getList();
  927. },
  928. selectLapseTo(lapseto) {
  929. this.lapsetoType = lapseto;
  930. this.listQuery.lapseto = lapseto;
  931. this.getList();
  932. },
  933. selectSource(source) {
  934. this.sourceType = source;
  935. this.listQuery.source = source;
  936. this.getList();
  937. },
  938. changeTimeOne(val) {
  939. var time = this.getTimestamp(val) - this.end_time;
  940. if (time > 0) {
  941. this.$message.error("结束时间不能小于开始时间");
  942. this.listQuery.start_time = "";
  943. } else {
  944. this.getList();
  945. this.startTime = this.getTimestamp(val);
  946. }
  947. },
  948. changeTime(val) {
  949. var time = this.getTimestamp(val) - this.startTime;
  950. if (time < 0) {
  951. this.$message.error("结束时间不能小于开始时间");
  952. this.listQuery.end_time = "";
  953. } else {
  954. this.getList();
  955. this.end_time = this.getTimestamp(val);
  956. }
  957. },
  958. getTimestamp(time) {
  959. // 把时间日期转成时间戳
  960. return new Date(time).getTime() / 1000;
  961. },
  962. search() {
  963. this.listQuery.keywords = this.searchKey;
  964. this.getList();
  965. },
  966. changeOtherSearch() {
  967. this.getList();
  968. },
  969. getList() {
  970. fetchList(this.listQuery).then(response => {
  971. if (response.data.state === 0) {
  972. this.$message.error(response.data.msg);
  973. return false;
  974. } else {
  975. this.tableData = response.data.data.patients;
  976. // console.log('病人是', this.tableData)
  977. this.pageTotal = this.tableData.length;
  978. this.total = response.data.data.total;
  979. }
  980. });
  981. },
  982. OpenView(name, number, id) {
  983. this.name = name
  984. this.dialysis_no = number
  985. this.centerDialogVisible = true
  986. OpenView(id).then(response => {
  987. if (response.data.state === 0) {
  988. this.$message.error(response.data.msg)
  989. return false
  990. } else {
  991. var patient = response.data.data.patient
  992. console.log('二维码病人信息', patient)
  993. this.id = patient.id
  994. this.name = patient.name
  995. this.gender = patient.gender
  996. this.idcardno = patient.id_card_no
  997. this.phone = patient.phone
  998. this.healthcareno = patient.health_care_no
  999. }
  1000. })
  1001. },
  1002. ShowQRCode() {
  1003. document.getElementById('qrcode').innerHTML = ''
  1004. this.qrcode = this.$QRCode()
  1005. },
  1006. download() {
  1007. alert('aaaa')
  1008. },
  1009. print() {
  1010. var ptime = Math.round(new Date().getTime() / 1000)
  1011. this.print_time = uParseTime(ptime, '{y}年{m}月{d}日')
  1012. const style =
  1013. '@media print { .print_main_content { background-color: white; width:960px; margin:0 auto; padding: 0 0 20px 0; } .print_main_content .order_title { text-align: center; font-size: 23px; line-height: 50px; font-weight: 500; } .print_main_content table { width: 100%; border: 1px solid; border-collapse: collapse; padding: 2px; } .print_main_content table tbody tr td { border: 1px solid; text-align: center; padding: 10px 8px; } .td_proj_title { font-size: 18px; line-height: 25px; font-weight: 500; } .td_proj_content { font-size: 18px; line-height: 25px; } .td_align_left { text-align: left; } .print_footnote_panel { font-size: 17px; line-height: 40px; } .print_footnote_panel .proj { display: inline-block; width: 49%; } .print_footnote_panel .proj .proj_title { font-weight: 500;} }'
  1014. setTimeout(() => {
  1015. printJS({
  1016. printable: 'print-card-info',
  1017. type: 'html',
  1018. style: style,
  1019. scanStyles: false
  1020. })
  1021. }, 1)
  1022. var id = this.id
  1023. var name = this.name
  1024. var gender = this.gender
  1025. if (gender === 1) {
  1026. gender = '男'
  1027. }
  1028. if (gender === 2) {
  1029. gender = '女'
  1030. }
  1031. var idcardno = this.idcardno
  1032. var phone = this.phone
  1033. var healthcareno = this.healthcareno
  1034. var dialysisno = this.dialysis_no
  1035. // Base64位加密
  1036. // var aid = this.Base64.encode(id);
  1037. // var aname = this.Base64.encode(name);
  1038. // var agender = this.Base64.encode(gender);
  1039. // var aidcardno = this.Base64.encode(idcardno);
  1040. // var aphone = this.Base64.encode(phone);
  1041. // var ahealthcareno = this.Base64.encode(healthcareno);
  1042. // var adialysisno = this.Base64.encode(dialysisno);
  1043. // 调用生成二维码的方法
  1044. this.$options.methods.qrcode(
  1045. id,
  1046. name,
  1047. gender,
  1048. idcardno,
  1049. phone,
  1050. healthcareno,
  1051. dialysisno
  1052. )
  1053. },
  1054. qrcode(id, name, gender, idcardno, phone, healthcareno, dialysisno) {
  1055. document.getElementById('code').innerHTML = ''
  1056. const qrcode = new QRCode('code', {
  1057. width: 200,
  1058. height: 200,
  1059. text:
  1060. 'user_id:' +
  1061. id +
  1062. ',' +
  1063. 'name:' +
  1064. name +
  1065. ',' +
  1066. 'dialysis_no:' +
  1067. dialysisno +
  1068. ',' +
  1069. 'gender:' +
  1070. gender +
  1071. ',' +
  1072. 'idcard_no:' +
  1073. idcardno +
  1074. ',' +
  1075. 'phone:' +
  1076. phone +
  1077. ',' +
  1078. 'healthcare_no:' +
  1079. healthcareno
  1080. })
  1081. }
  1082. // components:{
  1083. // pagiNation
  1084. // }
  1085. }
  1086. }
  1087. Vue.prototype.$QRCode = function() {
  1088. var name = this.name
  1089. var dialysis_no = this.dialysis_no
  1090. var id = this.id
  1091. var gender = this.gender
  1092. if (gender === 1) {
  1093. gender = '男'
  1094. }
  1095. if (gender === 2) {
  1096. gender = '女'
  1097. }
  1098. var idcardno = this.idcardno
  1099. var phone = this.phone
  1100. var healthcareno = this.healthcareno
  1101. // BASE64加密
  1102. // var eid = this.Base64.encode(id)
  1103. // var ename = this.Base64.encode(name)
  1104. // var egender = this.Base64.encode(gender)
  1105. // var eidcardno = this.Base64.encode(idcardno)
  1106. // var ephone = this.Base64.encode(phone)
  1107. // var ehealthcareno = this.Base64.encode(healthcareno)
  1108. // var edialysisno = this.Base64.encode(dialysis_no)
  1109. var eid = id
  1110. var ename = name
  1111. var egender = gender
  1112. var eidcardno = idcardno
  1113. var ephone = phone
  1114. var ehealthcareno = healthcareno
  1115. var edialysisno = dialysis_no
  1116. console.log(
  1117. 'user_id' + eid,
  1118. 'name:' + ename,
  1119. 'gender:' + egender,
  1120. 'idcard_no:' + eidcardno,
  1121. 'phone:' + ephone,
  1122. 'healthcare_no:' + ehealthcareno,
  1123. 'edialysis_no:' + edialysisno
  1124. )
  1125. const salting = 'admin-authority'
  1126. new QRCode('qrcode', {
  1127. width: 150, // 设置宽度
  1128. height: 150, // 设置高度
  1129. text:
  1130. 'user_id:' +
  1131. eid +
  1132. ',' +
  1133. 'name:' +
  1134. ename +
  1135. ',' +
  1136. 'dialysis_no:' +
  1137. edialysisno +
  1138. ',' +
  1139. 'gender:' +
  1140. egender +
  1141. ',' +
  1142. 'idcard_no:' +
  1143. eidcardno +
  1144. ',' +
  1145. 'phone:' +
  1146. ephone +
  1147. ',' +
  1148. 'healthcare_no:' +
  1149. ehealthcareno
  1150. })
  1151. }
  1152. </script>
  1153. <style rel="stylesheet/scss" lang="scss">
  1154. .app-container {
  1155. /*margin: 20 px;*/
  1156. font-size: 15px;
  1157. .filter-container {
  1158. padding-bottom: 5px;
  1159. }
  1160. .search-component {
  1161. width: 500px;
  1162. .searchBox {
  1163. width: 300px;
  1164. height: 36px;
  1165. line-height: 36px;
  1166. padding-left: 15px;
  1167. border: 1px #dcdfe6 solid;
  1168. border-right: none;
  1169. outline: none;
  1170. float: left;
  1171. border-radius: 6px 0 0 6px;
  1172. font-size: 14px;
  1173. color: #333;
  1174. background: #fff;
  1175. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  1176. }
  1177. .searchBtn {
  1178. background-color: #409eff;
  1179. color: #fff;
  1180. font-size: 15px;
  1181. text-align: center;
  1182. height: 36px;
  1183. line-height: 36px;
  1184. float: left;
  1185. outline: none;
  1186. width: 70px;
  1187. border: none;
  1188. border-radius: 0 6px 6px 0;
  1189. font-family: "Microsoft Yahei";
  1190. cursor: pointer;
  1191. }
  1192. }
  1193. .amount {
  1194. font-weight: normal;
  1195. padding: 10px 0 0 0;
  1196. color: #606266;
  1197. font-size: 14px;
  1198. span {
  1199. color: #ef2525;
  1200. font-family: "Arial";
  1201. padding: 0 2px;
  1202. }
  1203. }
  1204. .print_main_content {
  1205. background-color: white;
  1206. width: 960px;
  1207. margin: 0 auto;
  1208. padding: 0 0 20px 0;
  1209. }
  1210. .print_main_content .order_title {
  1211. text-align: center;
  1212. font-size: 23px;
  1213. line-height: 50px;
  1214. font-weight: 500px;
  1215. }
  1216. .print_main_content table {
  1217. width: 100%;
  1218. border: 1px solid;
  1219. border-collapse: collapse;
  1220. padding: 2px;
  1221. }
  1222. .print_main_content table tbody tr td {
  1223. border: 1px solid;
  1224. text-align: center;
  1225. /* font-size: 17px; */
  1226. padding: 10px 8px;
  1227. }
  1228. .td_proj_title {
  1229. font-size: 18px;
  1230. line-height: 25px;
  1231. font-weight: 500;
  1232. }
  1233. .td_proj_content {
  1234. font-size: 18px;
  1235. line-height: 25px;
  1236. }
  1237. .td_align_left {
  1238. text-align: left;
  1239. }
  1240. .print_footnote_panel {
  1241. font-size: 17px;
  1242. line-height: 40px;
  1243. }
  1244. .print_footnote_panel .proj {
  1245. display: inline-block;
  1246. width: 49%;
  1247. }
  1248. .print_footnote_panel .proj .proj_title {
  1249. font-weight: 500;
  1250. }
  1251. }
  1252. .el-table td,
  1253. .el-table th.is-leaf,
  1254. .el-table--border,
  1255. .el-table--group {
  1256. border-color: #d0d3da;
  1257. }
  1258. .el-table--border::after,
  1259. .el-table--group::after,
  1260. .el-table::before {
  1261. background-color: #d0d3da;
  1262. }
  1263. .el-select--small {
  1264. width: 196px;
  1265. }
  1266. .el-checkbox__inner::after {
  1267. height: 10px;
  1268. left: 7px;
  1269. }
  1270. .el-checkbox__inner {
  1271. width: 20px;
  1272. height: 20px;
  1273. }
  1274. </style>