print.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <div>
  3. <template>
  4. <el-button
  5. style="position:fixed;right:25px;z-index:999"
  6. :loading="loading"
  7. size="small"
  8. icon="el-icon-printer"
  9. @click="printThisPage"
  10. type="primary"
  11. >打印</el-button
  12. >
  13. </template>
  14. <div class='dialysisPage' style="padding-top:40px;">
  15. <div v-if="org_id != 10138">
  16. <printOne v-if="org_id != 10088" v-bind:childResponse="childResponse" :advicePrint="advicePrint" :ids="ids" :patient="patient" :hisPatient="hisPatient" :doctorPorject="doctorPorject" :patient_id="patient_id" :record_date="record_date" :prescription_id="prescription_id"></printOne>
  17. <printFour v-else v-bind:childResponse="childResponse" :advicePrint="advicePrint" :ids="ids" :patient="patient" :hisPatient="hisPatient" :doctorPorject="doctorPorject" :patient_id="patient_id" :record_date="record_date" :prescription_id="prescription_id"></printFour>
  18. </div>
  19. <div v-else>
  20. <printThree v-bind:childResponse="childResponse" :advicePrint="advicePrint" :ids="ids" :patient="patient" :hisPatient="hisPatient" :doctorPorject="doctorPorject" :patient_id="patient_id" :record_date="record_date" :prescription_id="prescription_id"></printThree>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import { parseTime } from "@/utils";
  27. import { getDialysisRecord } from "@/api/dialysis";
  28. import { getDataConfig } from "@/utils/data";
  29. import { jsGetAge, uParseTime } from "@/utils/tools";
  30. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  31. import print from "print-js";
  32. import printOne from "./template/printOne"
  33. import printThree from "./template/printThree"
  34. import printFour from "./template/printFour"
  35. import { getAllDoctorList,getAllHisPatientList,getPrescriptionPrint } from "@/api/project/project"
  36. export default {
  37. name: "dialysisPrintOrder",
  38. components: {
  39. BreadCrumb,
  40. printOne,
  41. printThree,
  42. printFour
  43. },
  44. props:{
  45. paramsObj:Object
  46. },
  47. data() {
  48. return {
  49. crumbs: [
  50. { path: false, name: '门诊医生站' },
  51. { path: false, name: '打印' }
  52. ],
  53. record_date:"",
  54. patientTableData:[],
  55. advicePrint:[],
  56. hisPatient:{},
  57. patient:{},
  58. doctorPorject:{},
  59. search_input:"",
  60. loading:false,
  61. patient_id:"",
  62. prescription_id:"",
  63. ids:'',
  64. paramsObj:{},
  65. org_id:''
  66. };
  67. },
  68. methods:{
  69. printThisPage() {
  70. var ptime = Math.round(new Date().getTime() / 1000);
  71. this.print_time = uParseTime(ptime, "{y}-{m}-{d} {h}:{i}");
  72. if(this.org_id == 10138){
  73. setTimeout(() => {
  74. const style =
  75. '@media print {#prescription-print{font-size:14px;}.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: 90%;}}}';
  76. printJS({
  77. printable: "prescriptionPrint",
  78. type: "html",
  79. style: style,
  80. scanStyles: false
  81. });
  82. },500)
  83. }else{
  84. const style =
  85. '@media print {#prescription-print{font-size:14px;}.prescription-print:last-child {page-break-after: auto;}.printTitle{font-size: 22px;text-align: center;font-weight: bold;}.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{padding:0 10px;min-height:450px;}.Rp{font-size: 22px;font-weight: bold;}.drugsBox{padding-left: 40px;margin-bottom: 10px;margin-bottom: 10px;}.drugsBox div{line-height: 20px;} .drugsOne{line-height: 1px;} .drugsOne span{margin-right: 20px;} .doctorBox{display: flex; justify-content: space-between; padding:0 10px; line-height: 1px; border-bottom: 2px solid #000;} .actionBar{display: flex; justify-content: space-between; line-height: 1px; padding:0 10px;} .actionBar p{width:150px;}}';
  86. printJS({
  87. printable: "prescriptionPrint",
  88. type: "html",
  89. style: style,
  90. scanStyles: false
  91. });
  92. }
  93. // if (this.org_template_info.template_id == 1) {
  94. // printJS({
  95. // printable: "dialysis-print-box",
  96. // type: "html",
  97. // style: style,
  98. // scanStyles: false
  99. // });
  100. // }
  101. },
  102. getAllDoctorList(){
  103. getAllDoctorList().then(response=>{
  104. if(response.data.state == 1){
  105. var doctor = response.data.data.doctor
  106. this.doctorList = doctor
  107. }
  108. })
  109. },
  110. getAllHisPatientList(){
  111. const params = {
  112. record_date:this.record_date
  113. }
  114. getAllHisPatientList(params).then(response=>{
  115. if(response.data.state == 1){
  116. this.patientTableData = response.data.data.list
  117. this.patientTableDataTwo = response.data.data.list
  118. let cal_one = 0
  119. let cal_two = 0
  120. for (let i = 0; i < response.data.data.list.length; i++) {
  121. if (response.data.data.list[i].prescription == null || response.data.data.list[i].prescription.length == 0) {
  122. cal_one = cal_one + 1
  123. }
  124. if (response.data.data.list[i].prescription != null && response.data.data.list[i].prescription.length > 0) {
  125. cal_two = cal_two + 1
  126. }
  127. }
  128. // this.$refs.tab.setCurrentRow(this.patientTableData[0])
  129. // console.log(this.patientTableData[0])
  130. // this.choosePatient(this.patientTableData[0])
  131. this.cal_one = cal_one
  132. this.cal_two = cal_two
  133. }
  134. })
  135. },
  136. changePatient(row){
  137. this.patient_id = row.patient_id
  138. this.record_date = this.record_date
  139. this.prescription_id = this.prescription_id
  140. console.log("row",row)
  141. // var params = {
  142. // patient_id:row.patient_id,
  143. // record_date:this.record_date,
  144. // prescription_id:this.prescription_id,
  145. // }
  146. // getPrescriptionPrint(params).then(response=>{
  147. // if(response.data.state == 1){
  148. // var advicePrint = response.data.data.advicePrint
  149. // console.log("adviceprint",advicePrint)
  150. // this.advicePrint = advicePrint
  151. // var patient = response.data.data.patient
  152. // console.log("patient",patient)
  153. // this.patient = patient
  154. // // var hisPatient = response.data.data.hisPatient
  155. // // console.log("hispatient",hisPatient)
  156. // // this.hisPatient = hisPatient
  157. // var doctorPorject = response.data.data.doctorPorject
  158. // console.log("doctorporject",doctorPorject)
  159. // this.doctorPorject = doctorPorject
  160. // }
  161. // })
  162. },
  163. searchAction(){
  164. }
  165. },
  166. created() {
  167. this.org_id = this.$store.getters.xt_user.org_id
  168. this.getAllDoctorList()
  169. var record_date = this.paramsObj.record
  170. this.record_date = record_date
  171. console.log("record_date",record_date)
  172. var prescription_id = this.paramsObj.prescription_id
  173. this.prescription_id = prescription_id
  174. this.patient_id = this.paramsObj.patient_id
  175. this.ids = this.paramsObj.ids
  176. // var record_date = this.$route.query.record
  177. // this.record_date = record_date
  178. // console.log("record_date",record_date)
  179. // var prescription_id = this.$route.query.prescription_id
  180. // this.prescription_id = prescription_id
  181. this.getAllHisPatientList(record_date)
  182. },
  183. watch:{
  184. paramsObj:{//深度监听,可监听到对象、数组的变化
  185. handler(val, oldVal){
  186. this.paramsObj = val
  187. this.patient_id = this.paramsObj.patient_id
  188. var record_date = this.paramsObj.record
  189. this.record_date = record_date
  190. console.log("record_date",record_date)
  191. var prescription_id = this.paramsObj.prescription_id
  192. this.prescription_id = prescription_id
  193. this.ids = this.paramsObj.ids
  194. },
  195. deep:true
  196. }
  197. }
  198. };
  199. </script>
  200. <style>
  201. .dialysis-print-order {
  202. width: 960px;
  203. margin: 0 auto;
  204. }
  205. .dialysis-print-order .order-yy-name {
  206. margin: auto;
  207. text-align: center;
  208. font-size: 20px;
  209. letter-spacing: 5px;
  210. }
  211. .dialysis-print-order .order-title {
  212. margin: auto;
  213. font-weight: 600;
  214. text-align: center;
  215. font-size: 22px;
  216. padding: 10px;
  217. }
  218. .dialysis-print-order .table-box {
  219. width: 100%;
  220. line-height: 23px;
  221. font-size: 14px;
  222. }
  223. .dialysis-print-order .print-table {
  224. width: 100%;
  225. text-align: center;
  226. border-collapse: collapse;
  227. line-height: 40px;
  228. font-size: 14px;
  229. border-color: #000;
  230. }
  231. .dialysis-print-order .print-table-no {
  232. width: 100%;
  233. text-align: center;
  234. border-collapse: collapse;
  235. font-size: 14px;
  236. }
  237. .dialysis-print-order .under-line {
  238. border-bottom: 1px solid #999;
  239. width: 95%;
  240. text-align: center;
  241. margin-left: 2px;
  242. }
  243. .dialysis-print-order .title-box {
  244. text-align: center;
  245. font-size: 16px;
  246. }
  247. .dialysis-print-order .radio-lebel-box {
  248. font-weight: 400;
  249. cursor: pointer;
  250. }
  251. .dialysis-print-order .radio-no {
  252. opacity: 0;
  253. outline: none;
  254. position: absolute;
  255. margin: 0;
  256. width: 0;
  257. height: 0;
  258. z-index: -1;
  259. }
  260. .dialysis-print-order .radio-inner {
  261. white-space: nowrap;
  262. cursor: pointer;
  263. outline: none;
  264. display: inline-block;
  265. line-height: 1;
  266. position: relative;
  267. vertical-align: middle;
  268. }
  269. .dialysis-print-order .radio-fang {
  270. display: inline-block;
  271. position: relative;
  272. border: 1px solid #000;
  273. box-sizing: border-box;
  274. width: 14px;
  275. height: 14px;
  276. background-color: #fff;
  277. z-index: 1;
  278. transition: border-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46),
  279. background-color 0.25s cubic-bezier(0.71, -0.46, 0.29, 1.46);
  280. }
  281. .dialysis-print-order .is-checked-radio::after {
  282. content: "√";
  283. font-size: 15px;
  284. }
  285. .dialysis-print-order .print-table-no tr td {
  286. padding: 8px 5px;
  287. line-height: 25px;
  288. }
  289. .dialysis-print-order .print-table tr td {
  290. padding: 1px 1px;
  291. /*line-height: 25px;*/
  292. }
  293. .es-img {
  294. height: 30px;
  295. }
  296. .advice-name {
  297. text-align: left;
  298. }
  299. .advice-children {
  300. display: flex;
  301. }
  302. .title-box-pro {
  303. border: 0 #fff;
  304. line-height: 25px;
  305. height: 25px;
  306. text-align: left;
  307. padding-left: 10px !important;
  308. }
  309. .title-box-pro-tr {
  310. border: 0 #fff;
  311. }
  312. .text-align-left {
  313. text-align: left !important;
  314. padding-left: 10px !important;
  315. font-size: 14px !important;
  316. line-height: 25px;
  317. }
  318. .print-table-tr-new td {
  319. line-height: 20px !important;
  320. }
  321. .border-top-solid {
  322. border: solid 1px #000;
  323. }
  324. .print-template-two tr {
  325. line-height: 30px;
  326. }
  327. .table-box1 {
  328. border: 1px solid #000;
  329. width: 100%;
  330. line-height: 30px;
  331. font-size: 14px;
  332. border-collapse: collapse;
  333. }
  334. .table-box1 tr {
  335. border-bottom: 1px solid #000;
  336. }
  337. </style>
  338. <style lang="scss">
  339. .newContainer{
  340. .dialysisPage::-webkit-scrollbar {
  341. height: 15px;
  342. }
  343. .el-date-editor{
  344. .el-input__inner{
  345. padding-right:0px;
  346. }
  347. }
  348. .el-table td, .el-table th{
  349. text-align: center;
  350. }
  351. }
  352. .newContainer::-webkit-scrollbar{
  353. height: 15px !important;
  354. }
  355. </style>