pastInquiries.vue 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container">
  7. <div class="cell clearfix">
  8. <el-input
  9. size="small"
  10. style="width: 150px"
  11. v-model="keywords"
  12. class="filter-item"
  13. />
  14. <el-button
  15. size="small"
  16. style="margin: 0 10px"
  17. class="filter-item"
  18. type="primary"
  19. @click="searchAction"
  20. >搜索
  21. </el-button>
  22. <el-date-picker
  23. v-model="record_date"
  24. prefix-icon="el-icon-date"
  25. @change="handleScheduleDateChange"
  26. :editable="false"
  27. :clearable="false"
  28. style="width: 196px; margin-right: 10px"
  29. type="date"
  30. format="yyyy-MM-dd"
  31. value-format="yyyy-MM-dd"
  32. placeholder="选择日期时间"
  33. align="right"
  34. ></el-date-picker>
  35. <el-button
  36. size="small"
  37. style="margin: 0 10px"
  38. class="filter-item"
  39. type="primary"
  40. @click="batchPrint(1)"
  41. >处方筏批量打印
  42. </el-button
  43. >
  44. <el-button
  45. size="small"
  46. style="margin: 0 10px"
  47. class="filter-item"
  48. type="primary"
  49. @click="batchPrint(2)"
  50. >治疗单批量打印
  51. </el-button
  52. >
  53. <el-button
  54. size="small"
  55. style="margin: 0 10px"
  56. class="filter-item"
  57. type="primary"
  58. @click="batchPrint(3)"
  59. >检验单批量打印
  60. </el-button
  61. >
  62. </div>
  63. <el-table
  64. :data="tableData"
  65. border
  66. ref="table"
  67. style="width: 100%"
  68. :row-style="{ color: '#303133' }"
  69. @selection-change="handleSelectionChange"
  70. :header-cell-style="{
  71. backgroundColor: 'rgb(245, 247, 250)',
  72. color: '#606266',
  73. }"
  74. highlight-current-row
  75. >
  76. <el-table-column
  77. align="center"
  78. type="selection"
  79. width="55"
  80. ></el-table-column>
  81. <el-table-column
  82. align="center"
  83. label="序号"
  84. width="60"
  85. type="index"
  86. ></el-table-column>
  87. <el-table-column align="center" prop="name" label="姓名" width="100">
  88. <template slot-scope="scope">{{
  89. scope.row.patients ? scope.row.patients.name : ''
  90. }}
  91. </template>
  92. </el-table-column>
  93. <el-table-column
  94. align="center"
  95. prop="name"
  96. label="处方日期"
  97. width="200"
  98. >
  99. <template slot-scope="scope">
  100. {{ getTimes(scope.row.ctime) }}
  101. </template
  102. >
  103. </el-table-column>
  104. <!--<el-table-column align="center" prop="name" label="患者类型">-->
  105. <!--<template slot-scope="scope">{{}}</template>-->
  106. <!--</el-table-column>-->
  107. <el-table-column align="center" prop="name" label="处方号">
  108. <template slot-scope="scope">{{
  109. scope.row.prescription_number
  110. }}
  111. </template>
  112. </el-table-column>
  113. <el-table-column align="center" prop="name" label="开立医生">
  114. <template slot-scope="scope">{{ scope.row.doctor }}</template>
  115. </el-table-column>
  116. <el-table-column align="center" prop="name" label="诊断">
  117. <template slot-scope="scope">{{
  118. getDiagnosis(scope.row.diagnosis)
  119. }}
  120. </template>
  121. </el-table-column>
  122. <el-table-column align="center" prop="name" label="状态" width="100">
  123. <template slot-scope="scope">
  124. <div v-if="scope.row.id > 0">已就诊</div>
  125. <div v-else>未就诊</div>
  126. </template>
  127. </el-table-column>
  128. <el-table-column align="center" prop="name" label="操作" width="100">
  129. <template slot-scope="scope">
  130. <el-button
  131. size="mini"
  132. type="primary"
  133. @click="handerShowDetail(scope.row)"
  134. >详情
  135. </el-button
  136. >
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <el-pagination
  141. @size-change="handleSizeChange"
  142. @current-change="handleCurrentChange"
  143. :page-sizes="[10, 50, 100]"
  144. :page-size="10"
  145. background
  146. style="margin-top: 20px; float: right"
  147. layout="total, sizes, prev, pager, next, jumper"
  148. :total="total"
  149. >
  150. </el-pagination>
  151. <inquiries-detail ref="inquiriesDetail"></inquiries-detail>
  152. <el-dialog
  153. class="centerDialog"
  154. width="600px"
  155. title="打印"
  156. :visible.sync="innerVisible"
  157. append-to-body
  158. >
  159. <template>
  160. <el-button
  161. style="float: right"
  162. size="small"
  163. icon="el-icon-printer"
  164. @click="printThisPage(printData)"
  165. type="primary"
  166. >打印
  167. </el-button>
  168. </template>
  169. <div id="printMain">
  170. <print
  171. ref="print"
  172. v-if="printType == 1"
  173. :printData="printData"
  174. ></print>
  175. <treatPrint
  176. ref="treatPrint"
  177. v-if="printType == 2"
  178. :printData="printData"
  179. ></treatPrint>
  180. <checkPrint
  181. ref="checkPrint"
  182. v-if="printType == 3"
  183. :printData="printData"
  184. ></checkPrint>
  185. </div>
  186. </el-dialog>
  187. </div>
  188. </div>
  189. </template>
  190. <script>
  191. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  192. import inquiriesDetail from './components/inquiriesDetail'
  193. import { getBatchPrint, getHisPrescriptionList, getInitData } from '@/api/his/his'
  194. import { uParseTime } from '@/utils/tools'
  195. import print from './batch_print_template/index'
  196. import treatPrint from './batch_print_treatTemplate/index'
  197. import checkPrint from './batch_print_checkTemplate/index'
  198. export default {
  199. components: {
  200. BreadCrumb,
  201. inquiriesDetail,
  202. print,
  203. treatPrint,
  204. checkPrint
  205. },
  206. data() {
  207. return {
  208. keywords: '',
  209. total: 0,
  210. record_date: '',
  211. page: 1,
  212. limit: 10,
  213. crumbs: [
  214. { path: false, name: '门诊医生站' },
  215. { path: false, name: '既往查询' }
  216. ],
  217. tableData: [],
  218. diagnoses: [],
  219. innerVisible: false,
  220. selecting_schs: [],
  221. printData: [],
  222. printType: 0,
  223. org_id: ''
  224. }
  225. },
  226. methods: {
  227. printThisPage(printData) {
  228. printData.forEach((item) => {
  229. const print = new Promise((resolve, reject) => {
  230. if (item.prescriptions.length != 0) {
  231. resolve(item.prescriptions)
  232. } else {
  233. reject(false)
  234. }
  235. })
  236. print
  237. .then((printData) => {
  238. if (this.org_id == 10138) {
  239. const style =
  240. '@media print {#prescription-print{font-size:14px;border:1px solid white}.prescription-print:last-child {page-break-after: auto;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;margin-bottom: 10px;}.infoTitle{display: flex;margin-top:10px;}.infoTitle div{width: 200px;}.infoMain{display: flex;flex-wrap: wrap;margin-top:10px;}.infoMain div{width: 50%;line-height: 24px;}.prescriptionBox{min-height:350px;}.Rp{font-size: 18px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;}.drugsOne{line-height: 24px;}.drugsOne span{margin-right: 20px;}.doctorBox{display: flex;justify-content: space-between;padding:0 10px;line-height: 24px;border-bottom: 2px solid #000;}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar p{width:150px;}.under_line{display: inline-block;border-bottom: 1px solid #000;flex: 1;}@media print {html {zoom: 88%;}}#prescription-print{font-size:14px;border:1px solid white}.prescription-print:last-child {page-break-after: auto;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;margin-bottom: 10px;}.infoTitle{display: flex;margin-top:10px;}.infoTitle div{width: 200px;}.infoMain{display: flex;flex-wrap: wrap;margin-top:10px;}.infoMain div{width: 50%;line-height: 24px;}.prescriptionBox{min-height:350px;}.Rp{font-size: 18px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;}.drugsOne{line-height: 24px;}.drugsOne span{margin-right: 20px;}.doctorBox{display: flex;justify-content: space-between;padding:0 10px;line-height: 24px;border-bottom: 2px solid #000;}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar p{width:150px;}.under_line{display: inline-block;border-bottom: 1px solid #000;flex: 1;}@media print {html {zoom: 87%;}}}'
  241. printJS({
  242. printable: 'printMain',
  243. type: 'html',
  244. style: style,
  245. scanStyles: false
  246. })
  247. }
  248. if (this.printType == 3) {
  249. const style =
  250. '@media print {html {zoom: 80%;}}#prescription-print{font-size:14px;border:1px solid white}.prescription-print:last-child {page-break-after: auto;}#prescriptionPrint div{box-shadow:none;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;margin-bottom: 20px;}.infoTitle{display: flex;margin-top:10px;line-height: 24px;}.infoTitle div{width: 200px;}.infoMain{display: flex;flex-wrap: wrap;margin-top:10px;}.infoMain div{width: 50%;line-height: 24px;}.prescriptionBox{min-height:450px;}.Rp{font-size: 18px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;}.drugsOne{line-height: 24px;}.drugsOne span{margin-right: 20px;}.doctorBox{display: flex;justify-content: space-between;padding:0 10px;line-height: 24px;border-bottom: 2px solid #000;}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar p{width:150px;}.under_line{display: inline-block;border-bottom: 1px solid #000;flex: 1;}.NoCell{display: flex;justify-content: space-between;margin-bottom: 10px;}.underLine{display: inline-block;border-bottom: 1px solid #000;text-align: center;line-height: 24px;}.basicCell{display: flex;} .basicCell span{line-height: 24px;margin-bottom: 10px;}}'
  251. printJS({
  252. printable: 'printMain',
  253. type: 'html',
  254. style: style,
  255. scanStyles: false
  256. })
  257. } else {
  258. const style =
  259. '@media print {html {height: auto;margin: 0px;} #prescription-print{font-size:14px;border:1px solid white;margin-bottom:40px;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;margin-bottom: 10px;}.infoTitle{display: flex;border-bottom: 2px solid #000;margin-top:10px;line-height: 1px; padding:0 10px;}.infoTitle p{width: 200px;font-size:14px;}.infoMain{display: flex;flex-wrap: wrap;border-bottom: 2px solid #000;padding:0 10px;}.infoMain div{width: 50%;line-height: 24px;}.prescriptionBox{min-height:450px;}.Rp{font-size: 18px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;}.drugsOne{line-height: 24px;}.drugsOne span{margin-right: 20px;}.doctorBox{display: flex;justify-content: space-between;padding:0 10px;line-height: 24px;border-bottom: 2px solid #000;}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar p{width:150px;}.under_line{display: inline-block;border-bottom: 1px solid #000;flex: 1;}@media print {html {zoom: 80%;}}#prescription-print{font-size:14px;border:1px solid white}.prescription-print:last-child {page-break-after: auto;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;margin-bottom: 20px;}.infoTitle{display: flex;margin-top:10px;line-height: 24px;}.infoTitle div{width: 200px;}.infoMain{display: flex;flex-wrap: wrap;margin-top:10px;}.infoMain div{width: 50%;line-height: 24px;}.prescriptionBox{min-height:450px;}.Rp{font-size: 18px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;}.drugsOne{line-height: 24px;}.drugsOne span{margin-right: 20px;}.doctorBox{display: flex;justify-content: space-between;padding:0 10px;line-height: 24px;border-bottom: 2px solid #000;}.actionBar{display: flex;justify-content: space-between; line-height: 24px;padding:0 10px;}.actionBar p{width:150px;}.under_line{display: inline-block;border-bottom: 1px solid #000;flex: 1;}.NoCell{display: flex;justify-content: space-between;margin-bottom: 10px;}.underLine{display: inline-block;border-bottom: 1px solid #000;text-align: center;line-height: 24px;}.basicCell{display: flex;} .basicCell span{line-height: 24px;margin-bottom: 10px;}}'
  260. printJS({
  261. printable: 'printMain',
  262. type: 'html',
  263. style: style,
  264. scanStyles: false
  265. })
  266. }
  267. })
  268. .catch((reject) => {
  269. })
  270. })
  271. this.innerVisible = false
  272. // this.$nextTick(() => {
  273. // this.$refs.print.printThisPage()
  274. // this.$refs.treatPrint.printThisPage()
  275. // this.$refs.checkPrint.printThisPage()
  276. // })
  277. },
  278. searchAction() {
  279. this.page = 1
  280. this.limit = 10
  281. this.getHisPrescriptionList()
  282. },
  283. handleScheduleDateChange() {
  284. this.page = 1
  285. this.limit = 10
  286. this.getHisPrescriptionList()
  287. },
  288. handleCurrentChange(page) {
  289. this.page = page
  290. this.getHisPrescriptionList()
  291. },
  292. handleSizeChange(limit) {
  293. this.limit = limit
  294. this.getHisPrescriptionList()
  295. },
  296. getTimes(time) {
  297. return uParseTime(time, '{y}-{m}-{d} {h}:{i}:{s}')
  298. },
  299. handerShowDetail(row) {
  300. if (row.id == 0) {
  301. this.$message.error('未就诊')
  302. return
  303. }
  304. this.$refs.inquiriesDetail.show(row.id)
  305. },
  306. getHisPrescriptionList() {
  307. let params = {
  308. record_date: this.record_date,
  309. page: this.page,
  310. limit: this.limit,
  311. keywords: this.keywords
  312. }
  313. getHisPrescriptionList(params).then((response) => {
  314. if (response.data.state == 0) {
  315. this.$message.error(response.data.msg)
  316. return false
  317. } else {
  318. this.tableData = response.data.data.order
  319. this.total = response.data.data.total
  320. this.$nextTick(() => {
  321. this.$refs.table.doLayout() //解决表格错位
  322. })
  323. }
  324. })
  325. },
  326. getInitData() {
  327. getInitData().then((response) => {
  328. if (response.data.state == 0) {
  329. this.$message.error(response.data.msg)
  330. return false
  331. } else {
  332. this.diagnoses = response.data.data.diagnose
  333. console.log('诊断列表', this.diagnoses)
  334. }
  335. })
  336. },
  337. getDiagnosis(id) {
  338. let ids = id.split(',')
  339. var name = ''
  340. for (let i = 0; i < ids.length; i++) {
  341. for (let b = 0; b < this.diagnoses.length; b++) {
  342. if (parseInt(ids[i]) == this.diagnoses[b].id) {
  343. if (name.length == 0) {
  344. name = this.diagnoses[b].class_name
  345. } else {
  346. name = name + ',' + this.diagnoses[b].class_name
  347. }
  348. }
  349. }
  350. }
  351. return name
  352. },
  353. handleSelectionChange(val) {
  354. this.selecting_schs = val
  355. },
  356. batchPrint(type) {
  357. this.printType = type
  358. if (this.selecting_schs.length === 0) {
  359. this.$message.error('请至少选择一条需要打印的内容')
  360. return false
  361. } else {
  362. var sch_ids = []
  363. for (let index = 0; index < this.selecting_schs.length; index++) {
  364. sch_ids.push(this.selecting_schs[index].patient_id)
  365. }
  366. let params = {
  367. record_date: this.record_date,
  368. patient_ids: sch_ids.join(','),
  369. type: type
  370. }
  371. getBatchPrint(params).then((res) => {
  372. let Arr = res.data.data.patients
  373. let new_patients = []
  374. if (type != 3) {
  375. Arr.forEach((i) => {
  376. if (i.prescriptions.length != 0) {
  377. new_patients.push(i)
  378. }
  379. })
  380. } else {
  381. // 过滤检查单数据出来,筛选出有检查项目的单子,不显示没有检查项目的单子
  382. Arr.forEach((el) => {
  383. el.prescriptions.forEach((o) => {
  384. o.project.forEach((i) => {
  385. if (i.team.project_team != '') {
  386. new_patients.push(el)
  387. }
  388. })
  389. })
  390. })
  391. let projectPrint = []
  392. new_patients.forEach((el) => {
  393. el.prescriptions.map((item) => {
  394. if (item.project.length > 0) {
  395. item.project.map((it) => {
  396. projectPrint.push(it)
  397. })
  398. }
  399. })
  400. })
  401. // 数组去重
  402. projectPrint = this.split_project(projectPrint)
  403. // 配对
  404. let data = []
  405. projectPrint.map((item) => {
  406. if (item.team.id == 0) {
  407. data.push(item)
  408. } else {
  409. if (item.team.project_team != '') {
  410. new_patients.push(item)
  411. }
  412. }
  413. })
  414. new_patients = this.split_project_1(new_patients)
  415. }
  416. this.printData = new_patients
  417. console.log(this.printData, 'this.printData')
  418. })
  419. }
  420. this.innerVisible = true
  421. },
  422. // 外层去重方
  423. split_project(Arr) {
  424. let hash = {}
  425. let new_Arr = []
  426. new_Arr = Arr.reduce((preVal, curVal) => {
  427. hash[curVal.id] ? '' : (hash[curVal.id] = true && preVal.push(curVal))
  428. return preVal
  429. }, [])
  430. Arr = new_Arr.reduce((preVal, curVal) => {
  431. hash[curVal.team.project_team]
  432. ? ''
  433. : (hash[curVal.team.project_team] = true && preVal.push(curVal))
  434. return preVal
  435. }, [])
  436. return Arr
  437. },
  438. // 内层去重
  439. split_project_1(Arr) {
  440. let hash = {}
  441. let new_Arr = []
  442. Arr = Arr.reduce((preVal, curVal) => {
  443. hash[curVal.id] ? '' : (hash[curVal.id] = true && preVal.push(curVal))
  444. return preVal
  445. }, [])
  446. Arr.forEach(el => {
  447. if (el.name) {
  448. new_Arr.push(el)
  449. }
  450. })
  451. console.log(new_Arr, 'Arr')
  452. return new_Arr
  453. }
  454. },
  455. created() {
  456. var nowDate = new Date()
  457. var nowYear = nowDate.getFullYear()
  458. var nowMonth = nowDate.getMonth() + 1
  459. var nowDay = nowDate.getDate()
  460. this.record_date =
  461. nowYear +
  462. '-' +
  463. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  464. '-' +
  465. (nowDay < 10 ? '0' + nowDay : nowDay)
  466. this.org_id = this.$store.getters.xt_user.template_info.org_id
  467. this.getHisPrescriptionList()
  468. this.getInitData()
  469. }
  470. }
  471. </script>