pastInquiries.vue 19KB

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