Inspection.vue 14KB

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