print.vue 13KB

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