Inspection.vue 14KB

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