detailPrint.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <div>
  3. <div class="print_btn">
  4. <el-button type="primary" @click="printtpage">打印</el-button>
  5. </div>
  6. <div id="list-print" class="list-print">
  7. <div class="listTitle">
  8. {{ $store.getters.xt_user.org.org_name }}费用清单
  9. </div>
  10. <div class="listInfo">
  11. <div>患者姓名:{{ patient.name }}</div>
  12. <div>性别:{{ patient.gender == 1 ? "男" : "女" }}</div>
  13. <div>结算类别:
  14. {{ getType(his_patient.balance_accounts_type) }}
  15. {{getType(his_record_patient.balance_accounts_type)}}
  16. </div>
  17. <div style="min-width:300px;">发票号码:{{order.fa_piao_number}}</div>
  18. </div>
  19. <div class="listInfo">
  20. <div>住院/门诊号:
  21. {{his_patient.number}}
  22. {{his_record_patient.ipt_otp_no}}
  23. </div>
  24. <div>科室:
  25. {{ getDepartment(his_patient.departments) }}
  26. {{ getDepartment(his_record_patient.departments) }}
  27. </div>
  28. <div style="min-width:350px;">就诊流水号:
  29. {{ his_patient.number }}
  30. {{his_record_patient.number}}
  31. </div>
  32. </div>
  33. <div class="listInfo">
  34. <div>总费用:{{ getAllPice() }}</div>
  35. <div>个人支付:
  36. <span v-if="this.$route.query.balance_accounts_type == 2 && his_patient.id >0">{{ getAllPice() }}</span>
  37. <span v-if="this.$route.query.balance_accounts_type != 2 && his_patient.id >0">{{ getActPay() }}</span>
  38. <span v-if="his_record_patient.balance_accounts_type == 2">{{ getAllPice() }}</span>
  39. <span v-if="his_record_patient.balance_accounts_type != 2">{{ getActPay() }}</span>
  40. </div>
  41. <div>基金支付记账:{{ getFundPaySumamt() }}</div>
  42. <div style="min-width:300px;">补充医疗支付记账:{{ getHifesPay() }}</div>
  43. </div>
  44. <div class="listInfo">
  45. <div>救助支付金额:{{ getMafPay() }}</div>
  46. </div>
  47. <table class="listTable" border="1">
  48. <tr style="height:45px">
  49. <td width="100" style="text-align: center">序号</td>
  50. <td width="200" style="text-align: center">处方日期</td>
  51. <td width="300" style="text-align: center">费用编码</td>
  52. <td width="300" style="text-align: center">项目名称</td>
  53. <td width="180" style="text-align: center">规格</td>
  54. <td width="100" style="text-align: center">数量</td>
  55. <td width="100" style="text-align: center">单位</td>
  56. <td width="100" style="text-align: center">单价(元)</td>
  57. <td width="150" style="text-align: center">金额</td>
  58. </tr>
  59. <tr v-for="(item, index) in tableData" :key="index">
  60. <td style="text-align: center">
  61. <span v-if="item.is_total == 1">{{ index + 1 }}</span>
  62. <span v-if="item.is_total == 2">合计</span>
  63. </td>
  64. <td style="text-align: center">
  65. <span v-if="item.is_total == 1">{{getTimes(item.record_date)}}</span>
  66. </td>
  67. <td width="80" style="text-align: center">{{ item.number }}</td>
  68. <td style="text-align: center">
  69. <span v-if="item.advice_id > 0">{{ item.advice.advice_name }}</span>
  70. <span v-if="item.project_id > 0">
  71. <span v-if="item.project.type == 2">{{
  72. item.project.project.project_name
  73. }}</span>
  74. <span v-if="item.project.type == 3"
  75. >{{item.project.good_info.good_name}}</span
  76. >
  77. </span>
  78. </td>
  79. <td style="text-align: center">
  80. <span v-if="item.advice_id > 0"
  81. >{{ item.advice.drug.dose }}{{ item.advice.drug.dose_unit }}*{{
  82. item.advice.drug.min_number
  83. }}{{ item.advice.drug.min_unit }}/{{
  84. item.advice.drug.max_unit
  85. }}</span
  86. >
  87. <span v-if="item.project_id > 0">
  88. <span v-if="item.project.type == 2">{{
  89. item.project.project.project_name
  90. }}</span>
  91. <span v-if="item.project.type == 3">{{
  92. item.project.good_info.specification_name
  93. }}</span>
  94. </span>
  95. </td>
  96. <td style="text-align: center">
  97. {{ item.cnt }}
  98. </td>
  99. <td style="text-align: center">
  100. <span v-if="item.advice_id > 0">{{item.advice.prescribing_number_unit}}</span>
  101. <span v-if="item.project_id > 0">
  102. <span v-if="item.project.type == 2">{{item.project.project.unit}}</span>
  103. <span v-if="item.project.type == 3">{{item.project.good_info.packing_unit}}</span>
  104. </span>
  105. </td>
  106. <td style="text-align: center">
  107. {{ item.pric }}
  108. </td>
  109. <td style="text-align: center">
  110. {{ item.total_price }}
  111. </td>
  112. </tr>
  113. </table>
  114. </div>
  115. </div>
  116. </template>
  117. <script>
  118. import print from "print-js";
  119. import { uParseTime } from "@/utils/tools";
  120. import { getHisSummaryDetailList } from "@/api/his/his_tools";
  121. export default {
  122. data() {
  123. return {
  124. patient: {},
  125. tableData: [],
  126. list: [],
  127. his_patient: {},
  128. hisDepatment: [],
  129. settlement: [
  130. { value: 1, label: "医保" },
  131. { value: 2, label: "自费" },
  132. { value: 3, label: "公费" },
  133. { value: 4, label: "农保" },
  134. { value: 5, label: "会员" },
  135. { value: 6, label: "职工" },
  136. { value: 7, label: "合同" },
  137. { value: 8, label: "医保自费" },
  138. ],
  139. order:{},
  140. his_record_patient:{},
  141. };
  142. },
  143. methods: {
  144. printtpage() {
  145. const style =
  146. '@media print {.list-print{width:960px;margin:0 auto} .listTitle {font-size: 24px;text-align: center;font-weight: bold;margin-bottom: 10px;}.listInfo {display: flex;font-size: 16px;justify-content: space-between;margin: 10px 0;}.listTable {width: 100%;text-align: center;border-collapse: collapse;line-height: 25px;font-size: 14px;border-color: #000;text-align: left;} .listTable tr td {padding: 0 5px;}.tableBottom {font-size: 16px;display: flex;margin-top: 20px;}.tableBottomOne {margin-right: 40px;}';
  147. printJS({
  148. printable: "list-print",
  149. type: "html",
  150. style: style,
  151. scanStyles: false,
  152. });
  153. },
  154. getNowTime: function () {
  155. let dateTime;
  156. let yy = new Date().getFullYear();
  157. let mm = new Date().getMonth() + 1;
  158. let dd = new Date().getDate();
  159. let hh = new Date().getHours();
  160. let mf =
  161. new Date().getMinutes() < 10
  162. ? "0" + new Date().getMinutes()
  163. : new Date().getMinutes();
  164. let ss =
  165. new Date().getSeconds() < 10
  166. ? "0" + new Date().getSeconds()
  167. : new Date().getSeconds();
  168. dateTime = yy + "-" + mm + "-" + dd + " " + hh + ":" + mf + ":" + ss;
  169. return dateTime;
  170. },
  171. getTimes(time) {
  172. return uParseTime(time, "{y}-{m}-{d}");
  173. },
  174. getHisSummaryDetailList() {
  175. let start_time = this.$route.query.start_time;
  176. let end_time = this.$route.query.end_time;
  177. let params = {
  178. patient_id: this.$route.query.patient_id,
  179. start_time: start_time,
  180. end_time: end_time,
  181. type: this.$route.query.type,
  182. keyword: this.$route.query.keyword,
  183. };
  184. getHisSummaryDetailList(params).then((response) => {
  185. if (response.data.state == 1) {
  186. var list = response.data.data.list;
  187. this.list = list;
  188. this.patient = response.data.data.patient;
  189. this.his_patient = response.data.data.his_patient;
  190. this.his_record_patient = response.data.data.his_record_patient
  191. this.hisDepatment = response.data.data.hisDepatment;
  192. this.order = response.data.data.order
  193. this.tableData = [];
  194. for (let i = 0; i < list.length; i++) {
  195. for (let j = 0; j < list[i].orders.length; j++) {
  196. for (let z = 0; z < list[i].orders[j].order_info.length; z++) {
  197. list[i].orders[j].order_info[z].record_date =
  198. list[i].orders[j].settle_accounts_date;
  199. list[i].orders[j].order_info[z].number =
  200. list[i].orders[j].number;
  201. this.tableData.push(list[i].orders[j].order_info[z]);
  202. }
  203. }
  204. }
  205. var obj = { index: "合计", total_price: 0, record_date: "0",is_total:2 };
  206. for (let i = 0; i < this.tableData.length; i++) {
  207. this.tableData[i].index = i + 1;
  208. this.tableData[i].total_price = 0;
  209. this.tableData[i].is_total = 1
  210. this.tableData[i].total_price = (
  211. this.tableData[i].cnt * this.tableData[i].pric).toFixed(2);
  212. obj.total_price += this.tableData[i].cnt * this.tableData[i].pric;
  213. }
  214. obj.total_price = obj.total_price.toFixed(2);
  215. this.tableData.push(obj);
  216. console.log("表哥233232323232233232322323",this.tableData)
  217. if (this.$route.query.keyword != "") {
  218. var new_arr = []
  219. for (let i = 0; i < this.tableData.length; i++) {
  220. if (this.tableData[i].index != "合计") {
  221. if (this.tableData[i].advice_id > 0) {
  222. if (
  223. this.tableData[i].advice.advice_name.indexOf(
  224. this.$route.query.keyword
  225. ) > -1
  226. ) {
  227. new_arr.push(this.tableData[i]);
  228. }
  229. }
  230. if (this.tableData[i].project_id > 0) {
  231. if (this.tableData[i].project.type == 2) {
  232. if (
  233. this.tableData[i].project.project.project_name.indexOf(
  234. this.$route.query.keyword
  235. ) > -1
  236. ) {
  237. new_arr.push(this.tableData[i]);
  238. }
  239. }
  240. if (this.tableData[i].project.type == 3) {
  241. if (
  242. this.tableData[i].project.good_info.good_name.indexOf(
  243. this.$route.query.keyword
  244. ) > -1
  245. ) {
  246. new_arr.push(this.tableData[i]);
  247. }
  248. }
  249. }
  250. }
  251. }
  252. var objs = {index:"合计",total_price:0,record_date:"0",is_total:2}
  253. for(let i=0;i<new_arr.length;i++){
  254. new_arr[i].is_total = 1
  255. }
  256. objs.total_price = this.getPrice(new_arr)
  257. new_arr.push(objs)
  258. this.tableData = new_arr;
  259. console.log("表哥2333333333333333333333333333",this.tableData)
  260. }
  261. if(this.$route.query.id == 1){
  262. var obj = {index:"合计",total_price:0,record_date:"0",is_total:2}
  263. var new_arr = []
  264. for(let i=0;i<this.tableData.length;i++){
  265. if(this.tableData[i].index!="合计"){
  266. if(this.tableData[i].advice_id > 0){
  267. new_arr.push(this.tableData[i])
  268. }
  269. }
  270. }
  271. this.tableData = []
  272. obj.total_price = this.getPrice(new_arr)
  273. for(let i=0;i<new_arr.length;i++){
  274. new_arr[i].is_total = 1
  275. }
  276. new_arr.push(obj)
  277. this.tableData = new_arr
  278. }
  279. if(this.$route.query.id == 2){
  280. var obj = {index:"合计",total_price:0,record_date:"0",is_total:2}
  281. var new_arr = []
  282. for(let i=0;i<this.tableData.length;i++){
  283. if(this.tableData[i].index!="合计"){
  284. if(this.tableData[i].project_id > 0){
  285. if(this.tableData[i].project.type ==2){
  286. new_arr.push(this.tableData[i])
  287. }
  288. }
  289. }
  290. }
  291. console.log("项目new_arr",new_arr)
  292. this.tableData = []
  293. obj.total_price = this.getPrice(new_arr)
  294. console.log("ar3233223232",new_arr)
  295. for(let i=0;i<new_arr.length;i++){
  296. new_arr[i].is_total = 1
  297. }
  298. new_arr.push(obj)
  299. this.tableData = new_arr
  300. }
  301. if(this.$route.query.id == 3){
  302. var new_arr = []
  303. var obj = {index:"合计",total_price:0,record_date:"0",is_total:2}
  304. for(let i=0;i<this.tableData.length;i++){
  305. if(this.tableData[i].index!="合计"){
  306. if(this.tableData[i].project_id > 0){
  307. if(this.tableData[i].project.type == 3){
  308. new_arr.push(this.tableData[i])
  309. }
  310. }
  311. }
  312. }
  313. this.tableData = []
  314. obj.total_price = this.getPrice(new_arr)
  315. for(let i=0;i<new_arr.length;i++){
  316. new_arr[i].is_total = 1
  317. }
  318. new_arr.push(obj)
  319. console.log("new_arr2332323232",new_arr)
  320. this.tableData = new_arr
  321. }
  322. }
  323. });
  324. },
  325. getAllPice() {
  326. var total_price = 0;
  327. for (let i = 0; i < this.tableData.length; i++) {
  328. if (this.tableData[i].index == "合计") {
  329. total_price = this.tableData[i].total_price;
  330. }
  331. }
  332. return total_price;
  333. },
  334. getActPay() {
  335. console.log("hh23h323223323", this.list);
  336. var act_pay = 0;
  337. for (let i = 0; i < this.list.length; i++) {
  338. for (let j = 0; j < this.list[i].orders.length; j++) {
  339. act_pay += this.list[i].orders[j].acct_pay;
  340. }
  341. }
  342. return act_pay;
  343. },
  344. getFundPaySumamt() {
  345. var fund_pay_sumamt = 0;
  346. for (let i = 0; i < this.list.length; i++) {
  347. for (let j = 0; j < this.list[i].orders.length; j++) {
  348. fund_pay_sumamt += this.list[i].orders[j].fund_pay_sumamt;
  349. }
  350. }
  351. return fund_pay_sumamt;
  352. },
  353. getHifesPay() {
  354. var hifes_pay = 0;
  355. for (let i = 0; i < this.list.length; i++) {
  356. for (let j = 0; j < this.list[i].orders.length; j++) {
  357. hifes_pay += this.list[i].orders[j].hifes_pay;
  358. }
  359. }
  360. return hifes_pay;
  361. },
  362. getMafPay() {
  363. var maf_pay = 0;
  364. for (let i = 0; i < this.list.length; i++) {
  365. for (let j = 0; j < this.list[i].orders.length; j++) {
  366. maf_pay += this.list[i].orders[j].maf_pay;
  367. }
  368. }
  369. return maf_pay;
  370. },
  371. getDepartment(id) {
  372. var name = "";
  373. for (let i = 0; i < this.hisDepatment.length; i++) {
  374. if (id == this.hisDepatment[i].id) {
  375. name = this.hisDepatment[i].name;
  376. }
  377. }
  378. return name;
  379. },
  380. getType(id) {
  381. var name = "";
  382. for (let i = 0; i < this.settlement.length; i++) {
  383. if (id == this.settlement[i].value) {
  384. name = this.settlement[i].label;
  385. }
  386. }
  387. return name;
  388. },
  389. getPrice(val){
  390. var total_price = 0
  391. for(let i=0;i<val.length;i++){
  392. total_price += val[i].cnt * val[i].pric
  393. }
  394. return total_price.toFixed(2)
  395. }
  396. },
  397. created() {
  398. this.getHisSummaryDetailList();
  399. },
  400. };
  401. </script>
  402. <style lang="scss" scoped>
  403. .list-print {
  404. -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27),
  405. 0 0 60px rgba(0, 0, 0, 0.06) inset;
  406. -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27),
  407. 0 0 40px rgba(0, 0, 0, 0.06) inset;
  408. box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;
  409. margin-bottom: 20px;
  410. padding: 20px 10px;
  411. }
  412. .listTitle {
  413. font-size: 24px;
  414. text-align: center;
  415. font-weight: bold;
  416. margin-bottom: 10px;
  417. }
  418. .listInfo {
  419. display: flex;
  420. font-size: 16px;
  421. justify-content: space-between;
  422. margin: 10px 0;
  423. }
  424. .listTable {
  425. width: 100%;
  426. text-align: center;
  427. border-collapse: collapse;
  428. line-height: 25px;
  429. font-size: 14px;
  430. border-color: #000;
  431. text-align: left;
  432. }
  433. .listTable tr td {
  434. padding: 0 5px;
  435. }
  436. .tableBottom {
  437. font-size: 16px;
  438. display: flex;
  439. margin-top: 20px;
  440. }
  441. .tableBottomOne {
  442. margin-right: 40px;
  443. }
  444. .print_btn {
  445. display: flex;
  446. justify-content: flex-end;
  447. }
  448. </style>