RescueRecord.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <div class="newRescueRecord">
  3. <div>
  4. <div class="toolBox">
  5. <div class="toolOne" @click="startShow = true">
  6. <div style="display: flex;align-items: center;">
  7. {{ startTime }}
  8. <van-icon name="arrow-down" />
  9. </div>
  10. </div>
  11. <div class="toolOne" @click="endShow = true">
  12. <div style="display: flex;align-items: center;">
  13. {{ endTime }}
  14. <van-icon name="arrow-down" />
  15. </div>
  16. </div>
  17. </div>
  18. <div class="adviceBox" v-if="rescueRecords.length > 0">
  19. <van-list
  20. v-model="loading"
  21. :finished="finished"
  22. finished-text="没有更多了"
  23. @load="onLoad"
  24. >
  25. <div class="adviceMain">
  26. <div
  27. class="adviceOne"
  28. v-for="(item, index) in this.rescueRecords"
  29. :key="index"
  30. >
  31. <div class="adviceTitle">
  32. <p>{{ getTime(item.record_time) }}</p>
  33. <van-icon
  34. class="ellipsis"
  35. name="ellipsis"
  36. @click="toDeleteRescueRecord(item.id, item.index)"
  37. />
  38. </div>
  39. <div class="statOrder">
  40. <div class="orderContent" @click="toRescueRecord(item.id)">
  41. <p>
  42. <span v-html="item.content"></span>
  43. </p>
  44. </div>
  45. <div class="doctorBox">
  46. <p>记录医生:{{ item.user_name }}</p>
  47. </div>
  48. </div>
  49. <div class="all">全部</div>
  50. </div>
  51. </div>
  52. </van-list>
  53. </div>
  54. <div class="noimgBox" v-else>
  55. <img src="../../../assets/images/none.png" alt />
  56. </div>
  57. </div>
  58. <!-- <div class="add">
  59. <div style="display: flex;align-items: center;">
  60. <van-icon class="addIcon" name="add" />新增
  61. </div>
  62. </div>-->
  63. <!-- 弹出层 -->
  64. <div>
  65. <van-popup
  66. v-model="startShow"
  67. position="bottom"
  68. :style="{ height: '40%' }"
  69. >
  70. <van-datetime-picker
  71. v-model="currentDate"
  72. type="date"
  73. :min-date="minDate"
  74. :max-date="maxDate"
  75. @confirm="getstartTime"
  76. @cancel="startShow = false"
  77. />
  78. </van-popup>
  79. <van-popup v-model="endShow" position="bottom" :style="{ height: '40%' }">
  80. <van-datetime-picker
  81. v-model="currentDate"
  82. type="date"
  83. :min-date="minDate"
  84. :max-date="maxDate"
  85. @confirm="getstartTime2"
  86. @cancel="endShow = false"
  87. />
  88. </van-popup>
  89. <van-action-sheet
  90. v-model="newShow"
  91. :actions="actions"
  92. cancel-text="取消"
  93. @select="Delete"
  94. />
  95. </div>
  96. </div>
  97. </template>
  98. <script>
  99. import {
  100. getNewPatientId,
  101. getPatientDetail,
  102. getRescueRecord,
  103. DeleteRescueRecord
  104. } from '@/api/patient/patient'
  105. import { uParseTime } from '@/utils/tools'
  106. import Vue from 'vue'
  107. import { Dialog } from 'vant'
  108. const moment = require('moment')
  109. export default {
  110. props: {
  111. active: Number
  112. },
  113. data () {
  114. return {
  115. newShow: false,
  116. startShow: false,
  117. endShow: false,
  118. startTime: '请选择',
  119. endTime: '请选择',
  120. endTimes: '',
  121. minDate: new Date(1970, 0, 1),
  122. maxDate: new Date(2025, 10, 1),
  123. currentDate: new Date(),
  124. actions: [{ name: '查看全部' }, { name: '全部删除' }],
  125. showOne: true,
  126. showTwo: false,
  127. limit: 10,
  128. page: 1,
  129. total: 0,
  130. loading: false,
  131. finished: false,
  132. rescueRecords: [],
  133. patient_id: 0,
  134. list: [],
  135. id: 0,
  136. index: 0
  137. }
  138. },
  139. methods: {
  140. onCancel () {
  141. this.typeShow = false
  142. },
  143. onConfirm (value) {
  144. this.type = value
  145. this.typeShow = false
  146. },
  147. getstartTime (value) {
  148. this.page = 1
  149. let year = value.getFullYear()
  150. let month = value.getMonth() + 1
  151. let day = value.getDate()
  152. if (month >= 1 && month <= 9) {
  153. month = `0${month}`
  154. }
  155. if (day >= 1 && day <= 9) {
  156. day = `0${day}`
  157. }
  158. this.startTime = `${year}-${month}-${day}`
  159. this.rescueRecords = []
  160. this.getRescueRecord(
  161. this.patient_id,
  162. this.limit,
  163. this.page,
  164. this.startTime,
  165. this.endTime
  166. )
  167. this.startShow = false
  168. },
  169. getstartTime2 (value) {
  170. this.page = 1
  171. let year = value.getFullYear()
  172. let month = value.getMonth() + 1
  173. let day = value.getDate()
  174. if (month >= 1 && month <= 9) {
  175. month = `0${month}`
  176. }
  177. if (day >= 1 && day <= 9) {
  178. day = `0${day}`
  179. }
  180. this.endTime = `${year}-${month}-${day}`
  181. this.rescueRecords = []
  182. this.getRescueRecord(
  183. this.patient_id,
  184. this.limit,
  185. this.page,
  186. this.startTime,
  187. this.endTime
  188. )
  189. this.endShow = false
  190. },
  191. getPatientDetail (patientid) {
  192. getPatientDetail(patientid).then(response => {
  193. if (response.data.state === 1) {
  194. var patientDetail = response.data.data.patientDetail
  195. if (patientDetail.blood_patients == 0) {
  196. this.rescueRecords = []
  197. this.showOne = false
  198. this.showTwo = true
  199. }
  200. if (patientDetail.blood_patients == 1) {
  201. this.showOne = true
  202. this.showTwo = false
  203. }
  204. // console.log("病人详情", patientDetail);
  205. this.patientName = patientDetail.name
  206. }
  207. })
  208. },
  209. getRescueRecord (id) {
  210. getRescueRecord(
  211. id,
  212. this.limit,
  213. this.page,
  214. this.startTime,
  215. this.endTime
  216. ).then(response => {
  217. if (response.data.state === 1) {
  218. var rescuerecord = response.data.data.rescuerecord
  219. // console.log("抢救记录", rescuerecord);
  220. let arr = this.rescueRecords
  221. arr.push(...rescuerecord)
  222. this.rescueRecords = arr
  223. var total = response.data.data.total
  224. // console.log("总计", total);
  225. this.loading = false
  226. }
  227. })
  228. },
  229. onLoad () {
  230. setTimeout(() => {
  231. this.page++
  232. // console.log(this.page)
  233. if (this.page <= Math.ceil(this.total / 10)) {
  234. this.getRescueRecord(
  235. this.patient_id,
  236. this.startTime,
  237. this.endTimes,
  238. this.limit,
  239. this.page
  240. )
  241. } else {
  242. this.loading = false
  243. this.finished = true
  244. }
  245. }, 1000)
  246. },
  247. getTime (time) {
  248. // return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
  249. return uParseTime(time, '{y}-{m}-{d}')
  250. },
  251. toRescueRecord (id) {
  252. var patientid = this.$route.query.patientid
  253. this.$router.push(
  254. '/rescuerecord?id=' +
  255. id +
  256. '&patientid=' +
  257. patientid +
  258. '&active=' +
  259. this.active
  260. )
  261. },
  262. toDeleteRescueRecord (id, index) {
  263. this.id = id
  264. this.index = index
  265. this.newShow = true
  266. },
  267. Delete (value) {
  268. if (value.name == '查看全部') {
  269. var patientid = this.$route.query.patientid
  270. this.$router.push(
  271. '/rescuerecord?id=' +
  272. this.id +
  273. '&patientid=' +
  274. patientid +
  275. '&active=' +
  276. this.active
  277. )
  278. }
  279. if (value.name == '全部删除') {
  280. this.DeleteRescueRecord(this.id, this.index)
  281. }
  282. },
  283. DeleteRescueRecord (id, index) {
  284. Dialog.confirm({
  285. title: '删除提示!',
  286. message: '确认删除该条信息吗?,删除后将无法恢复!'
  287. }).then(() => {
  288. DeleteRescueRecord(id).then(response => {
  289. if (response.data.state === 1) {
  290. var msg = response.data.data.msg
  291. console.log('msg', msg)
  292. this.rescueRecords.splice(index, 1)
  293. this.newShow = false
  294. }
  295. })
  296. })
  297. },
  298. getNewPatientId (id) {
  299. getNewPatientId(id).then(response => {
  300. if (response.data.state == 1) {
  301. var patient = response.data.data.patient
  302. this.patient_id = patient.id
  303. this.getPatientDetail(patient.id)
  304. this.getRescueRecord(patient.id)
  305. }
  306. })
  307. }
  308. },
  309. created () {
  310. var patientid = this.$route.query.patient_id
  311. this.getNewPatientId(patientid)
  312. // console.log("病人id能否获取", patientid);
  313. }
  314. }
  315. </script>
  316. <style lang="scss" scoped>
  317. .newRescueRecord {
  318. height: 100%;
  319. overflow-y: auto;
  320. background: #fff;
  321. .toolBox {
  322. display: flex;
  323. height: 1.6rem;
  324. align-items: center;
  325. .toolOne {
  326. width: 3.4rem;
  327. height: 1rem;
  328. background: rgba(246, 246, 246, 1);
  329. border-radius: 5px;
  330. text-align: center;
  331. font-size: 0.42rem;
  332. color: #8d8d8d;
  333. display: flex;
  334. align-items: center;
  335. justify-content: space-around;
  336. margin-left: 0.42rem;
  337. }
  338. }
  339. .adviceBox {
  340. padding: 0 0.66rem;
  341. margin-bottom: 1.6rem;
  342. }
  343. .adviceMain {
  344. > div:last-child {
  345. border: none;
  346. }
  347. }
  348. .adviceOne {
  349. // box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  350. border-bottom: 1px solid #e5e5e5;
  351. padding-bottom: 0.34rem;
  352. }
  353. .adviceTitle {
  354. padding-top: 0.34rem;
  355. display: flex;
  356. align-items: center;
  357. justify-content: space-between;
  358. p {
  359. color: #000000;
  360. font-weight: bold;
  361. font-size: 0.5rem;
  362. }
  363. .ellipsis {
  364. font-size: 0.66rem;
  365. color: #cccccc;
  366. }
  367. }
  368. .orderContent {
  369. font-size: 0.46rem;
  370. color: rgba(49, 50, 52, 1);
  371. margin-top: 0.34rem;
  372. p {
  373. line-height: 0.8rem;
  374. width: 50%;
  375. }
  376. }
  377. .doctorBox {
  378. font-size: 0.4rem;
  379. color: rgba(152, 152, 152, 1);
  380. line-height: 0.6rem;
  381. display: flex;
  382. align-items: center;
  383. justify-content: space-between;
  384. margin-top: 0.34rem;
  385. }
  386. .all {
  387. font-size: 0.43rem;
  388. color: #5b98ff;
  389. margin-top: 0.34rem;
  390. }
  391. .noimgBox {
  392. margin-top: 40%;
  393. img {
  394. width: 5rem;
  395. height: 5rem;
  396. margin: 0 auto;
  397. display: block;
  398. }
  399. }
  400. // .add {
  401. // position: fixed;
  402. // bottom: 0;
  403. // left: 0;
  404. // width: 100%;
  405. // height: 2.75rem;
  406. // background: rgba(255, 255, 255, 1);
  407. // box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  408. // display: flex;
  409. // align-items: center;
  410. // justify-content: space-around;
  411. // font-size: 0.9375rem;
  412. // color: #979798;
  413. // .addIcon {
  414. // color: #5b98ff;
  415. // font-size: 1.25rem;
  416. // margin-right: 0.25rem;
  417. // }
  418. // }
  419. .van-popup {
  420. border-radius: 0;
  421. transform: translate3d(0, 0, 0);
  422. top: initial;
  423. }
  424. }
  425. ::-webkit-scrollbar {
  426. width: 0;
  427. }
  428. </style>
  429. <style lang="scss">
  430. .newRescueRecord{
  431. .van-picker__toolbar{
  432. height: 1.46rem;
  433. line-height: 1.46rem;
  434. }
  435. .van-picker__cancel, .van-picker__confirm{
  436. padding: 0 0.53rem;
  437. font-size: 0.46rem;
  438. }
  439. .van-picker-column{
  440. font-size: 0.53rem;
  441. }
  442. .van-picker-column__item{
  443. padding: 0 0.14rem;
  444. }
  445. }
  446. </style>