血透系统pad前端

PatientBox.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <template>
  2. <div>
  3. <div
  4. class="patient"
  5. :class="borderColor(patient)"
  6. v-for="(patient, index) in patients"
  7. :key="index"
  8. @click="detailAction(patient)"
  9. >
  10. <!-- <router-link :to="{path:'/details', query: {patient_id: patient.patient_id, date: patient.schedule_date}}"> -->
  11. <div class="kehu">
  12. <div style="position: relative;flex:2;" class="tx">
  13. <img
  14. :src="
  15. patient.patient.avatar.length > 0
  16. ? patient.patient.avatar
  17. : '../../assets/product/test.jpg'
  18. "
  19. alt
  20. />
  21. <span class="redpoint" v-if="getStatus(patient)">
  22. {{
  23. getUnReadNum(patient) > 99
  24. ? getUnReadNum(patient) + "+"
  25. : getUnReadNum(patient)
  26. }}
  27. </span>
  28. <div class="right">
  29. <h3 class="name">
  30. {{ patient.patient.name }}
  31. <span class="yztx" v-if="getStatus(patient)">医嘱</span>
  32. <span class="yc" v-show="isAbnormal(patient)">异常</span>
  33. </h3>
  34. <span class="num">{{ genderText(patient) }} | {{ age(patient) }}岁</span>
  35. <!-- 性别、年龄 -->
  36. </div>
  37. </div>
  38. <div class="online" style="flex:1;" v-show="computeState(patient) != 4">
  39. <p :class="stateColor(patient)">{{ stateText(patient) }}</p>
  40. <!-- <span class="time">剩余时间 : 90:08</span> -->
  41. </div>
  42. </div>
  43. <!-- </router-link> -->
  44. <div class="function" :class="functionColor(patient)">
  45. <ul>
  46. <li>
  47. <span class="iconfont">&#xe6f7;</span>
  48. 班次 : {{ timeTypeText(patient) }}
  49. </li>
  50. <li>
  51. <span class="iconfont">&#xe6de;</span>
  52. 床位号 :
  53. {{
  54. patient.dialysis_order &&
  55. patient.dialysis_order.device_number &&
  56. patient.dialysis_order.device_number.number.length > 0
  57. ? patient.dialysis_order.device_number.number
  58. : patient.device_number.number
  59. }}
  60. </li>
  61. <li>
  62. <span class="iconfont">&#xe6f6;</span>
  63. 透析模式 : {{ $store.getters.treatment_mode[patient.mode_id].name }}
  64. </li>
  65. </ul>
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import { parseTime } from "@/utils";
  72. import { jsGetAge } from "@/utils/tools";
  73. import { setDialysisOrWaitSelectedConfig } from "@/utils/data_config";
  74. export default {
  75. name: "PatientBox",
  76. props: {
  77. patients: Array
  78. },
  79. data() {
  80. return {};
  81. },
  82. created() {
  83. console.log("11111");
  84. console.log(this.patients);
  85. },
  86. methods: {
  87. getUnReadNum: function(schedual) {
  88. if (schedual.doctor_advice != null) {
  89. let doctorAdvice = [];
  90. for (let i = 0; i < schedual.doctor_advice.length; i++) {
  91. if (schedual.doctor_advice[i].execution_state == 2) {
  92. doctorAdvice.push(schedual.doctor_advice[i]);
  93. }
  94. }
  95. const sorted = this.groupBy(doctorAdvice, function(item) {
  96. return [item.groupno];
  97. });
  98. return sorted.length;
  99. }
  100. },
  101. getStatus: function(schedual) {
  102. var isShowDot = false;
  103. if (schedual.doctor_advice != null) {
  104. for (let i = 0; i < schedual.doctor_advice.length; i++) {
  105. if (schedual.doctor_advice[i].execution_state == 2) {
  106. isShowDot = true;
  107. }
  108. }
  109. return isShowDot;
  110. } else {
  111. return false;
  112. }
  113. },
  114. stateColor: function(schedual) {
  115. var state = this.computeState(schedual);
  116. if (state == 1) {
  117. return "blue";
  118. } else if (state == 2) {
  119. return "gray";
  120. } else if (state == 3) {
  121. return "red";
  122. } else if (state == 5) {
  123. return "green1";
  124. } else if (state == 6) {
  125. return "green2";
  126. } else {
  127. return "blue";
  128. }
  129. },
  130. functionColor: function(schedual) {
  131. var state = this.computeState(schedual);
  132. if (state == 1 || state == 3) {
  133. return "blue";
  134. } else if (state == 2) {
  135. return "gray";
  136. } else {
  137. return "blue";
  138. }
  139. },
  140. borderColor: function(schedual) {
  141. var yc = this.isAbnormal(schedual);
  142. if (yc == true) {
  143. return "red";
  144. } else {
  145. return "gray";
  146. }
  147. },
  148. stateText: function(schedual) {
  149. var state = this.computeState(schedual);
  150. if (state == 1) {
  151. return "已上机";
  152. } else if (state == 2) {
  153. return "已下机";
  154. } else if (state == 3) {
  155. return "监测中";
  156. } else if (state == 5) {
  157. return "待称重";
  158. } else if (state == 6) {
  159. return "待开处方";
  160. } else {
  161. // return schedual.patient.gender == 1 ? "男" : "女"
  162. return "未上机";
  163. }
  164. },
  165. computeState: function(schedual) {
  166. if (
  167. schedual.assessment_before_dislysis == null ||
  168. schedual.assessment_before_dislysis.weight_before == 0
  169. ) {
  170. // 未签到称重
  171. return 5;
  172. }
  173. if (schedual.prescription == null || schedual.prescription.creater == 0) {
  174. // 未确认处方
  175. return 6;
  176. }
  177. if (schedual.dialysis_order == null) {
  178. // 未上机
  179. return 4;
  180. } else if (schedual.dialysis_order.stage == 2) {
  181. // 已下机
  182. return 2;
  183. } else if (
  184. schedual.dialysis_order.stage == 1 &&
  185. schedual.monitoring_records != null &&
  186. schedual.monitoring_records.length > 1
  187. ) {
  188. // 监测中
  189. return 3;
  190. } else {
  191. return 1;
  192. }
  193. },
  194. orderState: function(schedual) {
  195. if (schedual.dialysis_order == null) {
  196. // 未上机
  197. return 4;
  198. } else if (schedual.dialysis_order.stage == 2) {
  199. // 已下机
  200. return 2;
  201. } else if (
  202. schedual.dialysis_order.stage == 1 &&
  203. schedual.monitoring_records != null &&
  204. schedual.monitoring_records.length > 1
  205. ) {
  206. // 监测中
  207. return 3;
  208. } else {
  209. return 1;
  210. }
  211. },
  212. isAbnormal: function(schedual) {
  213. return false; // schedual.yc;
  214. },
  215. timeTypeText: function(schedual) {
  216. if (schedual.schedule_type == 1) {
  217. return "上午";
  218. } else if (schedual.schedule_type == 2) {
  219. return "下午";
  220. } else {
  221. return "晚上";
  222. }
  223. },
  224. genderText: function(schedual) {
  225. if (schedual.patient.gender == 0) {
  226. return "未知";
  227. } else if (schedual.patient.gender == 1) {
  228. return "男";
  229. } else {
  230. return "女";
  231. }
  232. },
  233. age: function(schedual) {
  234. if (schedual.patient.birthday != 0) {
  235. return jsGetAge(
  236. parseTime(schedual.patient.birthday, "{y}-{m}-{d}"),
  237. "-"
  238. );
  239. } else {
  240. return ''
  241. }
  242. // var now = new Date();
  243. // var nowYear = parseTime(now, "{y}");
  244. // var birthdayYear = parseTime(schedual.patient.birthday, "{y}");
  245. // // console.log(nowYear)
  246. // // console.log(birthdayYear)
  247. // return nowYear - birthdayYear;
  248. },
  249. groupBy(array, f) {
  250. const groups = {};
  251. array.forEach(function(o) {
  252. const group = JSON.stringify(f(o));
  253. groups[group] = groups[group] || [];
  254. groups[group].push(o);
  255. });
  256. return Object.keys(groups).map(function(group) {
  257. return groups[group];
  258. });
  259. },
  260. detailAction: function(schedual) {
  261. if (schedual.dialysis_order != null) {
  262. setDialysisOrWaitSelectedConfig(1);
  263. } else {
  264. setDialysisOrWaitSelectedConfig(0);
  265. }
  266. var patient_id = schedual.patient_id;
  267. var date = schedual.schedule_date;
  268. this.$router.push({
  269. path: "/details",
  270. query: {
  271. patient_id: patient_id,
  272. date: date,
  273. patient_name: schedual.patient.name
  274. }
  275. });
  276. }
  277. }
  278. };
  279. </script>
  280. <style style="stylesheet/scss" lang="scss" scoped>
  281. .patient {
  282. border: 1px #e5e5ee solid;
  283. padding: 0.33rem 0;
  284. width: 47%;
  285. margin: 0 3% 0.5rem 0;
  286. float: left;
  287. border-radius: 5px;
  288. @media only screen and (max-width: 415px) {
  289. width: 96% !important;
  290. }
  291. @media only screen and (min-width: 415px) and (max-width: 767px) {
  292. width: 48%;
  293. margin: 0 1% 0.5rem 0;
  294. }
  295. .function {
  296. padding: 0.3rem 0.32rem 0 0.32rem;
  297. color: #7b8a97;
  298. @media only screen and (min-width: 415px) and (max-width: 767px) {
  299. margin: 0;
  300. padding: 0.3rem 0.1rem 0 0.1rem;
  301. }
  302. ul {
  303. @include display-flex;
  304. @include align-items-center;
  305. @include text-align;
  306. @include justify-content-between;
  307. li {
  308. font-size: 0.3rem;
  309. @include display-flex;
  310. @include align-items-center;
  311. @media only screen and (max-width: 415px) {
  312. font-size: 0.36rem;
  313. }
  314. .iconfont {
  315. margin: 0 0.1rem 0 0;
  316. font-size: 0.4rem;
  317. display: none;
  318. }
  319. }
  320. }
  321. }
  322. .blue {
  323. color: $main-color;
  324. .iconfont {
  325. color: $main-color;
  326. }
  327. }
  328. .kehu {
  329. @include display-flex;
  330. @include align-items-center;
  331. @include text-align;
  332. @include justify-content-between;
  333. border-bottom: 1px #e5e5e5 solid;
  334. padding: 0 0 0.3rem 0.32rem;
  335. @media only screen and (min-width: 415px) and (max-width: 767px) {
  336. padding: 0 0 0.3rem 0.1rem;
  337. }
  338. .tx {
  339. @include display-flex;
  340. @include align-items-center;
  341. img {
  342. width: 1rem;
  343. height: 1rem;
  344. border-radius: 50%;
  345. float: left;
  346. margin: 0 0.2rem 0 0;
  347. }
  348. .right {
  349. float: left;
  350. text-align: left;
  351. .name {
  352. font-size: 0.34rem;
  353. color: $title-color;
  354. font-weight: 600;
  355. margin-bottom: 0.1rem;
  356. @media only screen and (max-width: 415px) {
  357. font-size: 0.45rem;
  358. }
  359. @media only screen and (min-width: 416px) and (max-width: 767px) {
  360. font-size: 0.4rem;
  361. }
  362. .yc {
  363. background: #ff7979;
  364. color: #fff;
  365. height: 0.38rem;
  366. line-height: 0.38rem;
  367. font-size: 0.24rem;
  368. width: 0.74rem;
  369. border-radius: 4px;
  370. display: inline-block;
  371. text-align: center;
  372. margin-left: 0.13rem;
  373. }
  374. }
  375. .num {
  376. font-size: 0.3rem;
  377. @media only screen and (max-width: 415px) {
  378. font-size: 0.36rem;
  379. }
  380. }
  381. }
  382. }
  383. .online {
  384. text-align: center;
  385. width: 50%;
  386. border-left: 1px #e5e5e5 solid;
  387. p {
  388. background: #c6cdd2;
  389. color: #fff;
  390. width: 1.45rem;
  391. height: 0.8rem;
  392. line-height: 0.8rem;
  393. border-radius: 4px;
  394. margin: 0 auto;
  395. font-size: 0.32rem;
  396. @media only screen and (max-width: 767px) {
  397. font-size: 0.36rem;
  398. width: 1.7rem;
  399. }
  400. @media only screen and (min-width: 415px) and (max-width: 767px) {
  401. width: 1.3rem;
  402. font-size: 0.36rem;
  403. }
  404. }
  405. .blue {
  406. background: $main-color;
  407. }
  408. .red {
  409. background: #f18f68;
  410. }
  411. .green {
  412. background: #5bd18b;
  413. }
  414. .green1 {
  415. background: #258ffc;
  416. }
  417. .green2 {
  418. background: #e6a23c;
  419. }
  420. .gray {
  421. background: #a8b3ba;
  422. }
  423. .lightGray {
  424. background: #c6cdd2;
  425. }
  426. .time {
  427. font-size: 0.26rem;
  428. color: #34495e;
  429. }
  430. }
  431. }
  432. }
  433. .red {
  434. border: 1px #ff7979 solid;
  435. }
  436. .redpoint {
  437. display: inline-block;
  438. height: 26px;
  439. width: 26px;
  440. line-height: 23px;
  441. text-align: center;
  442. font-size: 0.8em;
  443. border-radius: 20px;
  444. color: #fff;
  445. background: #f56c6c;
  446. position: absolute;
  447. top: -6px;
  448. left: 0.6rem;
  449. border: 1px solid #fff;
  450. @media only screen and (max-width: 415px) {
  451. height: 16px;
  452. width: 16px;
  453. line-height: 15px;
  454. top: -6px;
  455. left: 0.6rem;
  456. }
  457. @media only screen and (min-width: 415px) and (max-width: 767px) {
  458. height: 20px;
  459. width: 20px;
  460. line-height: 19px;
  461. top: -6px;
  462. left: 0.6rem;
  463. font-size: 0.36rem;
  464. }
  465. }
  466. .yztx {
  467. margin: 0 5px;
  468. padding: 3px 10px;
  469. background-color: #f56c6c;
  470. color: #fff;
  471. border-radius: 3px;
  472. font-size: 0.32rem;
  473. @media only screen and (max-width: 415px) {
  474. font-size: 0.34rem !important;
  475. }
  476. @media only screen and (min-width: 415px) and (max-width: 767px) {
  477. margin: 0;
  478. padding: 3px 3px;
  479. }
  480. }
  481. </style>