血透系统PC前端

PatientBox.vue 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div>
  3. <!-- <router-link to="/dialysis/details"> -->
  4. <div class="patient" v-for="schedule in schedules" v-if="schedule.patient" :class="borderColor(schedule)" @click="detailAction(schedule)" :key="schedule.id">
  5. <div class="kehu" >
  6. <div class="tx">
  7. <img :src="schedule.patient.avatar.length > 0 ? schedule.patient.avatar : '../../assets/home/analyze.png'" alt="">
  8. <div class="right">
  9. <h3 class="name">{{schedule.patient.name}}<span class="yc" v-show="isAbnormal(schedule)">异常</span></h3>
  10. <span class="num">{{ genderText(schedule) }} | {{ age(schedule) }} 岁</span>
  11. </div>
  12. </div>
  13. <div class="online" v-show="computeState(schedule) != 4" >
  14. <p :class="stateColor(schedule)">{{stateText(schedule)}}</p>
  15. </div>
  16. </div>
  17. <div class="function" :class="functionColor(schedule)" >
  18. <ul>
  19. <li><span class="iconfont">&#xe6f5;</span>班次 : {{timeTypeText(schedule)}}</li>
  20. <li><span class="iconfont">&#xe6de;</span>床位号 : {{schedule.device_number.number}}</li>
  21. <li><span class="iconfont">&#xe6f6;</span>透析模式 : {{schedule.mode_id?$store.getters.treatment_mode[schedule.mode_id].name:''}}</li>
  22. </ul>
  23. </div>
  24. </div>
  25. <!-- </router-link> -->
  26. </div>
  27. </template>
  28. <script>
  29. import { parseTime } from "@/utils"
  30. import { jsGetAge } from '@/utils/tools'
  31. export default {
  32. name: "PatientBox",
  33. data() {
  34. return {
  35. patients: [
  36. {
  37. state: 2,
  38. yc: false,
  39. name: "张三",
  40. sex: "女",
  41. age: 90
  42. },
  43. {
  44. state: 3,
  45. yc: true,
  46. name: "张三",
  47. sex: "女",
  48. age: 90
  49. },
  50. {
  51. state: 4,
  52. yc: true,
  53. name: "张三",
  54. sex: "女",
  55. age: 90
  56. },
  57. {
  58. state: 1,
  59. yc: true,
  60. name: "张三",
  61. sex: "女",
  62. age: 90
  63. }
  64. ]
  65. };
  66. },
  67. props: {
  68. schedules: {
  69. type: Array,
  70. }
  71. },
  72. methods: {
  73. stateColor: function(schedual) {
  74. var state = this.computeState(schedual);
  75. if (state == 1) {
  76. return "blue";
  77. } else if (state == 2) {
  78. return "gray";
  79. } else if (state == 3) {
  80. return "red";
  81. } else {
  82. return "blue";
  83. }
  84. },
  85. functionColor: function(schedual) {
  86. var state = this.computeState(schedual);
  87. if (state == 1 || state == 3) {
  88. return "blue";
  89. } else if (state == 2) {
  90. return "gray";
  91. } else {
  92. return "blue";
  93. }
  94. },
  95. borderColor: function(schedual) {
  96. var yc = this.isAbnormal(schedual);
  97. if (yc == true) {
  98. return "red";
  99. } else {
  100. return "gray";
  101. }
  102. },
  103. stateText: function(schedual) {
  104. var state = this.computeState(schedual);
  105. if (state == 1) {
  106. return "已上机";
  107. } else if (state == 2) {
  108. return "已下机";
  109. } else if (state == 3) {
  110. return "监测中";
  111. } else {
  112. // return schedual.patient.gender == 1 ? "男" : "女"
  113. return "未上机";
  114. }
  115. },
  116. computeState: function(schedual) {
  117. if (schedual.dialysis_order == null) { // 未上机
  118. return 4
  119. } else if (schedual.dialysis_order.stage == 2) { // 已下机
  120. return 2
  121. } else if (schedual.dialysis_order.stage == 1 && schedual.monitoring_records != null && schedual.monitoring_records.length > 1) { // 监测中
  122. return 3
  123. } else {
  124. return 1
  125. }
  126. },
  127. orderState: function(schedual) {
  128. if (schedual.dialysis_order == null) { // 未上机
  129. return 4
  130. } else if (schedual.dialysis_order.stage == 2) { // 已下机
  131. return 2
  132. } else if (schedual.dialysis_order.stage == 1 && schedual.monitoring_records != null && schedual.monitoring_records.length > 1) { // 监测中
  133. return 3
  134. } else {
  135. return 1
  136. }
  137. },
  138. isAbnormal: function(schedual) {
  139. return false // schedual.yc;
  140. },
  141. timeTypeText: function(schedual) {
  142. if (schedual.schedule_type == 1) {
  143. return "上午"
  144. } else if (schedual.schedule_type == 2) {
  145. return "下午"
  146. } else {
  147. return "晚上"
  148. }
  149. },
  150. genderText: function(schedual) {
  151. if (schedual.patient.gender == 0) {
  152. return "未知"
  153. } else if (schedual.patient.gender == 1) {
  154. return "男"
  155. } else {
  156. return "女"
  157. }
  158. },
  159. age: function(schedual) {
  160. if (schedual.patient.birthday == 0){
  161. return ''
  162. }else{
  163. return jsGetAge(parseTime(schedual.patient.birthday, '{y}-{m}-{d}'), '-')
  164. }
  165. // var now = new Date()
  166. // var nowYear = parseTime(now, "{y}")
  167. // var birthdayYear = parseTime(schedual.patient.birthday, "{y}")
  168. // // console.log(nowYear)
  169. // // console.log(birthdayYear)
  170. // return nowYear - birthdayYear
  171. },
  172. detailAction: function(schedual) {
  173. var patient_id = schedual.patient_id
  174. var date = schedual.schedule_date
  175. this.$router.push({ path: "/dialysis/details", query: {patient_id: patient_id, date: date, patient_name: schedual.patient.name}})
  176. }
  177. }
  178. };
  179. </script>
  180. <style style="stylesheet/scss" lang="scss" scoped>
  181. .patient {
  182. border: 1px #e5e5ee solid;
  183. padding: 9px 0;
  184. margin: 0 15px 15px 0;
  185. float: left;
  186. width: 360px;
  187. cursor: pointer;
  188. .function {
  189. padding: 15px 5px 0 5px;
  190. color: #7b8a97;
  191. ul {
  192. @include display-flex;
  193. @include align-items-center;
  194. @include text-align;
  195. @include justify-content-between;
  196. li {
  197. font-size: 13px;
  198. @include display-flex;
  199. @include align-items-center;
  200. .iconfont {
  201. margin: 0 5px 0 0;
  202. font-size: 18px;
  203. }
  204. }
  205. }
  206. }
  207. .blue {
  208. color: $main-color;
  209. .iconfont {
  210. color: $main-color;
  211. }
  212. }
  213. .kehu {
  214. @include display-flex;
  215. @include align-items-center;
  216. @include text-align;
  217. @include justify-content-between;
  218. border-bottom: 1px #e5e5e5 solid;
  219. padding: 0 0 10px 20px;
  220. .tx {
  221. @include display-flex;
  222. @include align-items-center;
  223. img {
  224. width: 45px;
  225. height: 45px;
  226. border-radius: 50%;
  227. float: left;
  228. margin: 0 15px 0 0;
  229. }
  230. .right {
  231. float: left;
  232. text-align: left;
  233. .name {
  234. font-size: 15px;
  235. color: #34495e;
  236. font-weight: bold;
  237. height: 20px;
  238. line-height: 20px;
  239. .yc {
  240. background: #ff7979;
  241. color: #fff;
  242. height: 19px;
  243. line-height: 19px;
  244. font-size: 12px;
  245. width: 37px;
  246. border-radius: 4px;
  247. display: inline-block;
  248. text-align: center;
  249. margin-left: 6px;
  250. }
  251. }
  252. .num {
  253. font-size:13px;
  254. color: #7b8a97;
  255. }
  256. }
  257. }
  258. .online {
  259. text-align: center;
  260. width: 50%;
  261. border-left: 1px #e5e5e5 solid;
  262. p {
  263. background: #c6cdd2;
  264. color: #fff;
  265. width:65px;
  266. height: 24px;
  267. line-height: 24px;
  268. border-radius: 4px;
  269. margin: 0 auto;
  270. font-size: 12px;
  271. }
  272. .blue {
  273. background: $main-color;
  274. }
  275. .red {
  276. background: #f18f68;
  277. }
  278. .green {
  279. background: #5bd18b;
  280. }
  281. .gray {
  282. background: #a8b3ba;
  283. }
  284. .lightGray {
  285. background: #c6cdd2;
  286. }
  287. .time {
  288. font-size: 26px;
  289. color: #34495e;
  290. }
  291. }
  292. }
  293. }
  294. .red {
  295. border: 1px #ff7979 solid;
  296. }
  297. </style>