血透系统PC前端

PatientSidebar.vue 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div>
  3. <div class="patient-menu">
  4. <el-autocomplete
  5. style="margin:16px 5px"
  6. popper-class="my-autocomplete"
  7. v-model="value"
  8. :fetch-suggestions="querySearchAsync"
  9. :trigger-on-focus="false"
  10. placeholder="病人名字或者透析号"
  11. @select="handleSelect"
  12. >
  13. <i class="el-icon-search el-input__icon" slot="suffix" > </i>
  14. <template slot-scope="{ item }">
  15. <div class="name">{{ item.name }}</div>
  16. </template>
  17. </el-autocomplete>
  18. <el-select v-model="selectID" style="margin:0 5px 0px 5px;text-align: center;" @change="changePatient" placeholder="请选择">
  19. <el-option
  20. v-for="item in patientsList"
  21. :key="item.id"
  22. :label="item.name"
  23. :value="item.id">
  24. </el-option>
  25. </el-select>
  26. <el-tree
  27. :data="treeData"
  28. accordion
  29. node-key="name"
  30. :key="treeKey"
  31. :current-node-key="treeKey"
  32. :default-expanded-keys="[defaultActive]"
  33. @node-click="handleNodeClick"
  34. >
  35. </el-tree>
  36. </div>
  37. <div class="patient-app-container ">
  38. <span class="patient-name">姓名:{{currentPatient.name}} &nbsp;&nbsp; 性别:{{tranSex(currentPatient.gender)}} &nbsp;&nbsp; 年龄:{{tranAge(currentPatient.birthday)}} &nbsp;&nbsp; 透析号:{{currentPatient.dialysis_no}} </span>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import { fetchAllList, PostSearch } from "@/api/patient";
  44. import { jsGetAge, uParseTime } from "@/utils/tools";
  45. export default {
  46. name: "patientSidebar",
  47. value: "",
  48. searchArray: [],
  49. props: {
  50. id: 0,
  51. defaultActive: {
  52. type: String,
  53. default: "1-1"
  54. }
  55. },
  56. data() {
  57. return {
  58. thedefaultActive: 1,
  59. patientsList: null,
  60. currentPatient: {},
  61. selectID: 0,
  62. keyword: "",
  63. value: "",
  64. treeKey: "",
  65. treeData: [
  66. {
  67. name: "1",
  68. label: "电子病历",
  69. children: [
  70. {
  71. name: "1-1",
  72. label: "基本信息"
  73. },
  74. {
  75. name: "1-4",
  76. label: "医嘱管理"
  77. },
  78. {
  79. name: "1-2",
  80. label: "病程管理"
  81. },
  82. {
  83. name: "1-3",
  84. label: "检验检查"
  85. },
  86. {
  87. name: "1-5",
  88. label: "抢救记录"
  89. }
  90. ]
  91. },
  92. {
  93. name: "2",
  94. label: "透析管理",
  95. children: [
  96. {
  97. name: "2-1",
  98. label: "长期透析处方"
  99. },
  100. {
  101. name: "2-2",
  102. label: "透析记录"
  103. },
  104. {
  105. name: "2-4",
  106. label: "排班信息"
  107. },
  108. {
  109. name: "2-5",
  110. label: "宣教信息"
  111. }
  112. ]
  113. }
  114. ]
  115. };
  116. },
  117. methods: {
  118. handleNodeClick(data) {
  119. var name = data.name;
  120. if (name == "1-1") {
  121. this.$router.push({ path: "/patients/patient/" + this.id });
  122. } else if (name == "1-2") {
  123. this.$router.push({ path: "/patients/course?id=" + this.id });
  124. } else if (name == "1-3") {
  125. this.$router.push({ path: "/patients/inspection?id=" + this.id });
  126. } else if (name == "1-4") {
  127. this.$router.push({
  128. path: "/patients/patient/" + this.id + "/doctorAdvice"
  129. });
  130. } else if (name == "1-5") {
  131. this.$router.push({ path: "/patients/rescue?id=" + this.id });
  132. } else if (name == "2-1") {
  133. this.$router.push({
  134. path: "/patients/patient/" + this.id + "/dialysisSolution"
  135. });
  136. } else if (name == "2-2") {
  137. this.$router.push({
  138. path: "/patients/patient/" + this.id + "/dialysisRecord"
  139. });
  140. } else if (name == "2-4") {
  141. this.$router.push({
  142. path: "/patients/patient/" + this.id + "/scheduling"
  143. });
  144. } else if (name == "2-5") {
  145. this.$router.push({
  146. path: "/patients/patient/" + this.id + "/proeducation"
  147. });
  148. }
  149. },
  150. changePatient(value) {
  151. console.log(value);
  152. this.$router.push("/patients/patient/" + value);
  153. },
  154. getList() {
  155. fetchAllList().then(response => {
  156. if (response.data.state == 1) {
  157. this.patientsList = response.data.data.patients;
  158. var len = this.patientsList.length;
  159. if (len > 0) {
  160. for (let index = 0; index < len; index++) {
  161. if (this.patientsList[index].id == this.id) {
  162. this.currentPatient = this.patientsList[index];
  163. this.selectID = this.patientsList[index].id;
  164. this.$emit("tran-patient", this.currentPatient);
  165. break;
  166. }
  167. }
  168. }
  169. }
  170. });
  171. },
  172. tranAge(birthday) {
  173. var birth = uParseTime(birthday, "{y}-{m}-{d}");
  174. return jsGetAge(birth, "-");
  175. },
  176. tranSex(gender) {
  177. var sex = "未知";
  178. switch (gender) {
  179. case 1:
  180. sex = "男";
  181. break;
  182. case 2:
  183. sex = "女";
  184. break;
  185. default:
  186. break;
  187. }
  188. return sex;
  189. },
  190. querySearchAsync(keyword, cb) {
  191. let key = "";
  192. if (keyword != undefined) {
  193. key = keyword;
  194. }
  195. let searchArray = [];
  196. PostSearch(key).then(response => {
  197. if (response.data.state == 1) {
  198. searchArray = response.data.data.patient;
  199. cb(searchArray);
  200. } else {
  201. this.$message.error(response.data.msg);
  202. cb([]);
  203. }
  204. });
  205. },
  206. handleSelect(val) {
  207. this.$router.push("/patients/patient/" + val.id);
  208. }
  209. },
  210. created() {
  211. this.treeKey = this.defaultActive;
  212. this.getList();
  213. }
  214. };
  215. </script>
  216. <style>
  217. .patient-menu .el-tree-node__content {
  218. font-size: 14px;
  219. height: 40px;
  220. font-weight: 400;
  221. }
  222. .patient-menu .el-tree-node__label:hover {
  223. color:#409eff;
  224. }
  225. .patient-menu .el-tree-node:focus > .el-tree-node__content {
  226. color:#409eff;
  227. }
  228. .patient-menu .el-tree-node .el-tree-node.is-current > .el-tree-node__content {
  229. color:#409eff;
  230. }
  231. .patient-menu .el-tree {
  232. background: #f6f8f9;
  233. }
  234. .patient-menu {
  235. -webkit-transition: width 0.28s;
  236. transition: width 0.28s;
  237. width: 180px !important;
  238. height: 100%;
  239. position: relative;
  240. font-size: 0px;
  241. top: 0;
  242. float: left;
  243. bottom: 0;
  244. left: 0;
  245. /* z-index: 99; */
  246. overflow: hidden;
  247. }
  248. .patient-center-menu .el-icon-arrow-down:before {
  249. content: "";
  250. }
  251. </style>