血透系统pad前端

PatientBox.vue 12KB

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