血透系统PC前端

PatientSidebar.vue 6.8KB

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