printThree.vue 17KB

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