printFour.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. <template>
  2. <div id='prescriptionPrint'>
  3. <div v-for="(item,index) in advicePrint" :key="index">
  4. <div id='prescription-print' class="prescription-print" style="page-break-after: always;">
  5. <div class="printTitle">{{orgname}}处方笺</div>
  6. <div class="infoTitle">
  7. <p>姓名:{{item.patient.name?item.patient.name:""}}</p>
  8. <p>性别:
  9. <span v-if="item.patient.gender == 1">男</span>
  10. <span v-if="item.patient.gender == 2">女</span>
  11. </p>
  12. <p>年龄:{{getAge(item.patient)?getAge(item.patient):""}}岁</p>
  13. </div>
  14. <div class="infoMain">
  15. <div style="margin-bottom: 10px;">门诊号:{{hisPatient.number?hisPatient.number:""}}</div>
  16. <div style="margin-bottom: 10px;">科室:{{item.info?getDepart(item.info.departments):''}}</div>
  17. <div style="margin-bottom: 10px;">医保卡号:{{item.hisPatient.number?item.hisPatient.number:""}}</div>
  18. <div style="margin-bottom: 10px;">电话:{{item.patient.phone}}</div>
  19. <div>地址:{{item.patient.home_address}}</div>
  20. <div style="display:flex;width:50%;">临床诊断:{{getDiagnosis(item.info.diagnosis)}}</div>
  21. </div>
  22. <div class="prescriptionBox">
  23. <div class="Rp">Rp:</div>
  24. <div class="drugsBox" v-for="(it,index) in item.advices" :key="index"
  25. :style="{'page-break-after':index==4&&item.advices.length>5? 'always':'auto'}"
  26. >
  27. <template v-if="index==5&&item.advices.length>5">
  28. <div style="margin: 20px 0px;">
  29. <div class="printTitle">{{orgname}}处方笺</div>
  30. <div class="infoTitle">
  31. <p>姓名:{{ item.patient.name ? item.patient.name : "" }}</p>
  32. <p>
  33. 性别:
  34. <span v-if="item.patient.gender == 1">男</span>
  35. <span v-if="item.patient.gender == 2">女</span>
  36. </p>
  37. <p>年龄:{{ getAge(item.patient) ? getAge(item.patient) : "" }}岁</p>
  38. </div>
  39. <div class="infoMain">
  40. <div style="margin-bottom: 10px;">门诊号:{{hisPatient.number?hisPatient.number:""}}</div>
  41. <div style="margin-bottom: 10px;">科室:{{item.info?getDepart(item.info.departments):''}}</div>
  42. <div style="margin-bottom: 10px;">医保卡号:{{item.hisPatient.number?item.hisPatient.number:""}}</div>
  43. <div style="margin-bottom: 10px;">电话:{{item.patient.phone}}</div>
  44. <div>地址:{{item.patient.home_address}}</div>
  45. <div style="display:flex;width:50%;">临床诊断:{{getDiagnosis(item.info.diagnosis)}}</div>
  46. </div>
  47. <div class="Rp">Rp:</div>
  48. </div>
  49. </template>
  50. <!-- :style="{'page-break-after':index==yi&&item.advices.length>5? 'always':'auto'}" -->
  51. <!-- <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> -->
  52. <div class="drugsOne" >
  53. <span style="font-weight:bold;">{{ index+1 + '.' }}</span>
  54. {{it.advice_name?it.advice_name:""}}
  55. {{ it.drug.dose }}{{ it.drug.dose_unit }}&nbsp;* {{ it.drug.min_number }}{{ it.drug.min_unit }}&nbsp;&nbsp;
  56. <span>用法:{{it.single_dose}}{{it.single_dose_unit}}</span>
  57. <span>{{it.execution_frequency}}&nbsp;{{it.delivery_way}}&nbsp;</span>
  58. <span>{{it.advice_desc}}</span>
  59. </div>
  60. <div style="margin-left:100px;">
  61. <span>{{it.drug.drug_spec}}&nbsp;×&nbsp;{{it.prescribing_number}}{{it.prescribing_number_unit}}</span>
  62. </div>
  63. <template v-if="index==4&&item.advices.length>5">
  64. <div style="margin: 100px 0 0 0;">
  65. <div class="doctorBox">
  66. <p v-if="org_id!=10598 && org_id!=0 ">
  67. 医师:
  68. <span
  69. style="width: 100px; display: inline-block"
  70. v-if="item.creator == ''"
  71. >
  72. {{ item.doctor ? item.doctor : "" }}
  73. </span>
  74. <img
  75. style="height: 30px"
  76. :src="setAdminUserES(item.creator,item.doctor)"
  77. alt=""
  78. srcset=""
  79. v-else
  80. />
  81. </p>
  82. <p v-if="org_id==10598 || org_id==0">
  83. 医师:
  84. <img
  85. style="height: 30px"
  86. :src="setAdminUserES(item.creator,item.doctor)"
  87. alt=""
  88. srcset=""
  89. />
  90. </p>
  91. <p>日期:{{getTime(item.ctime)?getTime(item.ctime):""}}</p>
  92. </div>
  93. <div class="actionBar" >
  94. <p>审核:</p>
  95. <p>配对:</p>
  96. <p>核对:</p>
  97. <p>发药:</p>
  98. <p>
  99. 金额:{{
  100. getTotalOne(item.id).toFixed(2)
  101. ? getTotalOne(item.id).toFixed(2)
  102. : 0
  103. }}元
  104. </p>
  105. </div>
  106. </div>
  107. </template>
  108. </div>
  109. <div class="drugsBox" v-for="(it,i) in item.additionalcharge" :key="i">
  110. <div class="drugsOne">{{it.item_name?it.item_name:""}}:&nbsp;{{it.price}}元/{{it.count}}次</div>
  111. </div>
  112. <div class="drugsBox" v-for="(it,index) in item.project" :key="index">
  113. <div class="drugsOne"><span style="font-weight:bold;">{{ index+1 + '.' }}</span>{{getProjectName(it.project_id)?getProjectName(it.project_id):""}}&nbsp;&nbsp;<span>用法:{{it.single_dose}}{{it.single_dose_unit}}</span>&nbsp;&nbsp;<span>{{it.delivery_way}}</span>&nbsp;&nbsp;<span>{{it.advice_desc}}</span></div>
  114. <div style="margin-left:100px;"><span>{{it.single_dose}}{{it.single_dose_unit}}&nbsp;×&nbsp; {{it.count}}{{unit}}</span></div>
  115. </div>
  116. <div class="drugsBox" v-for="(it,i) in item.additionalcharge" :key="i">
  117. <div class="drugsOne">{{it.project_id?it.project_id:""}}:&nbsp;{{it.price.toFixed(2)}}元/{{it.count}}次</div>
  118. </div>
  119. <div style="text-align:center;" >(以下空白)</div>
  120. </div>
  121. <div class="doctorBox">
  122. <p v-if="org_id!=10598 && org_id!=0 ">
  123. 医师:
  124. <span
  125. style="width: 100px; display: inline-block"
  126. v-if="item.creator == ''"
  127. >
  128. {{ item.doctor ? item.doctor : "" }}
  129. </span>
  130. <!-- <span
  131. style="width: 100px; display: inline-block"
  132. v-else-if="doc_name != ''"
  133. >
  134. {{ doc_name }}
  135. </span> -->
  136. <img
  137. style="height: 30px"
  138. :src="setAdminUserES(item.creator,item.doctor)"
  139. alt=""
  140. srcset=""
  141. v-else
  142. />
  143. </p>
  144. <p v-if="org_id==10598 || org_id==0">
  145. 医师:
  146. <!-- <span
  147. style="width: 100px; display: inline-block"
  148. v-if="item.creator == ''"
  149. >
  150. {{ item.doctor ? item.doctor : "" }}
  151. </span> -->
  152. <!-- <span
  153. style="width: 100px; display: inline-block"
  154. v-else-if="doc_name != ''"
  155. >
  156. {{ doc_name }}
  157. </span> v-else -->
  158. <img
  159. style="height: 30px"
  160. :src="setAdminUserES(item.creator,item.doctor)"
  161. alt=""
  162. srcset=""
  163. />
  164. </p>
  165. <p>日期:{{getTime(item.ctime)?getTime(item.ctime):""}}</p>
  166. </div>
  167. <div class="actionBar">
  168. <!-- <p>审核:{{getDoctor(item.advices[0].checker)?getDoctor(item.advices[0].checker):""}}</p>
  169. <p>配对:</p>
  170. <p>核对:{{getDoctor(item.advices[0].checker)?getDoctor(item.advices[0].checker):""}}</p>
  171. <p>发药:{{getDoctor(item.advices[0].execution_staff)?getDoctor(item.advices[0].execution_staff):""}}</p>
  172. <p>药费:{{getTotalOne(item.id)?getTotalOne(item.id):0}}元</p> -->
  173. <p>审核:</p>
  174. <p>配对:</p>
  175. <p>核对:</p>
  176. <p>发药:</p>
  177. <p>药费:{{getTotalOne(item.id).toFixed(2)?getTotalOne(item.id).toFixed(2):0}}元</p>
  178. <!-- <p>药费:551.2元</p>-->
  179. <!-- <p>药费:466.2元</p>-->
  180. </div>
  181. <div style="page-break-after:always"></div>
  182. </div>
  183. </div>
  184. </div>
  185. </template>
  186. <script>
  187. import { jsGetAge, uParseTime } from '@/utils/tools'
  188. import {getAllDoctorList,getPrescriptionPrint,getHisPatientDetail} from "@/api/project/project"
  189. import {getInitData} from "@/api/his/his"
  190. export default {
  191. props:{
  192. patient_id: Number,
  193. record_date: String,
  194. prescription_id: Number,
  195. his_patient_id:Number,
  196. ids: String,
  197. newHisPatient:Object,
  198. },
  199. data(){
  200. return {
  201. doctorList:[],
  202. advicePrint:{},
  203. yi:4,
  204. patient:{},
  205. tableData:[],
  206. prescriptionInfo:[],
  207. hisPatient:{},
  208. department:[],
  209. prescriptions:[],
  210. projectList:[],
  211. orgname:"",
  212. diagnoses:[],
  213. operatorMaps: {},
  214. operators: [],
  215. doctorList_1: [],
  216. org_id:''
  217. }
  218. },
  219. methods:{
  220. // 电子签名
  221. setAdminUserES(id,name) {
  222. if (id == 0) {
  223. return "";
  224. }
  225. if (id in this.operatorMaps) {
  226. return this.operatorMaps[id].url;
  227. } else {
  228. this.doc_name = name;
  229. return "";
  230. }
  231. },
  232. getAge(patient){
  233. var thisLen = patient.id_card_no.length
  234. var birth = ''
  235. if (thisLen == 15) {
  236. birth = '19' + patient.id_card_no.substr(6, 6)
  237. } else {
  238. birth = patient.id_card_no.substr(6, 8)
  239. }
  240. var births =
  241. birth.substr(0, 4) +
  242. '-' +
  243. birth.substr(4, 2) +
  244. '-' +
  245. birth.substr(6, 2)
  246. return jsGetAge(births, '-')
  247. },
  248. getAllDoctorList(){
  249. getAllDoctorList().then(response=>{
  250. if(response.data.state == 1){
  251. var doctor = response.data.data.doctor
  252. this.doctorList = doctor
  253. }
  254. })
  255. },
  256. getDoctor(id){
  257. var name = ""
  258. for(let i=0;i<this.doctorList.length;i++){
  259. if(id == this.doctorList[i].admin_user_id){
  260. name = this.doctorList[i].user_name
  261. }
  262. }
  263. return name
  264. },
  265. getTime(value, temp) {
  266. if (value != undefined) {
  267. return uParseTime(value, temp)
  268. }
  269. return ''
  270. },
  271. getPrescriptionPrint(){
  272. var params = {
  273. // patient_id:this.patient_id,
  274. // record_date:this.record_date,
  275. // prescription_id:this.prescription_id,
  276. patient_id:this.patient_id,
  277. record_date:this.record_date,
  278. prescription_id:this.prescription_id,
  279. ids:this.ids,
  280. p_type:2,
  281. }
  282. console.log("params",params)
  283. getPrescriptionPrint(params).then(response=>{
  284. if(response.data.state == 1){
  285. var advicePrint = response.data.data.advicePrint
  286. console.log("adviceprint9999",advicePrint)
  287. this.advicePrint = advicePrint
  288. this.prescriptions = advicePrint
  289. console.log("处方222222",this.prescriptions)
  290. this.doctorList_1 = response.data.data.eles;
  291. console.log(this.doctorList_1, "医生列表");
  292. if (this.doctorList_1.length > 0) {
  293. var operatorsLen = this.doctorList_1.length;
  294. for (var index = 0; index < operatorsLen; index++) {
  295. this.$set(
  296. this.operatorMaps,
  297. this.doctorList_1[index].creator,
  298. this.doctorList_1[index]
  299. );
  300. }
  301. }
  302. var hisPatient = response.data.data.hisPatient
  303. console.log("hisPatient",hisPatient)
  304. this.hisPatient = hisPatient
  305. var projectlist = response.data.data.projectlist
  306. console.log("所有项目列表",projectlist)
  307. this.projectList = projectlist
  308. }
  309. })
  310. },
  311. getHisPatientDetail(){
  312. const params = {
  313. patient_id:this.patient_id
  314. }
  315. getHisPatientDetail(params).then(response=>{
  316. if(response.data.state == 1){
  317. var hisPatient = response.data.data.hisPatient
  318. console.log("挂号病人",hisPatient)
  319. this.hisPatient = hisPatient
  320. }
  321. })
  322. },
  323. getInitData(){
  324. getInitData().then(response=>{
  325. if(response.data.state == 1){
  326. this.department = response.data.data.department
  327. this.diagnoses = response.data.data.diagnose
  328. console.log("争端",this.diagnoses)
  329. }
  330. })
  331. },
  332. getDepart(id){
  333. var name = ""
  334. for(let i=0;i<this.department.length;i++){
  335. if(id == this.department[i].id){
  336. name = this.department[i].name
  337. }
  338. }
  339. return name
  340. },
  341. getTotalOne(id) {
  342. var total = 0
  343. var addtotal = 0
  344. for (let i = 0; i < this.prescriptions.length; i++) {
  345. if(id == this.prescriptions[i].id){
  346. if (this.prescriptions[i].project != null) {
  347. for (let a = 0; a < this.prescriptions[i].project.length; a++) {
  348. total = total + this.prescriptions[i].project[a].price * this.prescriptions[i].project[a].count
  349. }
  350. }
  351. if (this.prescriptions[i].additionalcharge != null) {
  352. for (let a = 0; a < this.prescriptions[i].additionalcharge.length; a++) {
  353. addtotal = addtotal + this.prescriptions[i].additionalcharge[a].price * this.prescriptions[i].additionalcharge[a].count
  354. }
  355. }
  356. addtotal = Math.floor(addtotal * 100) / 100
  357. }
  358. }
  359. for (let i = 0; i < this.prescriptions.length; i++) {
  360. if(id == this.prescriptions[i].id){
  361. if (this.prescriptions[i].advices != null) {
  362. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  363. total = total + this.prescriptions[i].advices[a].price * this.prescriptions[i].advices[a].prescribing_number
  364. }
  365. }
  366. if (this.prescriptions[i].additionalcharge != null) {
  367. for (let a = 0; a < this.prescriptions[i].additionalcharge.length; a++) {
  368. addtotal = addtotal + this.prescriptions[i].additionalcharge[a].price * this.prescriptions[i].additionalcharge[a].count
  369. }
  370. }
  371. addtotal = Math.floor(addtotal * 100) / 100
  372. }
  373. }
  374. return total + addtotal
  375. },
  376. getProjectName(id){
  377. var project_name = ""
  378. for(let i=0;i<this.projectList.length;i++){
  379. if(id == this.projectList[i].id){
  380. project_name = this.projectList[i].project_name
  381. }
  382. }
  383. return project_name
  384. },
  385. getDiagnosis(id){
  386. let arr = id.split(',')
  387. var name = ""
  388. for(let i=0;i<this.diagnoses.length;i++){
  389. if(arr.indexOf(String(this.diagnoses[i].id)) > -1){
  390. name += this.diagnoses[i].class_name + ' '
  391. }
  392. }
  393. return name
  394. }
  395. },
  396. created(){
  397. this.getAllDoctorList()
  398. this.getInitData()
  399. this.getPrescriptionPrint()
  400. this.getHisPatientDetail()
  401. var xtuser = this.$store.getters.xt_user;
  402. this.orgname = xtuser.org.org_name;
  403. this.org_id = this.$store.getters.xt_user.org.id
  404. },
  405. watch:{
  406. ids:function(val){
  407. this.ids = val
  408. this.getPrescriptionPrint()
  409. }
  410. }
  411. }
  412. </script>
  413. <style lang="scss" scoped>
  414. .prescription-print{
  415. -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 60px rgba(0, 0, 0, 0.06) inset;
  416. -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;
  417. box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;
  418. margin-bottom: 20px;
  419. padding:20px 10px;
  420. }
  421. .printTitle{
  422. font-size: 22px;
  423. text-align: center;
  424. font-weight: bold;
  425. }
  426. .infoTitle{
  427. display: flex;
  428. border-bottom: 2px solid #000;
  429. margin-top:10px;
  430. line-height: 24px;
  431. padding:0 10px;
  432. }
  433. .infoTitle p{
  434. width: 200px;
  435. }
  436. .infoMain{
  437. display: flex;
  438. flex-wrap: wrap;
  439. border-bottom: 2px solid #000;
  440. padding:0 10px;
  441. }
  442. .infoMain div{
  443. width: 50%;
  444. line-height: 24px;
  445. }
  446. .prescriptionBox{
  447. padding:0 10px;
  448. min-height:450px;
  449. }
  450. .Rp{
  451. font-size: 22px;
  452. font-weight: bold;
  453. }
  454. .drugsBox{
  455. padding-left: 40px;
  456. margin-bottom: 10px;
  457. }
  458. .drugsBox div{
  459. line-height: 20px;
  460. }
  461. .drugsOne{
  462. line-height: 24px;
  463. }
  464. .drugsOne span{
  465. margin-right: 10px;
  466. }
  467. .doctorBox{
  468. display: flex;
  469. justify-content: space-between;
  470. padding:0 10px;
  471. line-height: 24px;
  472. border-bottom: 2px solid #000;
  473. }
  474. .actionBar{
  475. display: flex;
  476. justify-content: space-between;
  477. line-height: 24px;
  478. padding:0 10px;
  479. }
  480. .actionBar p{
  481. width:150px;
  482. }
  483. </style>