patientPrintTwo.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <el-dialog
  3. title="打印"
  4. :visible.sync="visibility"
  5. :close-on-click-modal="isClose"
  6. :close-on-press-escape="isClose"
  7. >
  8. <el-button type="primary" @click="print" class="print_style"
  9. >打印</el-button
  10. >
  11. <div id="dialysis-print-box-1" class="dialysis-print-box-1">
  12. <div class="list_title" style="border-bottom:none;">
  13. <div style="width:100%;text-align:center;font-size:16px;font-weight:bold;">
  14. {{org_name}} <span v-if="state=='待发药'">发药单</span> <span v-if="state=='已发药'">领药单</span>
  15. </div>
  16. </div>
  17. <div style="display: flex;">
  18. <div style="margin-right: 20px;">日期:{{times}}</div>
  19. <div>单据号:00013756</div>
  20. </div>
  21. <div style="margin: 10px 0;">
  22. <!-- <span>床号:{{ }}</span>&nbsp;&nbsp;
  23. <span>住院号:{{DialysisNo}}</span>&nbsp;&nbsp; -->
  24. <span>姓名:{{name}}</span>&nbsp;&nbsp;
  25. <span>性别:{{ patients.gender==1 ?'男':'女'}}</span>&nbsp;&nbsp;
  26. <span>年龄:{{patients.age}}</span>&nbsp;&nbsp;
  27. <span>住院科室:肾内科</span>&nbsp;&nbsp;
  28. <!-- <span>入院诊断:{{patients.diagnose}}</span> -->
  29. <span>入院诊断:{{ getdiagnosis(diagnosis) }}</span>
  30. </div>
  31. <div>
  32. <table class="table" border="1"
  33. style="border-collapse: collapse;border-left: none;border-right: none;width: 100%;text-align: center;">
  34. <tr>
  35. <td>药品名称</td>
  36. <td>规格</td>
  37. <td>用量</td>
  38. <td>用法</td>
  39. <td>天数</td>
  40. <td>总量</td>
  41. <td>单价</td>
  42. <td>金额</td>
  43. <td>执行时间</td>
  44. </tr>
  45. <tr v-for="item in tableData" >
  46. <td>{{item.Name}}</td>
  47. <td>{{item.Spec}}</td>
  48. <td>{{item.SingleDosage}}</td>
  49. <td>{{item.Frequency}}</td>
  50. <td>{{ item.Days }}</td>
  51. <td>{{ item.Usage }}<span>{{item.Total}}</span></td>
  52. <td>{{item.Price}}</td>
  53. <td>{{item.Total_cost.toFixed(2)}}</td>
  54. <td>{{getTime(item.ExecutionTime) }}</td>
  55. </tr>
  56. </table>
  57. </div>
  58. <div style="display: flex;margin: 10px 0;">
  59. <div style="flex: 1;">发药药房:药房</div>
  60. <div style="flex: 1;">开单医生:{{Doctor}}</div>
  61. <div style="flex: 1;">金额合计:{{ Price_zong.toFixed(2) }}</div>
  62. </div>
  63. <div style="display: flex;">
  64. <div style="flex: 1;">调配人:{{getdoctors(tableData[0].ExecutionStaff) }}</div>
  65. <div style="flex: 1;">取药人:{{getdoctors(tableData[0].ExecutionStaff) }}</div>
  66. </div>
  67. <!-- <div>
  68. <div style="display: flex;">
  69. <div style="width: 30%;"></div>
  70. <div style="width: 30%;"></div>
  71. <div style="width: 30%;"></div>
  72. <div style="width: 30%;"></div>
  73. <div style="width: 30%;"></div>
  74. <div style="width: 30%;"></div>
  75. </div>
  76. </div> -->
  77. <!-- <div class="list_title">
  78. <div>患者名称:{{name}}</div>
  79. <div>发药状态:{{state}}</div>
  80. <div>日期:{{times}}</div>
  81. </div> -->
  82. </div>
  83. </el-dialog>
  84. </template>
  85. <script>
  86. import Vue from "vue";
  87. import print from "print-js";
  88. import printutils from "./print.js";
  89. import{todaynumber} from '@/api/pharmacy'
  90. const moment = require("moment");
  91. import { uParseTime } from "@/utils/tools";
  92. export default {
  93. data() {
  94. return {
  95. visibility: false,
  96. tableData: [],
  97. isClose:false,
  98. name:"",
  99. DialysisNo:'',
  100. state:null,
  101. times:"",
  102. start_time:moment(new Date()).add("year", 0).format("YYYY-MM-DD"),
  103. org_name: this.$store.getters.xt_user.org.org_name,
  104. baseList:[],
  105. Doctor:'',
  106. patients:{},
  107. doctors:[],
  108. Price_zong:0,
  109. diagnosearr:[],
  110. diagnosis:'',
  111. };
  112. },
  113. props: {
  114. propForm: {
  115. type: Object,
  116. },
  117. },
  118. created(){
  119. this.init();
  120. },
  121. methods: {
  122. // isClose() {
  123. // this.visibility = false;
  124. // },
  125. init(){
  126. // let year = new Date().getFullYear();
  127. // let month = new Date().getMonth() +1;
  128. // let day = new Date().getDate();
  129. // let hour = new Date().getHours();
  130. // let minute = new Date().getMinutes();
  131. // this.times = year + "年" + month + "月" + day + "日" + hour + "时" + minute + "分"
  132. // console.log("times:",this.times)
  133. },
  134. hide: function () {
  135. this.visibility = false;
  136. for (let i = 0; i < this.propForm.goods.length; i++) {
  137. for (let key in this.propForm.goods[i]) {
  138. if (key != "index") {
  139. this.propForm.goods[i][key].isSelected = false;
  140. }
  141. }
  142. }
  143. },
  144. show: function (val,data,state,times,base,patients,doctors,arr,diagnosis) {
  145. this.times = times
  146. this.visibility = true;
  147. console.log("val111",val)
  148. console.log("val222",data)
  149. console.log("val333",base)
  150. console.log("val4444",patients)
  151. this.tableData = []
  152. for(let i =0; i < val.length;i++){
  153. if(val[i].Type == 1){
  154. this.tableData.push(val[i])
  155. }
  156. }
  157. this.Doctor = val[0].Doctor
  158. this.name = data.name
  159. this.DialysisNo = data.DialysisNo
  160. this.patients = patients
  161. this.doctors = doctors
  162. this.diagnosearr = arr
  163. this.diagnosis = diagnosis
  164. if (state == 1){
  165. this.state = "待发药"
  166. }
  167. if (state == 2){
  168. this.state = "已发药"
  169. }
  170. var Price_zong2 =0
  171. for(let i in this.tableData){
  172. const str = this.tableData[i].Total
  173. const num = str.replace(/[^\d]/g,"")
  174. // 每一行的金额
  175. this.tableData[i]['Total_cost'] = this.tableData[i].Price * num
  176. if(this.tableData[i].Price !=''){
  177. Price_zong2 = Price_zong2 + (this.tableData[i].Price * num)
  178. }
  179. }
  180. console.log('hhhhhhhh',this.tableData);
  181. this.Price_zong = Price_zong2
  182. },
  183. getdiagnosis(val){
  184. const diagnosis = val.split(',')
  185. console.log('diagnosis',diagnosis)
  186. const diagn = []
  187. // const dia_id =[]
  188. const arr = this.diagnosearr
  189. if(diagnosis.length>0 && arr.length>0){
  190. for(let i in arr){
  191. for(let j in diagnosis){
  192. if(arr[i].id ==diagnosis[j]){
  193. diagn.push(arr[i].class_name)
  194. }
  195. }
  196. var arr2 = diagn.join()
  197. console.log('arr2',arr2);
  198. }
  199. }
  200. return arr2
  201. },
  202. comfirm: function (formName) {
  203. this.goodInfo = [];
  204. this.goodInfoTableData = [];
  205. this.$emit("dialog-comfirm", this.getValue());
  206. this.$refs.multipleTable.clearSelection();
  207. this.$refs.table.setCurrentRow(null);
  208. },
  209. getValue() {},
  210. // 打印
  211. print() {
  212. console.log(this.org_name,'this.org_name')
  213. Vue.prototype.printJson = printutils.printJson;
  214. const style =
  215. '@media print {.list_title{width:940px;border-bottom:1px solid;display:flex;margin:20px auto} .table tr td{border:1px solid black;padding: 5px 0;border-left: none;border-right: none;}}';
  216. printJS({
  217. printable: "dialysis-print-box-1",
  218. type: "html",
  219. style: style,
  220. scanStyles: false,
  221. });
  222. // this.printJson({
  223. // title: `
  224. // <div>
  225. // <div style="width: 940px;text-align:center;font-size:16px;font-weight:bold;">${this.org_name} 发药单</div>
  226. // <div style="width: 940px;border-bottom: 1px solid;display: flex;margin: 30px auto;font-size:14px;">
  227. // <div style="width: 310px;padding: 10px 0;">患者名称:${this.name}</div>
  228. // <div style="width: 320px;padding: 10px 0;">发药状态:${this.state}</div>
  229. // <div style="width: 310px;padding: 10px 0;">日期:${this.times}</div>
  230. // </div></div>`, // 打印出来的标题
  231. // data: this.tableData, // 需要打印的数据
  232. // serial: true, // 是否需要打印序列号
  233. // fields: [
  234. // // 需要打印的字段
  235. // "Name",
  236. // "SingleDosage",
  237. // "Usage",
  238. // "Frequency",
  239. // "Days",
  240. // "Total",
  241. // "DataSources",
  242. // "Remarks",
  243. // ],
  244. // properties: [
  245. // // 需要打印的字段对应的表头名
  246. // {
  247. // field: "Name",
  248. // displayName: "名称",
  249. // },
  250. // {
  251. // field: "SingleDosage",
  252. // displayName: "单次用量",
  253. // },
  254. // {
  255. // field: "Usage",
  256. // displayName: "用法",
  257. // },
  258. // {
  259. // field: "Frequency",
  260. // displayName: "频率",
  261. // },
  262. // {
  263. // field: "Days",
  264. // displayName: "天数",
  265. // },
  266. // {
  267. // field: "Total",
  268. // displayName: "总量",
  269. // },
  270. // {
  271. // field: "DataSources",
  272. // displayName: "数据来源",
  273. // },
  274. // {
  275. // field: "Remarks",
  276. // displayName: "备注",
  277. // },
  278. // ],
  279. // });
  280. },
  281. getTime(val) {
  282. if(val < 0){
  283. return ""
  284. }
  285. if(val == ""){
  286. return ""
  287. }else {
  288. return uParseTime(val, '{y}-{m}-{d} {h}:{i}')
  289. }
  290. },
  291. getdoctors(id){
  292. for(let i in this.doctors){
  293. if(this.doctors[i].id == id){
  294. return this.doctors[i].user_name
  295. }
  296. }
  297. }
  298. },
  299. };
  300. </script>
  301. <style lang="scss" scoped>
  302. /deep/ .el-dialog{
  303. width: 60%;
  304. }
  305. /deep/ .el-table__body-wrapper::-webkit-scrollbar {
  306. width: 10px;
  307. height: 10px;
  308. }
  309. .print_style {
  310. position: absolute;
  311. right: 65px;
  312. top: 50px;
  313. }
  314. .list_title {
  315. width: 940px;
  316. border-bottom: 1px solid;
  317. display: flex;
  318. // margin: 30px auto;
  319. // div {
  320. // width: 320px;
  321. // padding: 10px 0;
  322. // }
  323. }
  324. .table tr td{
  325. border:1px solid black;
  326. padding: 5px 0;
  327. border-left: none;
  328. border-right: none;
  329. }
  330. </style>
  331. <style>
  332. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  333. font-size: 12px;
  334. }
  335. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  336. background: #6fb5fa;
  337. }
  338. .count {
  339. color: #bd2c00;
  340. }
  341. .el-table td,
  342. .el-table th.is-leaf,
  343. .el-table--border,
  344. .el-table--group {
  345. border-color: #d0d3da;
  346. }
  347. .el-table--border::after,
  348. .el-table--group::after,
  349. .el-table::before {
  350. background-color: #d0d3da;
  351. }
  352. </style>