patientList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <view class="patientList">
  3. <view class="search-box">
  4. <seiminSearch class="mSearch-input-box" :mode="2" button="inside" placeholder="输入床号或姓名支持拼音检索" @input="debounceInp"
  5. v-model="keyword"></seiminSearch>
  6. </view>
  7. <view class="search-keyword">
  8. <view class="orderList_listItem" v-for="patient in patientList" :key="patient.id">
  9. <view class="orderList_listItem_header">
  10. <view class="orderList_listItem_header_title">
  11. <block v-if="patient.illnessState">
  12. <view class="associationType_icon red" v-if="patient.illnessState.value === '2'">危</view>
  13. <view class="associationType_icon red" v-else-if="patient.illnessState.value === '3'">重</view>
  14. </block>
  15. <block v-if="patient.careLevel">
  16. <view class="associationType_icon red" v-if="patient.careLevel.value === '0'">特</view>
  17. <view class="associationType_icon red" v-else-if="patient.careLevel.value === '1'">1</view>
  18. <view class="associationType_icon green" v-else-if="patient.careLevel.value === '2'">2</view>
  19. <view class="associationType_icon green" v-else-if="patient.careLevel.value === '3'">3</view>
  20. </block>
  21. <view class="taskNameAndWorkerName">
  22. <text class="workerName">{{patient.patientName || '暂无'}}</text>
  23. </view>
  24. </view>
  25. <text class="orderList_listItem_header_more">{{patient.bedNum }}床</text>
  26. </view>
  27. <view class="orderList_listItem_item">
  28. <view class="orderList_listItem_item_content">
  29. <text class="orderList_listItem_item_name">{{patient.residenceNo || '暂无'}}</text>
  30. <text class="orderList_listItem_item_time">待检{{patient.watingCount}}</text>
  31. </view>
  32. <view class="orderList_listItem_item_btns">
  33. <button type="primary" class="btn"
  34. @click.stop="toDetail(patient.patientCode,patient.patientName)">患者详情</button>
  35. <button type="primary" class="btn" @click.stop="buildOrder(patient)">一键建单</button>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <seiminFooterNav></seiminFooterNav>
  41. <seiminModel ref="seiminModel"></seiminModel>
  42. <seiminPicker ref="sPicker" :title="pickerTitle" titleColor="#808080" titleFontSize="28rpx" confirmColor="#333"
  43. confirmFontSize="38rpx" confirmFontWeight="500" itemFontSize="32rpx" @onClose="closePicker"
  44. @onConfirm="confirmPicker" :pickerList="taskTypeList">
  45. </seiminPicker>
  46. </view>
  47. </template>
  48. <script>
  49. import {
  50. backPress,
  51. getCurrentPagesSeiminAll
  52. } from '../../utils/index.js';
  53. import {
  54. debounce
  55. } from 'lodash/function';
  56. import {
  57. reqFetchDataList,
  58. reqDeptTSPTaskType,
  59. reqBuildTrip,
  60. } from "../../request/api.js";
  61. import {
  62. mapState,
  63. mapMutations,
  64. } from "vuex";
  65. import {
  66. ASSOCIATION_TYPES
  67. } from '../../utils/enum.association_types.js';
  68. export default {
  69. onBackPress() {
  70. backPress();
  71. },
  72. data() {
  73. return {
  74. reFresh: '',
  75. ASSOCIATION_TYPES,
  76. checkedShowMsg: {}, //当前选中的任务类型的buildtrip信息
  77. selectedPatient: {}, //当前选中的患者
  78. taskTypeListResource: [], //任务类型列表(请求的原始数据)
  79. taskTypeList: [], //任务类型列表
  80. pickerTitle: "", //一键建单picker的title
  81. debounceInp: null,
  82. keyword: "",
  83. patientList: [],
  84. totalNum: 0, //工单总数量
  85. idx: 0, //页码
  86. };
  87. },
  88. watch: {
  89. reFresh() {
  90. uni.redirectTo({
  91. url: `${getCurrentPagesSeiminAll()}`,
  92. })
  93. }
  94. },
  95. computed: {
  96. ...mapState("login", ["loginInfo"]),
  97. ...mapState('other', ["deptDisplay"]),
  98. },
  99. methods: {
  100. ...mapMutations('other', ['changeQucikCreateOrderType', 'clearPatientBuildData', 'changePatientBuildData']),
  101. //关闭
  102. closePicker() {
  103. this.$refs.sPicker._close();
  104. },
  105. //打开
  106. openPicker() {
  107. this.$refs.sPicker._open();
  108. },
  109. //确定:接收子组件传来的参数
  110. confirmPicker(checkedObj) {
  111. console.log(checkedObj);
  112. // 补充:清除建单数据
  113. this.clearPatientBuildData();
  114. // 2,获取buildTrip信息
  115. let postData = {
  116. "taskTypeId": checkedObj.value,
  117. "patientCode": this.selectedPatient.patientCode
  118. };
  119. uni.showLoading({
  120. mask: true,
  121. title: '加载中'
  122. })
  123. reqBuildTrip(postData).then(res => {
  124. uni.hideLoading();
  125. let taskType = this.taskTypeListResource.find(v => v.id == checkedObj.value);
  126. let patientTaskType = taskType || {};
  127. if (patientTaskType.associationType.value == this.ASSOCIATION_TYPES['患者其他服务业务']) {
  128. // 患者其他服务业务--无法用status判断,运输过程“默认患者所在科室”没有返回status==200,估计是后端漏掉了这种情况,如果后期后端可以返回status,则可以根据status判断。
  129. if (res.start && res.end) {
  130. if (res.status == 100013 || res.status == 100014 || res.status == 100015) {
  131. this.checkedShowMsg = res.data;
  132. //需要选择起点科室和目标科室
  133. this.changeQucikCreateOrderType({
  134. type: "patient",
  135. taskTypeId: checkedObj.value,
  136. patientTaskType,
  137. selectedPatient: this.selectedPatient,
  138. patientBuildTrip: res,
  139. });
  140. uni.navigateTo({
  141. url: "/pages/quickCreateOrder/quickCreateOrder",
  142. });
  143. } else {
  144. //无需选择科室
  145. this.checkedShowMsg = res.data;
  146. this.changePatientBuildData({
  147. key: 'dept',
  148. value: {
  149. startDept: res.start.start.list[0],
  150. endDept: res.end.end.list[0],
  151. }
  152. });
  153. this.changeQucikCreateOrderType({
  154. type: "patient",
  155. taskTypeId: checkedObj.value,
  156. patientTaskType,
  157. selectedPatient: this.selectedPatient,
  158. patientBuildTrip: res,
  159. });
  160. uni.navigateTo({
  161. url: "/pages/patientBuild/patientBuild",
  162. });
  163. }
  164. } else {
  165. this.$refs.seiminModel.show({
  166. skin: "toast",
  167. icon: "error",
  168. content: res.msg || "获取数据失败",
  169. });
  170. throw new Error(res.msg || '获取数据失败');
  171. }
  172. } else if (patientTaskType.associationType.value == this.ASSOCIATION_TYPES['患者陪检业务']) {
  173. // 患者陪检业务
  174. if (res.status == 200) {
  175. this.checkedShowMsg = res.data;
  176. this.changePatientBuildData({
  177. key: 'dept',
  178. value: {
  179. startDept: {
  180. id: res.startDept,
  181. dept: res.startDeptName,
  182. deptalias: res.startDeptAlias
  183. }, //待改
  184. endDept: {
  185. id: res.startDept,
  186. dept: res.startDeptName,
  187. deptalias: res.startDeptAlias
  188. }, //待改
  189. }
  190. });
  191. this.changeQucikCreateOrderType({
  192. type: "patient",
  193. taskTypeId: checkedObj.value,
  194. patientTaskType,
  195. selectedPatient: this.selectedPatient,
  196. patientBuildTrip: res,
  197. });
  198. uni.navigateTo({
  199. url: "/pages/appointmentInspect/appointmentInspect",
  200. });
  201. } else {
  202. this.$refs.seiminModel.show({
  203. skin: "toast",
  204. icon: "error",
  205. content: res.msg || "获取数据失败",
  206. });
  207. throw new Error(res.msg || '获取数据失败');
  208. }
  209. }
  210. })
  211. },
  212. // 一键建单
  213. buildOrder(patient) {
  214. this.selectedPatient = patient;
  215. // 1,请求任务类型列表
  216. uni.showLoading({
  217. mask: true,
  218. title: '加载中'
  219. })
  220. reqDeptTSPTaskType().then(res => {
  221. uni.hideLoading();
  222. if (res.status == 200) {
  223. res.data = res.data || [];
  224. this.taskTypeListResource = res.data;
  225. this.taskTypeList = res.data.map((v) => ({
  226. value: v.id,
  227. label: v.taskName,
  228. }));
  229. this.pickerTitle = `您选择了<b class="green">${patient.patientName}</b>患者,请选择下方具体服务项`;
  230. this.openPicker();
  231. } else {
  232. this.$refs.seiminModel.show({
  233. skin: "toast",
  234. icon: "error",
  235. content: res.msg || "获取数据失败",
  236. });
  237. throw new Error(res.msg || "获取数据失败");
  238. }
  239. })
  240. },
  241. // 跳转患者详情
  242. toDetail(patientCode, patientName) {
  243. uni.navigateTo({
  244. url: `/pages/patientDetail/patientDetail?patientCode=${patientCode}&patientName=${patientName}`
  245. })
  246. },
  247. //监听输入
  248. inputChange(event = '', idxPlus = false) {
  249. let keyWord = event.detail ? event.detail.value : event;
  250. if (idxPlus) {
  251. //累加
  252. ++this.idx;
  253. } else {
  254. this.idx = 0;
  255. }
  256. let postData = {
  257. "idx": this.idx,
  258. "sum": 9999,
  259. "patient": {
  260. keyWord,
  261. "department": {
  262. "id": this.loginInfo.user.dept.id
  263. }
  264. }
  265. };
  266. uni.showLoading({
  267. title: "加载中",
  268. });
  269. reqFetchDataList("nurse", "patient", postData).then((res) => {
  270. uni.hideLoading();
  271. uni.stopPullDownRefresh();
  272. if (res.status == 200) {
  273. res.list = res.list || [];
  274. if (idxPlus) {
  275. //累加
  276. this.patientList = this.patientList.concat(res.list);
  277. } else {
  278. this.patientList = res.list;
  279. }
  280. this.totalNum = res.totalNum || 0;
  281. } else {
  282. this.$refs.seiminModel.show({
  283. skin: "toast",
  284. icon: "error",
  285. content: res.msg || "获取数据失败",
  286. });
  287. throw new Error(res.msg || "获取数据失败");
  288. }
  289. });
  290. },
  291. // 查询最新列表(上拉)
  292. reachBottom() {
  293. //没有更多
  294. if (this.patientList.length == this.totalNum) {
  295. uni.showToast({
  296. icon: 'none',
  297. title: '没有更多数据了'
  298. })
  299. return;
  300. }
  301. this.inputChange(this.keyword, true);
  302. },
  303. },
  304. onReachBottom() {
  305. this.reachBottom();
  306. },
  307. onPullDownRefresh() {
  308. this.inputChange(this.keyword)
  309. },
  310. created() {
  311. this.debounceInp = debounce(this.inputChange, 500);
  312. },
  313. beforeDestroy() {
  314. this.debounceInp.cancel()
  315. },
  316. onLoad() {
  317. this.inputChange();
  318. },
  319. };
  320. </script>
  321. <style lang="scss" scoped>
  322. .patientList {
  323. padding-bottom: 108rpx;
  324. .search-box {
  325. background-color: rgb(242, 242, 242);
  326. padding: 15rpx 2.5%;
  327. position: fixed;
  328. z-index: 99;
  329. width: 100%;
  330. @include flex(space-between);
  331. .mSearch-input-box {
  332. width: 100%;
  333. }
  334. .input-box {
  335. width: 85%;
  336. flex-shrink: 1;
  337. @include flex(center, center);
  338. &>input {
  339. width: 100%;
  340. height: 60rpx;
  341. font-size: 32rpx;
  342. border: 0;
  343. border-radius: 60rpx;
  344. appearance: none;
  345. padding: 0 3%;
  346. margin: 0;
  347. background-color: #ffffff;
  348. }
  349. }
  350. .search-btn {
  351. width: 15%;
  352. margin: 0 0 0 2%;
  353. flex-shrink: 0;
  354. font-size: 28rpx;
  355. color: #fff;
  356. background: linear-gradient(to right, #ff9801, #ff570a);
  357. border-radius: 60rpx;
  358. @include flex(center, center);
  359. }
  360. }
  361. .search-keyword {
  362. padding: 88rpx 24rpx 0;
  363. // 列表项
  364. .orderList_listItem {
  365. width: 702rpx;
  366. min-height: 320rpx;
  367. background-color: #fff;
  368. position: relative;
  369. margin-top: 8rpx;
  370. border-radius: 8rpx;
  371. padding: 0 24rpx;
  372. font-size: 32rpx;
  373. @include border;
  374. @include semicircle(#F9FAFB, 82rpx);
  375. @include flex(flex-start, stretch, column);
  376. .orderList_listItem_header {
  377. height: 86rpx;
  378. @include border($directive:bottom, $style:dashed);
  379. @include flex(space-between, center);
  380. .orderList_listItem_header_title {
  381. color: #333;
  382. flex: 1;
  383. @include flex(flex-start, center);
  384. .associationType_icon {
  385. width: 48rpx;
  386. height: 48rpx;
  387. border-radius: 50%;
  388. font-size: 24rpx;
  389. margin-right: 8rpx;
  390. @include border($color:#39b199);
  391. @include flex(center, center);
  392. &.green {
  393. color: $defaultColor;
  394. border: 1px solid $defaultColor;
  395. background-color: rgba(73, 184, 86, 0.1);
  396. }
  397. &.red {
  398. color: #FF3B53;
  399. border: 1px solid #FF3B53;
  400. background-color: #FFE8EB;
  401. }
  402. }
  403. .taskNameAndWorkerName {
  404. flex: 1;
  405. @include flex;
  406. .taskName {
  407. max-width: 10em;
  408. @include clamp;
  409. }
  410. .workerName {
  411. flex: 1;
  412. @include clamp;
  413. }
  414. }
  415. }
  416. .orderList_listItem_header_more {
  417. color: #333;
  418. font-weight: bold;
  419. @include clamp;
  420. }
  421. }
  422. .orderList_listItem_item {
  423. height: 88rpx;
  424. color: #333;
  425. font-size: 30rpx;
  426. flex: 1;
  427. @include border(bottom);
  428. @include flex(flex-start, stretch, column);
  429. &:last-of-type {
  430. border-bottom: none;
  431. }
  432. .orderList_listItem_item_content {
  433. min-height: 143rpx;
  434. flex: 1;
  435. @include flex(space-between, center);
  436. .orderList_listItem_item_name {
  437. font-size: 34rpx;
  438. }
  439. .orderList_listItem_item_time {
  440. color: #333;
  441. font-size: 34rpx;
  442. font-weight: bold;
  443. }
  444. }
  445. .orderList_listItem_item_btns {
  446. position: relative;
  447. left: -24rpx;
  448. width: 698rpx;
  449. height: 88rpx;
  450. @include btn_background;
  451. @include flex;
  452. .btn {
  453. flex: 1;
  454. background-color: transparent;
  455. position: relative;
  456. @include flex(center, center);
  457. &::before {
  458. content: '';
  459. position: absolute;
  460. right: 0;
  461. top: 0;
  462. width: 1px;
  463. height: 100%;
  464. @include border(right, #fff);
  465. }
  466. &:last-of-type::before {
  467. border-right: none;
  468. }
  469. &::after {
  470. border: none;
  471. }
  472. }
  473. }
  474. }
  475. }
  476. }
  477. }
  478. </style>