search.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view class="search">
  3. <view class="search-box">
  4. <seiminSearch class="mSearch-input-box" :mode="2" button="inside" placeholder="请输入标本编码/检查单号/患者编码"
  5. @input="debounceInp" v-model="keyword" ref="search"></seiminSearch>
  6. </view>
  7. <view class="search-keyword">
  8. <!-- 患者 -->
  9. <view class="head" v-if="searchList.patientList.length">患者</view>
  10. <view class="orderList_listItem" v-for="search in searchList.patientList" :key="search.id"
  11. @click="toDetail(search,'patient')">
  12. <view class="orderList_listItem_header">
  13. <view class="orderList_listItem_header_title">
  14. <block v-if="search.illnessState">
  15. <view class="associationType_icon red" v-if="search.illnessState.value === '2'">危</view>
  16. <view class="associationType_icon red" v-else-if="search.illnessState.value === '3'">重</view>
  17. </block>
  18. <block v-if="search.careLevel">
  19. <view class="associationType_icon red" v-if="search.careLevel.value === '0'">特</view>
  20. <view class="associationType_icon red" v-else-if="search.careLevel.value === '1'">1</view>
  21. <view class="associationType_icon green" v-else-if="search.careLevel.value === '2'">2</view>
  22. <view class="associationType_icon green" v-else-if="search.careLevel.value === '3'">3</view>
  23. </block>
  24. <view class="taskNameAndWorkerName">
  25. <text class="workerName">{{search.patientName || '暂无'}}</text>
  26. </view>
  27. </view>
  28. <text class="orderList_listItem_header_more">{{search.bedNum }}床</text>
  29. </view>
  30. <view class="orderList_listItem_item">
  31. <view class="orderList_listItem_item_content">
  32. <text class="orderList_listItem_item_name">{{search.residenceNo || '暂无'}}</text>
  33. <text class="orderList_listItem_item_time">待检{{search.watingCount}}</text>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 标本 -->
  38. <view class="head" v-if="searchList.specimenList.length">标本</view>
  39. <view class="orderList_listItem" v-for="search in searchList.specimenList" :key="search.id"
  40. @click="toDetail(search,'specimen')">
  41. <view class="orderList_listItem_header">
  42. <view class="orderList_listItem_header_title">
  43. <view class="taskNameAndWorkerName">
  44. <text class="workerName">{{search.specimenDesc || '暂无'}}</text>
  45. </view>
  46. </view>
  47. <text class="orderList_listItem_header_more">{{search.scode || '暂无' }}</text>
  48. </view>
  49. <view class="orderList_listItem_item">
  50. <view class="orderList_listItem_item_content">
  51. <text class="orderList_listItem_item_name">{{search.patientName || '暂无'}}
  52. <block v-if="search.bedNum">({{search.bedNum}}床)</block>
  53. </text>
  54. <text class="orderList_listItem_item_time">{{search.speState?search.speState.name:'暂无'}}</text>
  55. </view>
  56. </view>
  57. </view>
  58. <!-- 检查 -->
  59. <view class="head" v-if="searchList.inspectList.length">检查</view>
  60. <view class="orderList_listItem" v-for="search in searchList.inspectList" :key="search.id"
  61. @click="toDetail(search,'inspect')">
  62. <view class="orderList_listItem_header">
  63. <view class="orderList_listItem_header_title">
  64. <view class="taskNameAndWorkerName">
  65. <text class="workerName">{{search.inspectName || '暂无'}}</text>
  66. </view>
  67. </view>
  68. <text class="orderList_listItem_header_more">{{search.bedNum }}床</text>
  69. </view>
  70. <view class="orderList_listItem_item">
  71. <view class="orderList_listItem_item_content no">
  72. <view class="no_item">
  73. <text class="orderList_listItem_item_name">{{search.inspectCode || '暂无'}}</text>
  74. <text class="orderList_listItem_item_time"></text>
  75. </view>
  76. <view class="no_item">
  77. <text class="orderList_listItem_item_name">{{search.patientName || '暂无'}}
  78. <block v-if="search.bedNum">({{search.bedNum}}床)</block>
  79. </text>
  80. <text class="orderList_listItem_item_time">{{search.yyTime||'暂无'}}</text>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <seiminFooterBtn :btns="btns"></seiminFooterBtn>
  87. <seiminModel ref="seiminModel"></seiminModel>
  88. </view>
  89. </template>
  90. <script>
  91. import {
  92. backPress,
  93. } from '../../utils/index.js';
  94. import {
  95. debounce
  96. } from 'lodash/function';
  97. import {
  98. reqSmartScan,
  99. } from "../../request/api.js";
  100. import {
  101. mapState,
  102. mapMutations,
  103. } from "vuex";
  104. import {
  105. ASSOCIATION_TYPES
  106. } from '../../utils/enum.association_types.js';
  107. export default {
  108. onBackPress() {
  109. backPress();
  110. },
  111. data() {
  112. return {
  113. reFresh: '',
  114. queryParams: {}, //路由参数
  115. ASSOCIATION_TYPES,
  116. checkedShowMsg: {}, //当前选中的任务类型的buildtrip信息
  117. selectedPatient: {}, //当前选中的患者
  118. taskTypeListResource: [], //任务类型列表(请求的原始数据)
  119. taskTypeList: [], //任务类型列表
  120. pickerTitle: "", //一键建单picker的title
  121. debounceInp: null,
  122. keyword1: "",
  123. searchList: {
  124. patientList: [],
  125. specimenList: [],
  126. inspectList: [],
  127. },
  128. //底部按钮
  129. btns: [{
  130. name: "返回首页",
  131. type: "default",
  132. click: () => {
  133. uni.navigateTo({
  134. url: '/pages/index/index'
  135. })
  136. },
  137. }],
  138. };
  139. },
  140. computed: {
  141. ...mapState("login", ["loginInfo"]),
  142. ...mapState('other', ["deptDisplay"]),
  143. keyword: {
  144. get: function() {
  145. return this.keyword1;
  146. },
  147. set: function(newVal) {
  148. this.keyword1 = newVal.replace(/^2#/, '');
  149. },
  150. },
  151. },
  152. methods: {
  153. ...mapMutations('other', ['changeQucikCreateOrderType', 'clearPatientBuildData', 'changePatientBuildData']),
  154. // 跳转患者详情
  155. toDetail(search, type) {
  156. switch (type) {
  157. case 'patient':
  158. uni.navigateTo({
  159. url: `/pages/patientDetail/patientDetail?patientCode=${search.patientCode}&patientName=${search.patientName}`
  160. })
  161. break;
  162. case 'specimen':
  163. uni.navigateTo({
  164. url: `/pages/detail/detail?id=${search.id}&associationType=specimen&scode=${search.scode}`
  165. })
  166. break;
  167. case 'inspect':
  168. uni.navigateTo({
  169. url: `/pages/detail/detail?id=${search.id}&associationType=inspect`
  170. })
  171. break;
  172. }
  173. },
  174. //监听输入
  175. inputChange(event = '') {
  176. let keyWord = event.detail ? event.detail.value : event;
  177. keyWord = keyWord.replace(/^2#/, '');
  178. // 长度小于等于0,返回空数组
  179. // 长度小于等于4,只搜索床号
  180. // 长度大于4,搜索患者住院号,患者二维码,标本码,检查单号
  181. if (!keyWord.length) {
  182. this.searchList = {
  183. patientList: [],
  184. specimenList: [],
  185. inspectList: [],
  186. }
  187. return;
  188. }
  189. let postData = {
  190. deptId: this.loginInfo.user.dept.id,
  191. code: keyWord
  192. };
  193. uni.showLoading({
  194. title: "加载中",
  195. });
  196. reqSmartScan(postData).then((res) => {
  197. uni.hideLoading();
  198. uni.stopPullDownRefresh();
  199. if (res.state == 200) {
  200. Object.assign(this.searchList, res.data);
  201. console.log(this.searchList)
  202. } else {
  203. this.$refs.seiminModel.show({
  204. skin: "toast",
  205. icon: "error",
  206. content: res.msg || "获取数据失败",
  207. });
  208. throw new Error(res.msg || "获取数据失败");
  209. }
  210. });
  211. },
  212. },
  213. onReachBottom() {
  214. this.reachBottom();
  215. },
  216. onPullDownRefresh() {
  217. this.inputChange(this.keyword);
  218. },
  219. created() {
  220. this.debounceInp = debounce(this.inputChange, 500);
  221. },
  222. beforeDestroy() {
  223. this.debounceInp.cancel()
  224. },
  225. onLoad(queryParams) {
  226. this.queryParams = queryParams;
  227. this.keyword = queryParams.txt;
  228. this.inputChange(this.keyword);
  229. },
  230. mounted() {
  231. this.$refs.search.inputVal = this.queryParams.txt;
  232. }
  233. };
  234. </script>
  235. <style lang="scss" scoped>
  236. .search {
  237. padding-bottom: 108rpx;
  238. .search-box {
  239. background-color: rgb(242, 242, 242);
  240. padding: 15rpx 2.5%;
  241. position: fixed;
  242. z-index: 99;
  243. width: 100%;
  244. @include flex(space-between);
  245. .mSearch-input-box {
  246. width: 100%;
  247. }
  248. .input-box {
  249. width: 85%;
  250. flex-shrink: 1;
  251. @include flex(center, center);
  252. &>input {
  253. width: 100%;
  254. height: 60rpx;
  255. font-size: 32rpx;
  256. border: 0;
  257. border-radius: 60rpx;
  258. appearance: none;
  259. padding: 0 3%;
  260. margin: 0;
  261. background-color: #ffffff;
  262. }
  263. }
  264. .search-btn {
  265. width: 15%;
  266. margin: 0 0 0 2%;
  267. flex-shrink: 0;
  268. font-size: 28rpx;
  269. color: #fff;
  270. background: linear-gradient(to right, #ff9801, #ff570a);
  271. border-radius: 60rpx;
  272. @include flex(center, center);
  273. }
  274. }
  275. .search-keyword {
  276. padding: 88rpx 24rpx 0;
  277. .head {
  278. font-weight: bold;
  279. }
  280. // 列表项
  281. .orderList_listItem {
  282. width: 702rpx;
  283. min-height: 232rpx;
  284. background-color: #fff;
  285. position: relative;
  286. margin-top: 8rpx;
  287. border-radius: 8rpx;
  288. padding: 0 24rpx;
  289. font-size: 32rpx;
  290. @include border;
  291. @include semicircle(#F9FAFB, 82rpx);
  292. @include flex(flex-start, stretch, column);
  293. .orderList_listItem_header {
  294. height: 86rpx;
  295. @include border($directive:bottom, $style:dashed);
  296. @include flex(space-between, center);
  297. .orderList_listItem_header_title {
  298. color: #333;
  299. flex: 1;
  300. @include flex(flex-start, center);
  301. .associationType_icon {
  302. width: 48rpx;
  303. height: 48rpx;
  304. border-radius: 50%;
  305. font-size: 24rpx;
  306. margin-right: 8rpx;
  307. @include border($color:#39b199);
  308. @include flex(center, center);
  309. &.green {
  310. color: $defaultColor;
  311. border: 1px solid $defaultColor;
  312. background-color: rgba(73, 184, 86, 0.1);
  313. }
  314. &.red {
  315. color: #FF3B53;
  316. border: 1px solid #FF3B53;
  317. background-color: #FFE8EB;
  318. }
  319. }
  320. .taskNameAndWorkerName {
  321. flex: 1;
  322. @include flex;
  323. .taskName {
  324. max-width: 10em;
  325. @include clamp;
  326. }
  327. .workerName {
  328. flex: 1;
  329. @include clamp;
  330. }
  331. }
  332. }
  333. .orderList_listItem_header_more {
  334. color: #333;
  335. font-weight: bold;
  336. @include clamp;
  337. }
  338. }
  339. .orderList_listItem_item {
  340. height: 88rpx;
  341. color: #333;
  342. font-size: 30rpx;
  343. flex: 1;
  344. @include border(bottom);
  345. @include flex(flex-start, stretch, column);
  346. &:last-of-type {
  347. border-bottom: none;
  348. }
  349. .orderList_listItem_item_content {
  350. min-height: 143rpx;
  351. flex: 1;
  352. @include flex(space-between, center);
  353. &.no {
  354. @include flex($flexDirection: column);
  355. .no_item {
  356. flex: 1;
  357. @include flex(space-between, center);
  358. }
  359. }
  360. .orderList_listItem_item_name {
  361. font-size: 34rpx;
  362. }
  363. .orderList_listItem_item_time {
  364. color: #333;
  365. font-size: 34rpx;
  366. font-weight: bold;
  367. }
  368. }
  369. }
  370. }
  371. }
  372. }
  373. </style>