printfour.vue 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. <template>
  2. <div id="prescription-print">
  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">检验申请单</div>
  6. <div style="border: 1px solid #000;margin-bottom: 10px;">
  7. <div
  8. style="
  9. display: flex;
  10. justify-content: space-between;
  11. border-bottom: 1px solid #000;
  12. line-height: 40px;
  13. padding: 0 10px;
  14. "
  15. >
  16. <div>是否急诊:否</div>
  17. <div>
  18. 结算方式:{{
  19. faber && faber.transBody
  20. ? getName(faber.transBody.outputlist1)
  21. : ""
  22. }}
  23. </div>
  24. <div>金额:{{ total }}</div>
  25. </div>
  26. <div
  27. style="
  28. display: flex;
  29. justify-content: space-between;
  30. border-bottom: 1px solid #000;
  31. line-height: 40px;
  32. padding: 0 10px;
  33. "
  34. >
  35. <div>
  36. 姓名:{{
  37. advicePrint[0].patient.name
  38. ? advicePrint[0].patient.name.indexOf("(") > -1
  39. ? advicePrint[0].patient.name.substring(
  40. 0,
  41. advicePrint[0].patient.name.indexOf("(")
  42. )
  43. : advicePrint[0].patient.name
  44. : ""
  45. }}
  46. </div>
  47. <div>
  48. 性别:
  49. <span v-if="advicePrint[0].patient.gender == 1">男</span>
  50. <span v-if="advicePrint[0].patient.gender == 2">女</span>
  51. </div>
  52. <div>年龄:{{getAge(advicePrint[0].patient)?getAge(advicePrint[0].patient):""}}岁</div>
  53. </div>
  54. <div style="margin-bottom: 20px; padding: 10px 10px 0" v-if="org_id!=10278 && org_id!=10138 && org_id!=0">
  55. 病史摘要:{{
  56. history.history_of_present_illness
  57. ? history.history_of_present_illness
  58. : ""
  59. }}
  60. </div>
  61. <div style="margin-bottom: 20px; padding: 0 10px">
  62. 临床诊断:{{ getDiagnosis(advicePrint[0].info.diagnosis) }}
  63. </div>
  64. <div style="display: flex; margin-bottom: 20px; padding: 0 10px">
  65. <div>检验项目:</div>
  66. <div >
  67. <div v-for="ite in item.project2" style="margin-bottom: 10px">
  68. {{ ite}}
  69. </div>
  70. <div v-for="ite in item.project3" style="margin-bottom: 10px">
  71. {{ ite}}
  72. </div>
  73. <!-- <div v-for="ite in item.singleProjectPrint" style="margin-bottom: 10px">
  74. <span v-if="ite.team_id>0">
  75. {{ ite.team.project_team }}
  76. </span>
  77. <span v-else>
  78. {{ ite.project.project_name }}
  79. </span>
  80. </div> -->
  81. </div>
  82. </div>
  83. <div
  84. style="
  85. display: flex;
  86. justify-content: space-between;
  87. border-top: 1px solid #000;
  88. line-height: 40px;
  89. padding: 0 10px;
  90. "
  91. >
  92. <div>开单医生: {{ getAdminUser(item.creator) }}</div>
  93. <div>
  94. 开单日期:
  95. {{ getTime(pre_time) ? getTime(pre_time).split(" ")[0] : "" }}
  96. </div>
  97. <div>
  98. 医生签字:
  99. <span style="width: 100px; display: inline-block"></span>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </template>
  107. <script>
  108. import { jsGetAge, uParseTime } from "@/utils/tools";
  109. import {
  110. getAllDoctorList,
  111. getPrescriptionPrint,
  112. getHisPatientDetail,
  113. getPatientCaseHistory,
  114. } from "@/api/project/project";
  115. import { getInitData } from "@/api/his/his";
  116. export default {
  117. props: {
  118. patient_id: Number,
  119. record_date: String,
  120. prescription_id: Number,
  121. ids: String,
  122. },
  123. data() {
  124. return {
  125. doctorList_1: [],
  126. doctorList: [],
  127. advicePrint: {},
  128. patient: {},
  129. tableData: [],
  130. prescriptionInfo: [],
  131. hisPatient: {},
  132. department: [],
  133. prescriptions: [],
  134. projectList: [],
  135. doc_name: "",
  136. orgname: "",
  137. diagnoses: [],
  138. pageArr: [],
  139. faber: {},
  140. total: 0,
  141. projectPrint: [],
  142. time: "",
  143. doctor: "",
  144. org_id: "",
  145. singleProjectPrint: [],
  146. operatorMaps: {},
  147. adminUser:[],
  148. arr:[],
  149. };
  150. },
  151. methods: {
  152. getAge(patient){
  153. // 将时间戳转换为 Date 对象
  154. const birthday = new Date(patient.birthday* 1000);
  155. // 获取当前日期
  156. const now = new Date();
  157. // 计算年龄差
  158. const ageDiffMs = now - birthday;
  159. const ageDate = new Date(ageDiffMs); // 不需要减掉 1970 年的时间戳
  160. // 提取年份
  161. const age = ageDate.getUTCFullYear() - 1970;
  162. return age
  163. },
  164. getPatientCaseHistory() {
  165. const params = {
  166. patient_id: this.patient_id,
  167. };
  168. getPatientCaseHistory(params).then((response) => {
  169. if (response.data.state == 1) {
  170. var history = response.data.data.history;
  171. // console.log("中国history222222", history);
  172. this.history = history;
  173. }
  174. });
  175. },
  176. getAllDoctorList() {
  177. getAllDoctorList().then((response) => {
  178. if (response.data.state == 1) {
  179. var doctor = response.data.data.doctor;
  180. this.doctorList = doctor;
  181. }
  182. });
  183. },
  184. getDoctor(id) {
  185. var name = "";
  186. for (let i = 0; i < this.doctorList.length; i++) {
  187. if (id == this.doctorList[i].admin_user_id) {
  188. name = this.doctorList[i].user_name;
  189. }
  190. }
  191. return name;
  192. },
  193. getTime(value, temp) {
  194. if (value != undefined) {
  195. return uParseTime(value, temp);
  196. }
  197. return "";
  198. },
  199. // 数据源
  200. getPrescriptionPrint() {
  201. var params = {
  202. // patient_id:this.patient_id,
  203. // record_date:this.record_date,
  204. // prescription_id:this.prescription_id,
  205. patient_id: this.patient_id,
  206. record_date: this.record_date,
  207. prescription_id: this.prescription_id,
  208. ids: this.ids,
  209. p_type: 2,
  210. };
  211. // console.log("params", params);
  212. getPrescriptionPrint(params).then((response) => {
  213. if (response.data.state == 1) {
  214. var advicePrint = response.data.data.advicePrint;
  215. // console.log("adviceprint999933333", advicePrint);
  216. this.advicePrint = advicePrint;
  217. this.advicePrint.map((item) =>{
  218. let a = []
  219. let b = []
  220. const project2 = []
  221. if (item.project.length > 0) {
  222. item.project.map((it) => {
  223. if(it.team_id>0){
  224. // b={
  225. // id:item.id,
  226. // label:it.team.project_team
  227. // }
  228. // project2.push(it.team.project_team)
  229. b.push(it.team.project_team)
  230. }else{
  231. // a={
  232. // id:item.id,
  233. // label:it.project.project_name
  234. // }
  235. a.push(it.project.project_name)
  236. }
  237. });
  238. console.log('ccccccc',a,b);
  239. }
  240. const arr = [...new Set(b)]
  241. item['project2'] = arr
  242. item['project3'] = a
  243. })
  244. // console.log('ccccccc',this.arr,a);
  245. this.prescriptions = advicePrint;
  246. console.log("处方99999222222", response.data.data);
  247. var hisPatient = response.data.data.hisPatient;
  248. this.adminUser = response.data.data.roles
  249. // console.log("hisPatient", hisPatient);
  250. this.hisPatient = hisPatient;
  251. let projectPrint = [];
  252. let total = 0;
  253. this.advicePrint.map((item) => {
  254. let singleProjectPrint = []
  255. // console.log("imte233232323232323223", item.project);
  256. if (item.project.length > 0) {
  257. item.project.map((it) => {
  258. if (it.type == 2) {
  259. if (it.project.cost_classify == 3) {
  260. projectPrint.push(it);
  261. singleProjectPrint.push(it)
  262. total += it.project.price * parseInt(it.count);
  263. }
  264. }
  265. });
  266. }
  267. item["singleProjectPrint"] = singleProjectPrint
  268. });
  269. this.doctorList_1 = response.data.data.eles;
  270. // console.log(this.doctorList_1, "医生列表");
  271. if (this.doctorList_1.length > 0) {
  272. var operatorsLen = this.doctorList_1.length;
  273. for (var index = 0; index < operatorsLen; index++) {
  274. this.$set(
  275. this.operatorMaps,
  276. this.doctorList_1[index].creator,
  277. this.doctorList_1[index]
  278. );
  279. }
  280. }
  281. let data = [];
  282. let data2 = [];
  283. projectPrint.map((item) => {
  284. data2.push(item);
  285. });
  286. this.projectPrint = data;
  287. console.log("列表", this.projectPrint);
  288. this.total = total.toFixed(2);
  289. this.pre_time = this.advicePrint[0].pre_time;
  290. this.doctor = this.advicePrint[0].creator;
  291. this.singleProjectPrint = data2;
  292. var projectlist = response.data.data.projectlist;
  293. var projectlist = response.data.data.projectlist;
  294. // console.log("所有项目列表", projectlist);
  295. this.projectList = projectlist;
  296. this.getPage();
  297. let outputlist1Name = response.data.data.his.patient_info
  298. ? JSON.parse(response.data.data.his.patient_info)
  299. : {};
  300. this.faber = outputlist1Name;
  301. }
  302. });
  303. },
  304. // 电子签名
  305. setAdminUserES(id) {
  306. // console.log(id, "id");
  307. if (id == 0) {
  308. return "";
  309. }
  310. if (id in this.operatorMaps) {
  311. // console.log(this.operatorMaps, "this.operatorMaps");
  312. return this.operatorMaps[id].url;
  313. } else {
  314. // console.log("po");
  315. return "";
  316. }
  317. },
  318. getAdminUser(id) {
  319. if (id == 0) {
  320. return "";
  321. }
  322. if (id == undefined) {
  323. return "";
  324. }
  325. for (let i = 0; i < this.adminUser.length; i++) {
  326. if (this.adminUser[i].admin_user_id == id) {
  327. return this.adminUser[i].user_name;
  328. }
  329. }
  330. },
  331. getHisPatientDetail() {
  332. const params = {
  333. patient_id: this.patient_id,
  334. };
  335. getHisPatientDetail(params).then((response) => {
  336. if (response.data.state == 1) {
  337. var hisPatient = response.data.data.hisPatient;
  338. // console.log("挂号病人", hisPatient);
  339. this.hisPatient = hisPatient;
  340. }
  341. });
  342. },
  343. getInitData() {
  344. getInitData().then((response) => {
  345. if (response.data.state == 1) {
  346. this.department = response.data.data.department;
  347. this.diagnoses = response.data.data.diagnose.sort(this.compare("id"));
  348. // console.log("争端", this.diagnoses);
  349. }
  350. });
  351. },
  352. getDepart(id) {
  353. var name = "";
  354. for (let i = 0; i < this.department.length; i++) {
  355. if (id == this.department[i].id) {
  356. name = this.department[i].name;
  357. }
  358. }
  359. return name;
  360. },
  361. getTotalOne(id) {
  362. var total = 0;
  363. var addtotal = 0;
  364. for (let i = 0; i < this.prescriptions.length; i++) {
  365. if (id == this.prescriptions[i].id) {
  366. if (this.prescriptions[i].project != null) {
  367. for (let a = 0; a < this.prescriptions[i].project.length; a++) {
  368. total =
  369. total +
  370. this.prescriptions[i].project[a].price *
  371. this.prescriptions[i].project[a].count;
  372. }
  373. }
  374. if (this.prescriptions[i].additionalcharge != null) {
  375. for (
  376. let a = 0;
  377. a < this.prescriptions[i].additionalcharge.length;
  378. a++
  379. ) {
  380. addtotal =
  381. addtotal +
  382. this.prescriptions[i].additionalcharge[a].price *
  383. this.prescriptions[i].additionalcharge[a].count;
  384. }
  385. }
  386. addtotal = Math.floor(addtotal * 100) / 100;
  387. }
  388. }
  389. for (let i = 0; i < this.prescriptions.length; i++) {
  390. if (id == this.prescriptions[i].id) {
  391. if (this.prescriptions[i].advices != null) {
  392. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  393. total =
  394. total +
  395. this.prescriptions[i].advices[a].price *
  396. this.prescriptions[i].advices[a].prescribing_number;
  397. }
  398. }
  399. if (this.prescriptions[i].additionalcharge != null) {
  400. for (
  401. let a = 0;
  402. a < this.prescriptions[i].additionalcharge.length;
  403. a++
  404. ) {
  405. addtotal =
  406. addtotal +
  407. this.prescriptions[i].additionalcharge[a].price *
  408. this.prescriptions[i].additionalcharge[a].count;
  409. }
  410. }
  411. addtotal = Math.floor(addtotal * 100) / 100;
  412. }
  413. }
  414. return total + addtotal;
  415. },
  416. getProjectName(id) {
  417. var project_name = "";
  418. for (let i = 0; i < this.projectList.length; i++) {
  419. if (id == this.projectList[i].id) {
  420. project_name = this.projectList[i].project_name;
  421. }
  422. }
  423. return project_name;
  424. },
  425. getDiagnosis(ids) {
  426. let newIds = ids.split(",").sort(function (a, b) {
  427. return a - b;
  428. });
  429. var name = "";
  430. let nameArr = [];
  431. for (let i = 0; i < this.diagnoses.length; i++) {
  432. // if(id == this.diagnoses[i].id){
  433. // name = this.diagnoses[i].class_name
  434. // }
  435. if (newIds.indexOf(this.diagnoses[i].id.toString()) > -1) {
  436. // name += diagnoses[i].class_name + ' '
  437. nameArr.push(this.diagnoses[i].class_name);
  438. }
  439. }
  440. let newNameArr = [];
  441. nameArr.map((item, index) => {
  442. if (item == "尿毒症") {
  443. newNameArr.push(item);
  444. nameArr.splice(index, 1, "");
  445. }
  446. });
  447. newNameArr.push(...nameArr);
  448. return newNameArr.join(" ");
  449. },
  450. compare(property) {
  451. return function (a, b) {
  452. var value1 = a[property];
  453. var value2 = b[property];
  454. return value1 - value2; //升序排序
  455. };
  456. },
  457. getPage() {
  458. this.page = 1;
  459. this.pageArr = [];
  460. this.advicePrint.map((item) => {
  461. let arr = [];
  462. item.pageArr = [];
  463. if (item.advices.length <= 5) {
  464. this.page = 1;
  465. arr.push(item.advices.length);
  466. item.pageArr.push(arr);
  467. } else if (item.advices.length > 5) {
  468. this.page = parseInt(item.advices.length / 5);
  469. let num = item.advices.length % 5;
  470. for (var i = 0; i < this.page; i++) {
  471. item.pageArr.push([5]);
  472. }
  473. if (num != 0) {
  474. item.pageArr.push([num]);
  475. }
  476. }
  477. });
  478. // console.log('this.pageArr',this.pageArr)
  479. },
  480. getName(list) {
  481. console.log("list", list);
  482. let new_list = [];
  483. for (let i = 0; i < list.length; i++) {
  484. if (list[i].aac031 == "1") {
  485. new_list.push(list[i]);
  486. }
  487. }
  488. switch (new_list[0].bcc334) {
  489. case "A31001":
  490. return "深圳医保1档";
  491. break;
  492. case "A31002":
  493. return "深圳医保2档";
  494. break;
  495. case "A31003":
  496. return "深圳医保3档";
  497. break;
  498. case "A31004":
  499. return "二档(少儿)";
  500. break;
  501. case "A31005":
  502. return "学生二档";
  503. break;
  504. case "A31006":
  505. return "大学生二档";
  506. break;
  507. case "A32001":
  508. return "在职公务员";
  509. break;
  510. case "A32002":
  511. return "在职驻深公务员";
  512. break;
  513. case "A39301":
  514. return "家属统筹医疗";
  515. break;
  516. case "A41001":
  517. return "工伤在职";
  518. break;
  519. case "A51001":
  520. return "生育在职";
  521. break;
  522. case "A52001":
  523. return "生育医疗一档";
  524. break;
  525. case "A52002":
  526. return "生育医疗一档";
  527. break;
  528. case "C31001":
  529. return "一档医疗退休";
  530. break;
  531. case "C31002":
  532. return "二档医疗退休";
  533. break;
  534. }
  535. },
  536. },
  537. created() {
  538. this.getAllDoctorList();
  539. this.getInitData();
  540. this.getPrescriptionPrint();
  541. this.getHisPatientDetail();
  542. this.getPatientCaseHistory();
  543. var xtuser = this.$store.getters.xt_user;
  544. this.orgname = xtuser.org.org_name;
  545. this.org_id = this.$store.getters.xt_user.org_id;
  546. },
  547. watch: {
  548. ids: function (val) {
  549. this.ids = val;
  550. this.getPrescriptionPrint();
  551. },
  552. },
  553. };
  554. </script>
  555. <style lang="scss" scoped>
  556. .prescription-print {
  557. -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27),
  558. 0 0 60px rgba(0, 0, 0, 0.06) inset;
  559. -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27),
  560. 0 0 40px rgba(0, 0, 0, 0.06) inset;
  561. box-shadow: 0 1px 4px rgba(0, 0, 0, 0.27), 0 0 40px rgba(0, 0, 0, 0.06) inset;
  562. margin-bottom: 20px;
  563. padding: 20px 10px;
  564. }
  565. .printTitle {
  566. font-size: 22px;
  567. text-align: center;
  568. font-weight: bold;
  569. margin-bottom: 10px;
  570. }
  571. .infoTitle {
  572. display: flex;
  573. margin-top: 10px;
  574. line-height: 24px;
  575. }
  576. .infoTitle div {
  577. width: 200px;
  578. }
  579. .infoMain {
  580. display: flex;
  581. flex-wrap: wrap;
  582. margin-top: 10px;
  583. }
  584. .infoMain div {
  585. width: 50%;
  586. line-height: 24px;
  587. }
  588. .prescriptionBox {
  589. padding: 0 10px;
  590. min-height: 400px;
  591. }
  592. .Rp {
  593. font-size: 22px;
  594. font-weight: bold;
  595. }
  596. .drugsBox {
  597. padding-left: 40px;
  598. margin-bottom: 10px;
  599. }
  600. .drugsBox div {
  601. line-height: 20px;
  602. }
  603. .drugsOne {
  604. line-height: 24px;
  605. }
  606. .drugsOne span {
  607. margin-right: 20px;
  608. }
  609. .doctorBox {
  610. display: flex;
  611. justify-content: space-between;
  612. padding: 0 10px;
  613. line-height: 24px;
  614. border-bottom: 2px solid #000;
  615. }
  616. .actionBar {
  617. display: flex;
  618. justify-content: space-between;
  619. line-height: 24px;
  620. padding: 0 10px;
  621. }
  622. .actionBar p {
  623. width: 150px;
  624. }
  625. .under_line {
  626. display: inline-block;
  627. border-bottom: 1px solid #000;
  628. flex: 1;
  629. }
  630. </style>