血透系统pad前端

PatientBox.vue 12KB

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