printThree.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. <template>
  2. <div>
  3. <div id='prescriptionPrint1'>
  4. <div v-for="(item,index) in advicePrint" :key="index">
  5. <div id='prescription-print' v-if="item.project.length == 0" v-for='(i,pageIndex) in item.pageArr.length' :key="pageIndex" class="prescription-print" style="page-break-after: always;">
  6. <img src="https://kuyi.shengws.com/bailin/bltotle.jpg" style="width:100%" alt="">
  7. <div class="printTitle">
  8. 处方笺
  9. <span v-if="item.med_type == '1111'" style="margin-left: 50px;border: 1px solid #000;">精一</span>
  10. <span v-if="item.med_type == '1112'" style="margin-left: 50px;border: 1px solid #000;">精二</span>
  11. </div>
  12. <div style="display:flex;">
  13. <div style="width:33%;display:flex;">费别:<span class="under_line"><span>{{ faber && faber.transBody ? getName(faber.transBody.outputlist1) : '自费' }}</span></span></div>
  14. <div style="width:33%;display:flex;">电脑号:<span class="under_line">{{ faber && faber.transBody ? faber.transBody.aac999 : '' }}</span></div>
  15. <div style="width:33%;display:flex;">处方编号:<span class="under_line">{{ item.prescription_number.substring(item.prescription_number.length-6) }}</span></div>
  16. </div>
  17. <div class="infoTitle">
  18. <div>姓名:{{item.patient.name? item.patient.name.indexOf("(") > -1 ? item.patient.name.substring(0,item.patient.name.indexOf("(")) : item.patient.name :""}}</div>
  19. <div>性别:
  20. <span v-if="item.patient.gender == 1">男</span>
  21. <span v-if="item.patient.gender == 2">女</span>
  22. </div>
  23. <div>年龄:{{getAge(item.patient)?getAge(item.patient):""}}岁</div>
  24. </div>
  25. <div class="infoMain">
  26. <div style="margin-bottom: 10px;display:flex;">门诊号码:<span class="under_line" v-if="hisPatient.number">{{hisPatient.number?hisPatient.number:""}}</span></div>
  27. <div style="margin-bottom: 10px;display:flex;">科别:<span class="under_line" v-if="item.info">{{item.info?getDepart(item.info.departments):''}}</span></div>
  28. <div style="margin-bottom: 10px;display:flex;">临床诊断:{{ item.info.diagnosis ? getDiagnosis(item.info.diagnosis) : ''}}</div>
  29. <div style="margin-bottom: 10px;display:flex;">自费药品签名:<span class="under_line"></span></div>
  30. <!-- <div style="margin-bottom: 10px;display:flex;">医保卡号:{{item.hisPatient.number?item.hisPatient.number:""}}</div> -->
  31. <div style="margin-bottom: 10px;display:flex;">联系方式:<span class="under_line">{{item.patient.phone}}</span></div>
  32. <div style="margin-bottom: 10px;display:flex;">开具日期:<span class="under_line">{{getTime(item.record_date) ? getTime(item.record_date).split(' ')[0] : ''}}</span></div>
  33. <!-- <div>地址:{{item.patient.home_address}}</div> -->
  34. <!-- <div style="display:flex;width:50%;">临床诊断:{{getDiagnosis(item.info.diagnosis)}}</div> -->
  35. </div>
  36. <div class="prescriptionBox">
  37. <div class="Rp">Rp:</div>
  38. <div class="drugsBox" v-for="(it,index) in item.advices.slice(pageIndex * 5,(pageIndex * 5) + item.pageArr[pageIndex])" :key="index">
  39. <!-- <div class="drugsOne"><span style="font-weight:bold;">{{ index+1 + '.' }}</span>{{it.advice_name?it.advice_name:""}}&nbsp;&nbsp;{{it.single_dose}}{{it.single_dose_unit}}&nbsp;×&nbsp; {{it.prescribing_number}}{{it.prescribing_number_unit}}</div> -->
  40. <div class="drugsOne"><span style="font-weight:bold;">{{ index+1 + '.' }}</span>{{it.advice_name?it.advice_name:""}}&nbsp;&nbsp;<span v-if="it.drug.min_unit != it.drug.dose_unit">{{it.drug.dose}}{{it.drug.dose_unit}}&nbsp;* &nbsp;</span>{{it.drug.min_number}}{{it.drug.min_unit}}/{{it.drug.max_unit}}&nbsp;×&nbsp; {{it.prescribing_number}}{{it.prescribing_number_unit}}</div>
  41. <div style="margin-left:100px;"><span>用法:{{it.single_dose}}{{it.single_dose_unit}}</span>&nbsp;&nbsp;<span>{{it.execution_frequency}}&nbsp;{{it.delivery_way}}&nbsp;</span>&nbsp;&nbsp;<span>{{it.advice_desc}}</span></div>
  42. </div>
  43. <div class="drugsBox" v-for="(it,i) in item.additionalcharge" :key="i">
  44. <div class="drugsOne">{{it.item_name?it.item_name:""}}:&nbsp;{{it.price}}元/{{it.count}}次</div>
  45. </div>
  46. <!-- <div class="drugsBox" v-for="(it,index) in item.project" :key="index">
  47. <div class="drugsOne"><span style="font-weight:bold;">{{ index+1 + '.' }}</span>{{ it.type == 2 ? it.project.project_name : it.good_info.good_name }}&nbsp;&nbsp;{{it.single_dose}}{{it.single_dose_unit}}&nbsp;×&nbsp; {{it.count}}{{unit}}</div>
  48. <div style="margin-left:100px;"><span>用法:{{it.single_dose}}{{it.single_dose_unit}}</span>&nbsp;&nbsp;<span>{{it.delivery_way}}</span>&nbsp;&nbsp;<span>{{it.advice_desc}}</span></div>
  49. </div>
  50. <div class="drugsBox" v-for="(it,i) in item.additionalcharge" :key="i">
  51. <div class="drugsOne">{{it.project_id?it.project_id:""}}:&nbsp;{{it.price}}元/{{it.count}}次</div>
  52. </div> -->
  53. <div style="text-align:center;" >(以下空白)</div>
  54. </div>
  55. <div style="display:flex;">
  56. <div>医&nbsp;&nbsp;&nbsp;&nbsp;师:<span style="width:100px;display:inline-block;">{{item.doctor?item.doctor:""}}</span></div>
  57. <!-- <div>药品金额:{{getTotalOne(item.id).toFixed(2)?getTotalOne(item.id).toFixed(2):0}}</div> -->
  58. </div>
  59. <div style="display:flex;">
  60. <div style="display:flex;">审核药师:<span style="width:100px" class="under_line"></span></div>
  61. <div style="display:flex;">调剂药师:<span style="width:100px" class="under_line"></span></div>
  62. <div style="display:flex;">核对/发药药师:<span style="width:100px" class="under_line"></span></div>
  63. </div>
  64. <div>
  65. 打印日期:{{getTime(new Date())?getTime(new Date()):""}}
  66. </div>
  67. <div>*处方当日有效,特殊情况可适当延长,一般不超过3天</div>
  68. <div>*药品属于特殊商品,非质量问题不允许退换</div>
  69. <img src="https://kuyi.shengws.com/bailin/blend.jpg" style="width:100%" alt="">
  70. <!-- <div class="doctorBox">
  71. <p>医师:{{item.doctor?item.doctor:""}}</p>
  72. <p>日期:{{getTime(item.ctime)?getTime(item.ctime):""}}</p>
  73. </div>
  74. <div class="actionBar">
  75. <p>审核:</p>
  76. <p>配对:</p>
  77. <p>核对:</p>
  78. <p>发药:</p>
  79. <p>药费:{{getTotalOne(item.id).toFixed(2)?getTotalOne(item.id).toFixed(2):0}}元</p>
  80. </div> -->
  81. <div style="page-break-after:always"></div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. import { jsGetAge, uParseTime } from '@/utils/tools'
  89. import {getAllDoctorList,getPrescriptionPrint,getHisPatientDetail} from "@/api/project/project"
  90. import {getInitData} from "@/api/his/his"
  91. export default {
  92. props:{
  93. patient_id:Number,
  94. record_date:String,
  95. prescription_id:Number,
  96. ids:String
  97. },
  98. data(){
  99. return {
  100. doctorList:[],
  101. advicePrint:{},
  102. patient:{},
  103. tableData:[],
  104. prescriptionInfo:[],
  105. hisPatient:{},
  106. department:[],
  107. prescriptions:[],
  108. projectList:[],
  109. orgname:"",
  110. diagnoses:[],
  111. pageArr:[],
  112. faber:{}
  113. }
  114. },
  115. methods:{
  116. getAge(patient){
  117. var thisLen = patient.id_card_no.length
  118. var birth = ''
  119. if (thisLen == 15) {
  120. birth = '19' + patient.id_card_no.substr(6, 6)
  121. } else {
  122. birth = patient.id_card_no.substr(6, 8)
  123. }
  124. var births =
  125. birth.substr(0, 4) +
  126. '-' +
  127. birth.substr(4, 2) +
  128. '-' +
  129. birth.substr(6, 2)
  130. return jsGetAge(births, '-')
  131. },
  132. getAllDoctorList(){
  133. getAllDoctorList().then(response=>{
  134. if(response.data.state == 1){
  135. var doctor = response.data.data.doctor
  136. this.doctorList = doctor
  137. }
  138. })
  139. },
  140. getDoctor(id){
  141. var name = ""
  142. for(let i=0;i<this.doctorList.length;i++){
  143. if(id == this.doctorList[i].admin_user_id){
  144. name = this.doctorList[i].user_name
  145. }
  146. }
  147. return name
  148. },
  149. getTime(value, temp) {
  150. if (value != undefined) {
  151. return uParseTime(value, temp)
  152. }
  153. return ''
  154. },
  155. getPrescriptionPrint(){
  156. var params = {
  157. // patient_id:this.patient_id,
  158. // record_date:this.record_date,
  159. // prescription_id:this.prescription_id,
  160. patient_id:this.patient_id,
  161. record_date:this.record_date,
  162. prescription_id:this.prescription_id,
  163. ids:this.ids
  164. }
  165. console.log("params",params)
  166. getPrescriptionPrint(params).then(response=>{
  167. if(response.data.state == 1){
  168. var advicePrint = response.data.data.advicePrint
  169. console.log("adviceprint9999",advicePrint)
  170. this.advicePrint = advicePrint
  171. this.getPage()
  172. this.prescriptions = advicePrint
  173. console.log("处方222222",this.prescriptions)
  174. var hisPatient = response.data.data.hisPatient
  175. console.log("hisPatient",hisPatient)
  176. this.hisPatient = hisPatient
  177. var projectlist = response.data.data.projectlist
  178. console.log("所有项目列表",projectlist)
  179. this.projectList = projectlist
  180. let outputlist1Name = response.data.data.his.patient_info ? JSON.parse(response.data.data.his.patient_info) : {};
  181. this.faber = outputlist1Name
  182. }
  183. })
  184. },
  185. getHisPatientDetail(){
  186. const params = {
  187. patient_id:this.patient_id
  188. }
  189. getHisPatientDetail(params).then(response=>{
  190. if(response.data.state == 1){
  191. var hisPatient = response.data.data.hisPatient
  192. console.log("挂号病人",hisPatient)
  193. this.hisPatient = hisPatient
  194. }
  195. })
  196. },
  197. getInitData(){
  198. getInitData().then(response=>{
  199. if(response.data.state == 1){
  200. this.department = response.data.data.department
  201. this.diagnoses = response.data.data.diagnose.sort(this.compare('id'))
  202. console.log("争端",this.diagnoses)
  203. }
  204. })
  205. },
  206. getDepart(id){
  207. var name = ""
  208. for(let i=0;i<this.department.length;i++){
  209. if(id == this.department[i].id){
  210. name = this.department[i].name
  211. }
  212. }
  213. return name
  214. },
  215. getTotalOne(id) {
  216. console.log('id',id)
  217. var total = 0
  218. var addtotal = 0
  219. for (let i = 0; i < this.prescriptions.length; i++) {
  220. if(id == this.prescriptions[i].id){
  221. if (this.prescriptions[i].project != null) {
  222. for (let a = 0; a < this.prescriptions[i].project.length; a++) {
  223. total = total + this.prescriptions[i].project[a].price * this.prescriptions[i].project[a].count
  224. }
  225. }
  226. if (this.prescriptions[i].additionalcharge != null) {
  227. for (let a = 0; a < this.prescriptions[i].additionalcharge.length; a++) {
  228. addtotal = addtotal + this.prescriptions[i].additionalcharge[a].price * this.prescriptions[i].additionalcharge[a].count
  229. }
  230. }
  231. addtotal = Math.floor(addtotal * 100) / 100
  232. }
  233. }
  234. for (let i = 0; i < this.prescriptions.length; i++) {
  235. if(id == this.prescriptions[i].id){
  236. if (this.prescriptions[i].advices != null) {
  237. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  238. total = total + this.prescriptions[i].advices[a].price * this.prescriptions[i].advices[a].prescribing_number
  239. }
  240. }
  241. if (this.prescriptions[i].additionalcharge != null) {
  242. for (let a = 0; a < this.prescriptions[i].additionalcharge.length; a++) {
  243. addtotal = addtotal + this.prescriptions[i].additionalcharge[a].price * this.prescriptions[i].additionalcharge[a].count
  244. }
  245. }
  246. addtotal = Math.floor(addtotal * 100) / 100
  247. }
  248. }
  249. return total + addtotal
  250. },
  251. getProjectName(id){
  252. var project_name = ""
  253. for(let i=0;i<this.projectList.length;i++){
  254. if(id == this.projectList[i].id){
  255. project_name = this.projectList[i].project_name
  256. }
  257. }
  258. return project_name
  259. },
  260. getDiagnosis(ids){
  261. let newIds = ids.split(',').sort(function(a,b){
  262. return a-b;
  263. })
  264. var name = ""
  265. let nameArr = []
  266. for(let i=0;i<this.diagnoses.length;i++){
  267. // if(id == this.diagnoses[i].id){
  268. // name = this.diagnoses[i].class_name
  269. // }
  270. if(newIds.indexOf(this.diagnoses[i].id.toString()) > -1){
  271. // name += diagnoses[i].class_name + ' '
  272. nameArr.push(this.diagnoses[i].class_name)
  273. }
  274. }
  275. let newNameArr = []
  276. nameArr.map((item,index) => {
  277. if(item == '尿毒症'){
  278. newNameArr.push(item)
  279. nameArr.splice(index,1,'')
  280. }
  281. })
  282. newNameArr.push(...nameArr)
  283. return newNameArr.join(' ')
  284. },
  285. compare(property) {
  286. return function(a,b){
  287. var value1 = a[property];
  288. var value2 = b[property];
  289. return value1 - value2;//升序排序
  290. }
  291. },
  292. getPage(){
  293. this.page = 1
  294. this.pageArr = []
  295. this.advicePrint.map(item => {
  296. let arr = []
  297. item.pageArr = []
  298. if(item.advices.length <= 5){
  299. this.page = 1
  300. arr.push(item.advices.length)
  301. item.pageArr.push(arr)
  302. }else if(item.advices.length > 5){
  303. this.page = parseInt(item.advices.length / 5)
  304. let num = item.advices.length % 5
  305. for (var i=0;i<this.page;i++){
  306. item.pageArr.push([5])
  307. }
  308. if(num != 0){
  309. item.pageArr.push([num])
  310. }
  311. }
  312. })
  313. // console.log('this.pageArr',this.pageArr)
  314. },
  315. getName(list) {
  316. console.log('list',list)
  317. let new_list = []
  318. for (let i = 0; i < list.length; i++) {
  319. if (list[i].aac031 == '1') {
  320. new_list.push(list[i])
  321. }
  322. }
  323. switch (new_list[0].bcc334) {
  324. case "A31001":
  325. return "深圳医保1档"
  326. break
  327. case "A31002":
  328. return "深圳医保2档"
  329. break
  330. case "A31003":
  331. return "深圳医保3档"
  332. break
  333. case "A31004":
  334. return "二档(少儿)"
  335. break
  336. case "A31005":
  337. return "学生二档"
  338. break
  339. case "A31006":
  340. return "大学生二档"
  341. break
  342. case "A32001":
  343. return "在职公务员"
  344. break
  345. case "A32002":
  346. return "在职驻深公务员"
  347. break
  348. case "A39301":
  349. return "家属统筹医疗"
  350. break
  351. case "A41001":
  352. return "工伤在职"
  353. break
  354. case "A51001":
  355. return "生育在职"
  356. break
  357. case "A52001":
  358. return "生育医疗一档"
  359. break
  360. case "A52002":
  361. return "生育医疗一档"
  362. break
  363. case "C31001":
  364. return "一档医疗退休"
  365. break
  366. case "C31002":
  367. return "二档医疗退休"
  368. break
  369. }
  370. },
  371. },
  372. created(){
  373. this.getPrescriptionPrint()
  374. this.getAllDoctorList()
  375. this.getInitData()
  376. this.getHisPatientDetail()
  377. var xtuser = this.$store.getters.xt_user;
  378. this.orgname = xtuser.org.org_name;
  379. },
  380. watch:{
  381. ids:function(val){
  382. console.log('val1111111111111111111111111111',val)
  383. this.ids = val
  384. this.getPrescriptionPrint()
  385. }
  386. }
  387. }
  388. </script>
  389. <style lang="scss" scoped>
  390. .prescription-print{
  391. -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 60px rgba(0, 0, 0, 0.06) inset;
  392. -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;
  393. box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;
  394. margin-bottom: 20px;
  395. padding:20px 10px;
  396. }
  397. .printTitle{
  398. font-size: 22px;
  399. text-align: center;
  400. font-weight: bold;
  401. margin-bottom: 10px;
  402. }
  403. .infoTitle{
  404. display: flex;
  405. margin-top:10px;
  406. line-height: 24px;
  407. }
  408. .infoTitle div{
  409. width: 200px;
  410. }
  411. .infoMain{
  412. display: flex;
  413. flex-wrap: wrap;
  414. margin-top:10px;
  415. }
  416. .infoMain div{
  417. width: 50%;
  418. line-height: 24px;
  419. }
  420. .prescriptionBox{
  421. padding:0 10px;
  422. min-height:400px;
  423. }
  424. .Rp{
  425. font-size: 22px;
  426. font-weight: bold;
  427. }
  428. .drugsBox{
  429. padding-left: 40px;
  430. margin-bottom: 10px;
  431. }
  432. .drugsBox div{
  433. line-height: 20px;
  434. }
  435. .drugsOne{
  436. line-height: 24px;
  437. }
  438. .drugsOne span{
  439. margin-right: 20px;
  440. }
  441. .doctorBox{
  442. display: flex;
  443. justify-content: space-between;
  444. padding:0 10px;
  445. line-height: 24px;
  446. border-bottom: 2px solid #000;
  447. }
  448. .actionBar{
  449. display: flex;
  450. justify-content: space-between;
  451. line-height: 24px;
  452. padding:0 10px;
  453. }
  454. .actionBar p{
  455. width:150px;
  456. }
  457. .under_line{
  458. display: inline-block;
  459. border-bottom: 1px solid #000;
  460. flex: 1;
  461. }
  462. </style>