血透系统pad前端

PatientBox.vue 7.1KB

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