search.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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. newVal = newVal.replace(/^2#/, '');
  149. newVal = newVal.replace(/^r2#/, '');
  150. this.keyword1 = newVal;
  151. },
  152. },
  153. },
  154. methods: {
  155. ...mapMutations('other', ['changeQucikCreateOrderType', 'clearPatientBuildData', 'changePatientBuildData']),
  156. // 跳转患者详情
  157. toDetail(search, type) {
  158. switch (type) {
  159. case 'patient':
  160. uni.navigateTo({
  161. url: `/pages/patientDetail/patientDetail?patientCode=${search.patientCode}&patientName=${search.patientName}`
  162. })
  163. break;
  164. case 'specimen':
  165. uni.navigateTo({
  166. url: `/pages/detail/detail?id=${search.id}&associationType=specimen&scode=${search.scode}`
  167. })
  168. break;
  169. case 'inspect':
  170. uni.navigateTo({
  171. url: `/pages/detail/detail?id=${search.id}&associationType=inspect`
  172. })
  173. break;
  174. }
  175. },
  176. //监听输入
  177. inputChange(event = '') {
  178. let keyWord = event.detail ? event.detail.value : event;
  179. keyWord = keyWord.replace(/^2#/, '');
  180. keyWord = keyWord.replace(/^r2#/, '');
  181. // 长度小于等于0,返回空数组
  182. // 长度小于等于4,只搜索床号
  183. // 长度大于4,搜索患者住院号,患者二维码,标本码,检查单号
  184. if (!keyWord.length) {
  185. this.searchList = {
  186. patientList: [],
  187. specimenList: [],
  188. inspectList: [],
  189. }
  190. return;
  191. }
  192. let postData = {
  193. deptId: this.loginInfo.user.dept.id,
  194. code: keyWord
  195. };
  196. uni.showLoading({
  197. title: "加载中",
  198. });
  199. reqSmartScan(postData).then((res) => {
  200. uni.hideLoading();
  201. uni.stopPullDownRefresh();
  202. if (res.state == 200) {
  203. Object.assign(this.searchList, res.data);
  204. console.log(this.searchList)
  205. } else {
  206. this.$refs.seiminModel.show({
  207. skin: "toast",
  208. icon: "error",
  209. content: res.msg || "获取数据失败",
  210. });
  211. throw new Error(res.msg || "获取数据失败");
  212. }
  213. });
  214. },
  215. },
  216. onReachBottom() {
  217. this.reachBottom();
  218. },
  219. onPullDownRefresh() {
  220. this.inputChange(this.keyword);
  221. },
  222. created() {
  223. this.debounceInp = debounce(this.inputChange, 500);
  224. },
  225. beforeDestroy() {
  226. this.debounceInp.cancel()
  227. },
  228. onLoad(queryParams) {
  229. this.queryParams = queryParams;
  230. this.keyword = queryParams.txt;
  231. this.inputChange(this.keyword);
  232. },
  233. mounted() {
  234. this.$refs.search.inputVal = this.queryParams.txt;
  235. }
  236. };
  237. </script>
  238. <style lang="scss" scoped>
  239. .search {
  240. padding-bottom: 108rpx;
  241. .search-box {
  242. background-color: rgb(242, 242, 242);
  243. padding: 15rpx 2.5%;
  244. position: fixed;
  245. z-index: 99;
  246. width: 100%;
  247. @include flex(space-between);
  248. .mSearch-input-box {
  249. width: 100%;
  250. }
  251. .input-box {
  252. width: 85%;
  253. flex-shrink: 1;
  254. @include flex(center, center);
  255. &>input {
  256. width: 100%;
  257. height: 60rpx;
  258. font-size: 32rpx;
  259. border: 0;
  260. border-radius: 60rpx;
  261. appearance: none;
  262. padding: 0 3%;
  263. margin: 0;
  264. background-color: #ffffff;
  265. }
  266. }
  267. .search-btn {
  268. width: 15%;
  269. margin: 0 0 0 2%;
  270. flex-shrink: 0;
  271. font-size: 28rpx;
  272. color: #fff;
  273. background: linear-gradient(to right, #ff9801, #ff570a);
  274. border-radius: 60rpx;
  275. @include flex(center, center);
  276. }
  277. }
  278. .search-keyword {
  279. padding: 88rpx 24rpx 0;
  280. .head {
  281. font-weight: bold;
  282. }
  283. // 列表项
  284. .orderList_listItem {
  285. width: 702rpx;
  286. min-height: 232rpx;
  287. background-color: #fff;
  288. position: relative;
  289. margin-top: 8rpx;
  290. border-radius: 8rpx;
  291. padding: 0 24rpx;
  292. font-size: 32rpx;
  293. @include border;
  294. @include semicircle(#F9FAFB, 82rpx);
  295. @include flex(flex-start, stretch, column);
  296. .orderList_listItem_header {
  297. height: 86rpx;
  298. @include border($directive:bottom, $style:dashed);
  299. @include flex(space-between, center);
  300. .orderList_listItem_header_title {
  301. color: #333;
  302. flex: 1;
  303. @include flex(flex-start, center);
  304. .associationType_icon {
  305. width: 48rpx;
  306. height: 48rpx;
  307. border-radius: 50%;
  308. font-size: 24rpx;
  309. margin-right: 8rpx;
  310. @include border($color:#39b199);
  311. @include flex(center, center);
  312. &.green {
  313. color: $defaultColor;
  314. border: 1px solid $defaultColor;
  315. background-color: rgba(73, 184, 86, 0.1);
  316. }
  317. &.red {
  318. color: #FF3B53;
  319. border: 1px solid #FF3B53;
  320. background-color: #FFE8EB;
  321. }
  322. }
  323. .taskNameAndWorkerName {
  324. flex: 1;
  325. @include flex;
  326. .taskName {
  327. max-width: 10em;
  328. @include clamp;
  329. }
  330. .workerName {
  331. flex: 1;
  332. @include clamp;
  333. }
  334. }
  335. }
  336. .orderList_listItem_header_more {
  337. color: #333;
  338. font-weight: bold;
  339. @include clamp;
  340. }
  341. }
  342. .orderList_listItem_item {
  343. height: 88rpx;
  344. color: #333;
  345. font-size: 30rpx;
  346. flex: 1;
  347. @include border(bottom);
  348. @include flex(flex-start, stretch, column);
  349. &:last-of-type {
  350. border-bottom: none;
  351. }
  352. .orderList_listItem_item_content {
  353. min-height: 143rpx;
  354. flex: 1;
  355. @include flex(space-between, center);
  356. &.no {
  357. @include flex($flexDirection: column);
  358. .no_item {
  359. flex: 1;
  360. @include flex(space-between, center);
  361. }
  362. }
  363. .orderList_listItem_item_name {
  364. font-size: 34rpx;
  365. }
  366. .orderList_listItem_item_time {
  367. color: #333;
  368. font-size: 34rpx;
  369. font-weight: bold;
  370. }
  371. }
  372. }
  373. }
  374. }
  375. }
  376. </style>