血透系统pad前端

PatientBox.vue 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div>
  3. <div class="patient" :class="borderColor(patient)" v-for="(patient, index) in patients" :key="index"
  4. @click="detailAction(patient)">
  5. <!-- <router-link :to="{path:'/details', query: {patient_id: patient.patient_id, date: patient.schedule_date}}"> -->
  6. <div class="kehu">
  7. <div style="position: relative;" class="tx">
  8. <img :src="patient.patient.avatar.length > 0 ? patient.patient.avatar : '../../assets/product/test.jpg'"
  9. alt="">
  10. <span class="redpoint" v-if="getStatus(patient)">{{getUnReadNum(patient) > 99?getUnReadNum(patient)+"+":getUnReadNum(patient)}}</span>
  11. <div class="right">
  12. <h3 class="name">{{patient.patient.name}}<span class="el-icon-bell yztx" v-if="getStatus(patient)"> 医嘱</span> <span class="yc" v-show="isAbnormal(patient)">异常</span></h3>
  13. <span class="num">{{ genderText(patient) }} | {{ age(patient) }}岁</span>
  14. <!-- 性别、年龄 -->
  15. </div>
  16. </div>
  17. <div class="online" v-show="computeState(patient) != 4">
  18. <p :class="stateColor(patient)">{{stateText(patient)}}</p>
  19. <!-- <span class="time">剩余时间 : 90:08</span> -->
  20. </div>
  21. </div>
  22. <!-- </router-link> -->
  23. <div class="function" :class="functionColor(patient)">
  24. <ul>
  25. <li><span class="iconfont">&#xe6f7;</span>班次 : {{timeTypeText(patient)}}</li>
  26. <li><span class="iconfont">&#xe6de;</span>床位号 : {{patient.device_number.number}}</li>
  27. <li><span class="iconfont">&#xe6f6;</span>透析模式 : {{$store.getters.treatment_mode[patient.mode_id].name}}</li>
  28. </ul>
  29. </div>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import {parseTime} from '@/utils'
  35. import {jsGetAge} from '@/utils/tools'
  36. export default {
  37. name: 'PatientBox',
  38. props: {
  39. patients: Array
  40. },
  41. data () {
  42. return {}
  43. },
  44. methods: {
  45. getUnReadNum: function (schedual) {
  46. if (schedual.doctor_advice != null) {
  47. let doctorAdvice = []
  48. for (let i = 0; i < schedual.doctor_advice.length; i++) {
  49. if (schedual.doctor_advice[i].execution_state == 2) {
  50. doctorAdvice.push(schedual.doctor_advice[i])
  51. }
  52. }
  53. const sorted = this.groupBy(doctorAdvice, function (item) {
  54. return [item.groupno]
  55. })
  56. return sorted.length
  57. }
  58. },
  59. getStatus: function (schedual) {
  60. var isShowDot = false
  61. if (schedual.doctor_advice != null) {
  62. for (let i = 0; i < schedual.doctor_advice.length; i++) {
  63. if (schedual.doctor_advice[i].execution_state == 2) {
  64. isShowDot = true
  65. }
  66. }
  67. return isShowDot
  68. } else {
  69. return false
  70. }
  71. },
  72. stateColor: function (schedual) {
  73. var state = this.computeState(schedual)
  74. if (state == 1) {
  75. return 'blue'
  76. } else if (state == 2) {
  77. return 'gray'
  78. } else if (state == 3) {
  79. return 'red'
  80. } else {
  81. return 'blue'
  82. }
  83. },
  84. functionColor: function (schedual) {
  85. var state = this.computeState(schedual)
  86. if (state == 1 || state == 3) {
  87. return 'blue'
  88. } else if (state == 2) {
  89. return 'gray'
  90. } else {
  91. return 'blue'
  92. }
  93. },
  94. borderColor: function (schedual) {
  95. var yc = this.isAbnormal(schedual)
  96. if (yc == true) {
  97. return 'red'
  98. } else {
  99. return 'gray'
  100. }
  101. },
  102. stateText: function (schedual) {
  103. var state = this.computeState(schedual)
  104. if (state == 1) {
  105. return '已上机'
  106. } else if (state == 2) {
  107. return '已下机'
  108. } else if (state == 3) {
  109. return '监测中'
  110. } else {
  111. // return schedual.patient.gender == 1 ? "男" : "女"
  112. return '未上机'
  113. }
  114. },
  115. computeState: function (schedual) {
  116. if (schedual.dialysis_order == null) {
  117. // 未上机
  118. return 4
  119. } else if (schedual.dialysis_order.stage == 2) {
  120. // 已下机
  121. return 2
  122. } else if (
  123. schedual.dialysis_order.stage == 1 &&
  124. schedual.monitoring_records != null &&
  125. schedual.monitoring_records.length > 1
  126. ) {
  127. // 监测中
  128. return 3
  129. } else {
  130. return 1
  131. }
  132. },
  133. orderState: function (schedual) {
  134. if (schedual.dialysis_order == null) {
  135. // 未上机
  136. return 4
  137. } else if (schedual.dialysis_order.stage == 2) {
  138. // 已下机
  139. return 2
  140. } else if (
  141. schedual.dialysis_order.stage == 1 &&
  142. schedual.monitoring_records != null &&
  143. schedual.monitoring_records.length > 1
  144. ) {
  145. // 监测中
  146. return 3
  147. } else {
  148. return 1
  149. }
  150. },
  151. isAbnormal: function (schedual) {
  152. return false // schedual.yc;
  153. },
  154. timeTypeText: function (schedual) {
  155. if (schedual.schedule_type == 1) {
  156. return '上午'
  157. } else if (schedual.schedule_type == 2) {
  158. return '下午'
  159. } else {
  160. return '晚上'
  161. }
  162. },
  163. genderText: function (schedual) {
  164. if (schedual.patient.gender == 0) {
  165. return '未知'
  166. } else if (schedual.patient.gender == 1) {
  167. return '男'
  168. } else {
  169. return '女'
  170. }
  171. },
  172. age: function (schedual) {
  173. if (schedual.patient.age == 0) {
  174. return jsGetAge(parseTime(schedual.patient.birthday, '{y}-{m}-{d}'), '-')
  175. } else {
  176. return schedual.patient.age
  177. }
  178. // var now = new Date();
  179. // var nowYear = parseTime(now, "{y}");
  180. // var birthdayYear = parseTime(schedual.patient.birthday, "{y}");
  181. // // console.log(nowYear)
  182. // // console.log(birthdayYear)
  183. // return nowYear - birthdayYear;
  184. }, groupBy (array, f) {
  185. const groups = {}
  186. array.forEach(function (o) {
  187. const group = JSON.stringify(f(o))
  188. groups[group] = groups[group] || []
  189. groups[group].push(o)
  190. })
  191. return Object.keys(groups).map(function (group) {
  192. return groups[group]
  193. })
  194. },
  195. detailAction: function (schedual) {
  196. var patient_id = schedual.patient_id
  197. var date = schedual.schedule_date
  198. this.$router.push({
  199. path: '/details',
  200. query: {
  201. patient_id: patient_id,
  202. date: date,
  203. patient_name: schedual.patient.name
  204. }
  205. })
  206. }
  207. }
  208. }
  209. </script>
  210. <style style="stylesheet/scss" lang="scss" scoped>
  211. .patient {
  212. border: 1px #e5e5ee solid;
  213. padding: 0.33rem 0;
  214. width: 47%;
  215. margin: 0 3% 0.5rem 0;
  216. float: left;
  217. .function {
  218. padding: 0.3rem 0.32rem 0 0.32rem;
  219. color: #7b8a97;
  220. ul {
  221. @include display-flex;
  222. @include align-items-center;
  223. @include text-align;
  224. @include justify-content-between;
  225. li {
  226. font-size: 0.3rem;
  227. @include display-flex;
  228. @include align-items-center;
  229. .iconfont {
  230. margin: 0 0.1rem 0 0;
  231. font-size: 0.4rem;
  232. }
  233. }
  234. }
  235. }
  236. .blue {
  237. color: $main-color;
  238. .iconfont {
  239. color: $main-color;
  240. }
  241. }
  242. .kehu {
  243. @include display-flex;
  244. @include align-items-center;
  245. @include text-align;
  246. @include justify-content-between;
  247. border-bottom: 1px #e5e5e5 solid;
  248. padding: 0 0 0.3rem 0.32rem;
  249. .tx {
  250. @include display-flex;
  251. @include align-items-center;
  252. img {
  253. width: 1rem;
  254. height: 1rem;
  255. border-radius: 50%;
  256. float: left;
  257. margin: 0 0.3rem 0 0;
  258. }
  259. .right {
  260. float: left;
  261. text-align: left;
  262. .name {
  263. font-size: 0.34rem;
  264. color: $title-color;
  265. font-weight: 600;
  266. margin-bottom: 0.1rem;
  267. .yc {
  268. background: #ff7979;
  269. color: #fff;
  270. height: 0.38rem;
  271. line-height: 0.38rem;
  272. font-size: 0.24rem;
  273. width: 0.74rem;
  274. border-radius: 4px;
  275. display: inline-block;
  276. text-align: center;
  277. margin-left: 0.13rem;
  278. }
  279. }
  280. .num {
  281. font-size: 0.3rem;
  282. }
  283. }
  284. }
  285. .online {
  286. text-align: center;
  287. width: 50%;
  288. border-left: 1px #e5e5e5 solid;
  289. p {
  290. background: #c6cdd2;
  291. color: #fff;
  292. width: 1.35rem;
  293. height: 0.56rem;
  294. line-height: 0.56rem;
  295. border-radius: 4px;
  296. margin: 0 auto;
  297. font-size: 0.32rem;
  298. }
  299. .blue {
  300. background: $main-color;
  301. }
  302. .red {
  303. background: #f18f68;
  304. }
  305. .green {
  306. background: #5bd18b;
  307. }
  308. .gray {
  309. background: #a8b3ba;
  310. }
  311. .lightGray {
  312. background: #c6cdd2;
  313. }
  314. .time {
  315. font-size: 0.26rem;
  316. color: #34495e;
  317. }
  318. }
  319. }
  320. }
  321. .red {
  322. border: 1px #ff7979 solid;
  323. }
  324. .redpoint{
  325. display:inline-block;
  326. height:20px;
  327. width:20px;
  328. line-height:18px;
  329. text-align:center;
  330. font-size:0.8em;
  331. border-radius:20px;
  332. color:#fff;
  333. background:red;
  334. position: absolute;
  335. top: -8px;
  336. left: 0.7rem;
  337. border:1px solid #fff;
  338. }
  339. .yztx{
  340. margin: 0 15px;
  341. padding: 5px 15px;
  342. background-color: red;
  343. color: #fff;
  344. border-radius: 15px;
  345. }
  346. </style>