RescueRecord.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <div class="rescueRecord">
  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" @click="toRescueRecord(item.id)">全部</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. getPatientDetail,
  101. getRescueRecord,
  102. DeleteRescueRecord
  103. } from '@/api/patient/patient'
  104. import { uParseTime } from '@/utils/tools'
  105. import Vue from 'vue'
  106. import { Dialog } from 'vant'
  107. const moment = require('moment')
  108. export default {
  109. props: {
  110. active: Number
  111. },
  112. data () {
  113. return {
  114. newShow: false,
  115. startShow: false,
  116. endShow: false,
  117. startTime: '请选择',
  118. endTime: '请选择',
  119. endTimes: '',
  120. minDate: new Date(1970, 0, 1),
  121. maxDate: new Date(2025, 10, 1),
  122. currentDate: new Date(),
  123. actions: [{ name: '查看全部' }, { name: '全部删除' }],
  124. showOne: true,
  125. showTwo: false,
  126. limit: 10,
  127. page: 1,
  128. total: 0,
  129. loading: false,
  130. finished: false,
  131. rescueRecords: [],
  132. patient_id: 0,
  133. list: [],
  134. id: 0,
  135. index: 0
  136. }
  137. },
  138. methods: {
  139. onCancel () {
  140. this.typeShow = false
  141. },
  142. onConfirm (value) {
  143. this.type = value
  144. this.typeShow = false
  145. },
  146. getstartTime (value) {
  147. this.page = 1
  148. let year = value.getFullYear()
  149. let month = value.getMonth() + 1
  150. let day = value.getDate()
  151. if (month >= 1 && month <= 9) {
  152. month = `0${month}`
  153. }
  154. if (day >= 1 && day <= 9) {
  155. day = `0${day}`
  156. }
  157. this.startTime = `${year}-${month}-${day}`
  158. this.rescueRecords = []
  159. this.getRescueRecord(
  160. this.patient_id,
  161. this.limit,
  162. this.page,
  163. this.startTime,
  164. this.endTime
  165. )
  166. this.startShow = false
  167. },
  168. getstartTime2 (value) {
  169. this.page = 1
  170. let year = value.getFullYear()
  171. let month = value.getMonth() + 1
  172. let day = value.getDate()
  173. if (month >= 1 && month <= 9) {
  174. month = `0${month}`
  175. }
  176. if (day >= 1 && day <= 9) {
  177. day = `0${day}`
  178. }
  179. this.endTime = `${year}-${month}-${day}`
  180. this.rescueRecords = []
  181. this.getRescueRecord(
  182. this.patient_id,
  183. this.limit,
  184. this.page,
  185. this.startTime,
  186. this.endTime
  187. )
  188. this.endShow = false
  189. },
  190. getPatientDetail (patientid) {
  191. getPatientDetail(patientid).then(response => {
  192. if (response.data.state === 1) {
  193. var patientDetail = response.data.data.patientDetail
  194. if (patientDetail.blood_patients == 0) {
  195. this.rescueRecords = []
  196. this.showOne = false
  197. this.showTwo = true
  198. }
  199. if (patientDetail.blood_patients == 1) {
  200. this.showOne = true
  201. this.showTwo = false
  202. }
  203. // console.log("病人详情", patientDetail);
  204. this.patientName = patientDetail.name
  205. }
  206. })
  207. },
  208. getRescueRecord (id) {
  209. getRescueRecord(
  210. id,
  211. this.limit,
  212. this.page,
  213. this.startTime,
  214. this.endTime
  215. ).then(response => {
  216. if (response.data.state === 1) {
  217. var rescuerecord = response.data.data.rescuerecord
  218. // console.log("抢救记录", rescuerecord);
  219. let arr = this.rescueRecords
  220. arr.push(...rescuerecord)
  221. this.rescueRecords = arr
  222. var total = response.data.data.total
  223. // console.log("总计", total);
  224. this.loading = false
  225. }
  226. })
  227. },
  228. onLoad () {
  229. setTimeout(() => {
  230. this.page++
  231. // console.log(this.page)
  232. if (this.page <= Math.ceil(this.total / 10)) {
  233. this.getRescueRecord(
  234. this.patient_id,
  235. this.startTime,
  236. this.endTimes,
  237. this.limit,
  238. this.page
  239. )
  240. } else {
  241. this.loading = false
  242. this.finished = true
  243. }
  244. }, 1000)
  245. },
  246. getTime (time) {
  247. // return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
  248. return uParseTime(time, '{y}-{m}-{d}')
  249. },
  250. toRescueRecord (id) {
  251. var patientid = this.$route.query.patientid
  252. this.$router.push(
  253. '/rescuerecord?id=' +
  254. id +
  255. '&patientid=' +
  256. patientid +
  257. '&active=' +
  258. this.active
  259. )
  260. },
  261. toDeleteRescueRecord (id, index) {
  262. this.id = id
  263. this.index = index
  264. this.newShow = true
  265. },
  266. Delete (value) {
  267. if (value.name == '查看全部') {
  268. var patientid = this.$route.query.patientid
  269. this.$router.push(
  270. '/rescuerecord?id=' +
  271. this.id +
  272. '&patientid=' +
  273. patientid +
  274. '&active=' +
  275. this.active
  276. )
  277. }
  278. if (value.name == '全部删除') {
  279. this.DeleteRescueRecord(this.id, this.index)
  280. }
  281. },
  282. DeleteRescueRecord (id, index) {
  283. Dialog.confirm({
  284. title: '删除提示!',
  285. message: '确认删除该条信息吗?,删除后将无法恢复!'
  286. }).then(() => {
  287. DeleteRescueRecord(id).then(response => {
  288. if (response.data.state === 1) {
  289. var msg = response.data.data.msg
  290. console.log('msg', msg)
  291. this.rescueRecords.splice(index, 1)
  292. this.newShow = false
  293. }
  294. })
  295. })
  296. }
  297. },
  298. created () {
  299. var patientid = this.$route.query.patientid
  300. // console.log("病人id能否获取", patientid);
  301. this.patient_id = patientid
  302. this.getPatientDetail(patientid)
  303. this.getRescueRecord(patientid)
  304. }
  305. }
  306. </script>
  307. <style lang="scss" scoped>
  308. .rescueRecord {
  309. height: 100%;
  310. overflow-y: auto;
  311. .toolBox {
  312. display: flex;
  313. height: 3.125rem;
  314. align-items: center;
  315. .toolOne {
  316. width: 6.25rem;
  317. height: 1.875rem;
  318. background: rgba(246, 246, 246, 1);
  319. border-radius: 5px;
  320. text-align: center;
  321. font-size: 0.8125rem;
  322. color: #8d8d8d;
  323. display: flex;
  324. align-items: center;
  325. justify-content: space-around;
  326. margin-left: 0.8125rem;
  327. }
  328. }
  329. .adviceBox {
  330. padding: 0 1.125rem;
  331. margin-bottom: 3.125rem;
  332. }
  333. .adviceMain {
  334. > div:last-child {
  335. border: none;
  336. }
  337. }
  338. .adviceOne {
  339. // box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  340. border-bottom: 1px solid #e5e5e5;
  341. padding-bottom: 0.625rem;
  342. }
  343. .adviceTitle {
  344. padding-top: 0.625rem;
  345. display: flex;
  346. align-items: center;
  347. justify-content: space-between;
  348. p {
  349. color: #000000;
  350. font-weight: bold;
  351. font-size: 0.9375rem;
  352. }
  353. .ellipsis {
  354. font-size: 1.25rem;
  355. color: #cccccc;
  356. }
  357. }
  358. .statOrderTitle {
  359. color: #5b98ff;
  360. font-size: 0.8125rem;
  361. font-weight: bold;
  362. margin: 0.625rem 0;
  363. }
  364. .longOrderTitle {
  365. color: #ff964a;
  366. font-size: 0.8125rem;
  367. font-weight: bold;
  368. margin: 0.625rem 0;
  369. }
  370. .orderContent {
  371. font-size: 0.875rem;
  372. color: rgba(49, 50, 52, 1);
  373. p {
  374. line-height: 1.125rem;
  375. }
  376. }
  377. .doctorBox {
  378. font-size: 0.75rem;
  379. color: rgba(152, 152, 152, 1);
  380. line-height: 1.125rem;
  381. display: flex;
  382. align-items: center;
  383. justify-content: space-between;
  384. margin-top: 0.625rem;
  385. }
  386. .all {
  387. font-size: 0.8125rem;
  388. color: #5b98ff;
  389. margin-top: 0.625rem;
  390. }
  391. .noimgBox {
  392. margin-top: 40%;
  393. img {
  394. width: 9.375rem;
  395. height: 9.375rem;
  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. }
  420. ::-webkit-scrollbar {
  421. width: 0;
  422. }
  423. </style>