Inspection.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. <template>
  2. <div class="inspection">
  3. <div>
  4. <div class="toolBox">
  5. <div class="toolOne" @click="typeShow = true">
  6. <div style="display: flex;align-items: center;">
  7. {{ type }}
  8. <van-icon name="arrow-down" />
  9. </div>
  10. </div>
  11. <div class="toolOne" @click="startShow = true">
  12. <div style="display: flex;align-items: center;">
  13. {{ startTime }}
  14. <van-icon name="arrow-down" />
  15. </div>
  16. </div>
  17. <div class="toolOne" @click="endShow = true">
  18. <div style="display: flex;align-items: center;">
  19. {{ endTime }}
  20. <van-icon name="arrow-down" />
  21. </div>
  22. </div>
  23. </div>
  24. <div class="adviceBox" v-if="Inspection.length > 0">
  25. <van-list
  26. v-model="loading"
  27. :finished="finished"
  28. finished-text="没有更多了"
  29. >
  30. <div class="adviceMain">
  31. <div
  32. class="adviceOne"
  33. v-for="(item, index) in Inspection"
  34. :key="index"
  35. >
  36. <div class="adviceTitle">
  37. <p>{{ getTime(item.inspect_date) }}</p>
  38. <van-icon
  39. class="ellipsis"
  40. name="ellipsis"
  41. @click="Delete(item.inspect_date, index)"
  42. />
  43. </div>
  44. <div class="orderContent">
  45. <div class="flexBox" v-for="(it, i) in item.child" :key="i">
  46. <p>{{ it }}</p>
  47. <van-icon
  48. class="ellipsis"
  49. name="ellipsis"
  50. @click="DeleteOne(it, item.inspect_date, i)"
  51. />
  52. </div>
  53. </div>
  54. <div class="all" @click="toInspection(item.inspect_date)">全部</div>
  55. </div>
  56. </div>
  57. </van-list>
  58. </div>
  59. <div class="noimgBox" v-else>
  60. <img src="../../../assets/images/none.png" alt />
  61. </div>
  62. </div>
  63. <!-- <div class="add">
  64. <div style="display: flex;align-items: center;">
  65. <van-icon class="addIcon" name="add" />新增
  66. </div>
  67. </div>-->
  68. <!-- 弹出层 -->
  69. <div>
  70. <van-popup
  71. v-model="typeShow"
  72. position="bottom"
  73. :style="{ height: '40%' }"
  74. >
  75. <van-picker
  76. show-toolbar
  77. :columns="columns"
  78. @cancel="onCancel"
  79. @confirm="onConfirm"
  80. />
  81. </van-popup>
  82. <van-popup
  83. v-model="startShow"
  84. position="bottom"
  85. :style="{ height: '40%' }"
  86. >
  87. <van-datetime-picker
  88. v-model="currentDate"
  89. type="date"
  90. :min-date="minDate"
  91. :max-date="maxDate"
  92. @confirm="getstartTime"
  93. @cancel="startShow = false"
  94. />
  95. </van-popup>
  96. <van-popup v-model="endShow" position="bottom" :style="{ height: '40%' }">
  97. <van-datetime-picker
  98. v-model="currentDate"
  99. type="date"
  100. :min-date="minDate"
  101. :max-date="maxDate"
  102. @confirm="getstartTime2"
  103. @cancel="endShow = false"
  104. />
  105. </van-popup>
  106. <van-action-sheet
  107. v-model="newShow"
  108. :actions="actions"
  109. cancel-text="取消"
  110. @select="toDelete"
  111. />
  112. <van-action-sheet
  113. v-model="newShowOne"
  114. :actions="actions1"
  115. cancel-text="取消"
  116. @select="DeleteInspectionOne"
  117. />
  118. </div>
  119. </div>
  120. </template>
  121. <script>
  122. import {
  123. getPatientDetail,
  124. getAllInspection,
  125. getInspection,
  126. DeleteInspection,
  127. DeleteChildInspection
  128. } from "@/api/patient/patient";
  129. import { uParseTime } from "@/utils/tools";
  130. import { Dialog } from "vant";
  131. const moment = require("moment");
  132. export default {
  133. props: {
  134. active: Number
  135. },
  136. data() {
  137. return {
  138. loading: false,
  139. finished: false,
  140. newShow: false,
  141. newShowOne: false,
  142. typeShow: false,
  143. startShow: false,
  144. endShow: false,
  145. type: "全部",
  146. columns: [],
  147. startTime: "请选择",
  148. endTime: "请选择",
  149. minDate: new Date(1970, 0, 1),
  150. maxDate: new Date(2025, 10, 1),
  151. currentDate: new Date(),
  152. actions: [{ name: "全部删除" }],
  153. actions1: [{ name: "删除" }],
  154. showOne: true,
  155. showTwo: false,
  156. list: [],
  157. page: 1,
  158. limit: 10,
  159. total: 0,
  160. Inspection: [],
  161. project_id: 0,
  162. patientid: 0,
  163. checkdata: [],
  164. date: 0,
  165. index: 0,
  166. name: "",
  167. date: "",
  168. index: ""
  169. };
  170. },
  171. methods: {
  172. onCancel() {
  173. this.typeShow = false;
  174. },
  175. onConfirm(value) {
  176. // console.log("value值", value);
  177. // console.log("columns", this.checkdata);
  178. for (let i = 0; i < this.checkdata.length; i++) {
  179. if (value == this.checkdata[i].project_name) {
  180. this.project_id = this.checkdata[i].project_id;
  181. }
  182. }
  183. // console.log("projectid", this.project_id);
  184. this.type = value;
  185. this.getInspection(
  186. this.patientid,
  187. this.limit,
  188. this.page,
  189. this.startTime,
  190. this.endTime,
  191. this.project_id
  192. );
  193. this.typeShow = false;
  194. },
  195. getstartTime(value) {
  196. // console.log(value);
  197. let year = value.getFullYear();
  198. let month = value.getMonth() + 1;
  199. let day = value.getDate();
  200. if (month >= 1 && month <= 9) {
  201. month = `0${month}`;
  202. }
  203. if (day >= 1 && day <= 9) {
  204. day = `0${day}`;
  205. }
  206. this.startTime = `${year}-${month}-${day}`;
  207. this.getInspection(
  208. this.patientid,
  209. this.limit,
  210. this.page,
  211. this.startTime,
  212. this.endTime,
  213. this.project_id
  214. );
  215. this.startShow = false;
  216. },
  217. getstartTime2(value) {
  218. // console.log(value);
  219. let year = value.getFullYear();
  220. let month = value.getMonth() + 1;
  221. let day = value.getDate();
  222. if (month >= 1 && month <= 9) {
  223. month = `0${month}`;
  224. }
  225. if (day >= 1 && day <= 9) {
  226. day = `0${day}`;
  227. }
  228. this.endTime = `${year}-${month}-${day}`;
  229. this.getInspection(
  230. this.patientid,
  231. this.limit,
  232. this.page,
  233. this.startTime,
  234. this.endTime,
  235. this.project_id
  236. );
  237. this.endShow = false;
  238. },
  239. getPatientDetail(patientid) {
  240. getPatientDetail(patientid).then(response => {
  241. if (response.data.state === 1) {
  242. var patientDetail = response.data.data.patientDetail;
  243. if (patientDetail.blood_patients == 0) {
  244. this.showOne = false;
  245. this.showTwo = true;
  246. }
  247. if (patientDetail.blood_patients == 1) {
  248. this.showOne = true;
  249. this.showTwo = false;
  250. }
  251. this.patientName = patientDetail.name;
  252. }
  253. });
  254. },
  255. getAllInspection() {
  256. getAllInspection().then(response => {
  257. if (response.data.state === 1) {
  258. var inspection = response.data.data.inspection;
  259. this.checkdata = inspection;
  260. for (let i = 0; i < inspection.length; i++) {
  261. this.columns.push(inspection[i].project_name);
  262. }
  263. }
  264. });
  265. },
  266. getInspection(patientid) {
  267. getInspection(
  268. patientid,
  269. this.limit,
  270. this.page,
  271. this.startTime,
  272. this.endTime,
  273. this.project_id
  274. ).then(response => {
  275. if (response.data.state == 1) {
  276. var inspection = response.data.data.inspection;
  277. // console.log("为什么", inspection);
  278. var total = response.data.data.total;
  279. // console.log("total", total);
  280. let dataInfo = {};
  281. inspection.forEach((item, index) => {
  282. let { inspect_date } = item;
  283. if (!dataInfo[inspect_date]) {
  284. dataInfo[inspect_date] = {
  285. inspect_date,
  286. child: []
  287. };
  288. }
  289. dataInfo[inspect_date].child.push(item);
  290. });
  291. let list = Object.values(dataInfo); // list 转换成功的数据
  292. // console.log("按时间分组", list);
  293. let a = [];
  294. list.map((item, index) => {
  295. let arr = [];
  296. a.push(item.child);
  297. item.child.map((it, i) => {
  298. if (arr.indexOf(it.project_name) != -1) {
  299. } else {
  300. arr.push(it.project_name);
  301. }
  302. });
  303. // console.log("arr", arr);
  304. item.child = arr;
  305. });
  306. this.Inspection = list.reverse();
  307. }
  308. });
  309. this.finished = true;
  310. },
  311. getTime(time) {
  312. // return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
  313. return uParseTime(time, "{y}-{m}-{d}");
  314. },
  315. onLoad() {},
  316. toInspection(date) {
  317. var patientid = this.$route.query.patientid;
  318. this.$router.push(
  319. "/allinspection?patientid=" +
  320. patientid +
  321. "&date=" +
  322. date +
  323. "&active=" +
  324. this.active
  325. );
  326. },
  327. Delete(date, index) {
  328. this.newShow = true;
  329. this.date = date;
  330. this.index = index;
  331. },
  332. toDelete(val) {
  333. // console.log("val", val);
  334. if (val.name === "全部删除") {
  335. this.DeleteInspection(this.date, this.index);
  336. }
  337. },
  338. DeleteOne(name, date, index) {
  339. this.newShowOne = true;
  340. this.name = name;
  341. this.date = date;
  342. this.index = index;
  343. },
  344. DeleteInspectionOne(val) {
  345. if (val.name == "删除") {
  346. this.DeleteChildInspection(this.name, this.date, this.index);
  347. }
  348. },
  349. // 删除检验检测
  350. DeleteInspection(name, date, index) {
  351. Dialog.confirm({
  352. title: "删除提示!",
  353. message: "确认删除该条信息吗?,删除后将无法恢复!"
  354. }).then(() => {
  355. DeleteInspection(name, date).then(response => {
  356. if (response.data.state === 1) {
  357. var msg = response.data.data.msg;
  358. this.Inspection.splice(index, 1);
  359. this.newShow = false;
  360. }
  361. });
  362. });
  363. },
  364. // 删除子项目
  365. DeleteChildInspection(name, date, index) {
  366. Dialog.confirm({
  367. title: "删除提示!",
  368. message: "确认删除该条信息吗?,删除后将无法恢复!"
  369. }).then(() => {
  370. DeleteChildInspection(name, date).then(response => {
  371. if (response.data.state === 1) {
  372. var msg = response.data.data.msg;
  373. // this.Inspection.splice(index, 1);
  374. this.getInspection(this.patientid);
  375. this.newShowOne = false;
  376. }
  377. });
  378. });
  379. }
  380. },
  381. created() {
  382. var patientid = this.$route.query.patientid;
  383. this.patientid = patientid;
  384. this.getPatientDetail(patientid);
  385. // 获取所有检验检查项目
  386. this.getAllInspection();
  387. this.getInspection(patientid);
  388. }
  389. };
  390. </script>
  391. <style lang="scss" scoped>
  392. .inspection {
  393. height: 100%;
  394. overflow-y: auto;
  395. .toolBox {
  396. display: flex;
  397. height: 3.125rem;
  398. justify-content: space-around;
  399. align-items: center;
  400. .toolOne {
  401. width: 6.25rem;
  402. height: 1.875rem;
  403. background: rgba(246, 246, 246, 1);
  404. border-radius: 5px;
  405. text-align: center;
  406. font-size: 0.8125rem;
  407. color: #8d8d8d;
  408. display: flex;
  409. align-items: center;
  410. justify-content: space-around;
  411. }
  412. }
  413. .adviceBox {
  414. padding: 0 1.125rem;
  415. margin-bottom: 3.125rem;
  416. }
  417. .adviceMain{
  418. >div:last-child{
  419. border: none;
  420. }
  421. }
  422. .adviceOne {
  423. // box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  424. border-bottom: 1px solid #e5e5e5;
  425. padding-bottom: 0.625rem;
  426. }
  427. .adviceTitle {
  428. padding-top: 0.625rem;
  429. display: flex;
  430. align-items: center;
  431. justify-content: space-between;
  432. p {
  433. color: #000000;
  434. font-weight: bold;
  435. font-size: 0.9375rem;
  436. }
  437. }
  438. .ellipsis {
  439. font-size: 1.25rem;
  440. color: #cccccc;
  441. }
  442. .orderContent {
  443. font-size: 0.875rem;
  444. color: rgba(49, 50, 52, 1);
  445. margin-top: 0.625rem;
  446. p {
  447. line-height: 1.25rem;
  448. }
  449. }
  450. .doctorBox {
  451. font-size: 0.75rem;
  452. color: rgba(152, 152, 152, 1);
  453. line-height: 1.125rem;
  454. display: flex;
  455. align-items: center;
  456. justify-content: space-between;
  457. margin-top: 0.625rem;
  458. }
  459. .all {
  460. font-size: 0.8125rem;
  461. color: #5b98ff;
  462. margin-top: 0.625rem;
  463. }
  464. .noimgBox {
  465. margin-top: 40%;
  466. img {
  467. width: 9.375rem;
  468. height: 9.375rem;
  469. margin: 0 auto;
  470. display: block;
  471. }
  472. }
  473. .add {
  474. position: fixed;
  475. bottom: 0;
  476. left: 0;
  477. width: 100%;
  478. height: 2.75rem;
  479. background: rgba(255, 255, 255, 1);
  480. box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  481. display: flex;
  482. align-items: center;
  483. justify-content: space-around;
  484. font-size: 0.9375rem;
  485. color: #979798;
  486. .addIcon {
  487. color: #5b98ff;
  488. font-size: 1.25rem;
  489. margin-right: 0.25rem;
  490. }
  491. }
  492. .flexBox {
  493. display: flex;
  494. justify-content: space-between;
  495. }
  496. }
  497. ::-webkit-scrollbar {
  498. width: 0;
  499. }
  500. </style>