specimenPort.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. <template>
  2. <view class="conte">
  3. <view class="header">
  4. <text class="title">{{userInfo.dept.dept}}</text>
  5. <view class="filter" @click="filterClick">
  6. <text class="newicon newicon-shaixuan icon"></text>
  7. </view>
  8. </view>
  9. <view class="height-list"></view>
  10. <view class="list" @click="detail(item)" v-for="(item, index) in list" :key="index">
  11. <view class="df-list list-border">
  12. <view>{{item.applyCode}}</view>
  13. <view>{{item.status.name}}</view>
  14. </view>
  15. <view class="df-list">
  16. <view class="df-list-over-left">科室:{{item.patientDTO.department.dept}}</view>
  17. <view class="df-list-over">部位:{{item.takePart}}</view>
  18. </view>
  19. <view class="df-list">
  20. <view class="df-list-over-left">患者:{{item.patientName}}({{item.patientDTO.bedNum}}床)</view>
  21. <view class="df-list-over">住院号:{{item.patientDTO.barCode}}</view>
  22. </view>
  23. <view class="df-list">
  24. <view class="df-list-over-left">离:{{yyTimeFilter(item.inVitroTime)}}</view>
  25. <view class="df-list-over">固:{{yyTimeFilter(item.fixationTime)}}</view>
  26. </view>
  27. <view class="list-content"></view>
  28. </view>
  29. <uni-drawer width="400px" :visible="isShowFilter" mode="right" :maskClick="false" @close="filterCacel()">
  30. <view class="execFilterMask" @touchmove.stop.prevent>
  31. <view class="execFilter">
  32. <radio-group @change="radioChange">
  33. <label class="df uni-list-cell uni-list-cell-pd" v-for="(item, index) in specimenData" :key="item.id">
  34. <view>
  35. <radio :value="item.id+''" activeBackgroundColor="#49B856" :checked="index == current" />
  36. </view>
  37. <view>{{item.dept}}</view>
  38. </label>
  39. </radio-group>
  40. <view class="execFilterFooter">
  41. <view class="btn" @click="filterCacel()" v-if="isDept || specimenData.length==0">取消</view>
  42. <view class="btn" @click="filterOk()">确认</view>
  43. </view>
  44. </view>
  45. </view>
  46. </uni-drawer>
  47. <!-- PDA扫描 -->
  48. <scanner></scanner>
  49. </view>
  50. </template>
  51. <script>
  52. import {
  53. get,
  54. post
  55. } from "../../http/http.js";
  56. import scanner from "../../components/scanner/scanner.vue";
  57. export default {
  58. data() {
  59. return {
  60. list: [],
  61. idx: 0,
  62. isDept:null,
  63. userInfo:uni.getStorageSync('userData').user,
  64. hosId: uni.getStorageSync('userData').user.currentHospital.id,
  65. specimenData: [],
  66. isShowFilter: false,
  67. current: null,
  68. deptId:null,
  69. totalNum:0,
  70. hasMore:true,
  71. SMFlag:true,
  72. }
  73. },
  74. components: {
  75. scanner
  76. },
  77. methods: {
  78. // 时间格式化
  79. yyTimeFilter(timestamp) {
  80. var date = new Date(timestamp); // 时间戳为毫秒级别
  81. var year = date.getFullYear();
  82. var month = date.getMonth() + 1;
  83. var day = date.getDate();
  84. var hours = date.getHours();
  85. var minutes = date.getMinutes();
  86. var seconds = date.getSeconds();
  87. // 格式化月份、日期、小时、分钟、秒
  88. month = month < 10 ? '0' + month : month;
  89. day = day < 10 ? '0' + day : day;
  90. hours = hours < 10 ? '0' + hours : hours;
  91. minutes = minutes < 10 ? '0' + minutes : minutes;
  92. seconds = seconds < 10 ? '0' + seconds : seconds;
  93. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  94. },
  95. // 打开科室选择
  96. filterClick() {
  97. this.isShowFilter = true
  98. this.$nextTick(_=>{
  99. let userInfo = uni.getStorageSync('userData').user
  100. if(this.isDept){
  101. for (let i = 0; i < this.specimenData.length; i++) {
  102. if (this.specimenData[i].id == userInfo.dept.id) {
  103. this.current = i;
  104. this.deptId = userInfo.dept.id;
  105. break;
  106. }
  107. }
  108. }
  109. })
  110. },
  111. // 关闭科室弹框
  112. filterCacel() {
  113. this.isShowFilter = false
  114. },
  115. // 确定关联科室
  116. filterOk() {
  117. let userInfo = uni.getStorageSync('userData').user
  118. if(!this.isDept){
  119. if(!this.deptId){
  120. uni.showToast({
  121. title: '请选择科室',
  122. duration: 1000,
  123. icon:'none'
  124. });
  125. return
  126. }
  127. }
  128. uni.showLoading({
  129. title: "加载中",
  130. mask: true,
  131. });
  132. let query = {
  133. user: {
  134. dept:{
  135. id:this.deptId?this.deptId:userInfo.dept.id
  136. },
  137. id:userInfo.id
  138. },
  139. }
  140. post('/data/updData/user', query).then(res => {
  141. uni.hideLoading();
  142. this.filterCacel();
  143. this.getNewDept()
  144. this.idx = 0
  145. this.getList()
  146. });
  147. },
  148. getNewDept(){
  149. let postData = {
  150. currentHosId: this.hosId,
  151. loginType: "Wechat",
  152. };
  153. post('/auth/changeHospital',postData).then((result) => {
  154. if (result.status == 200) {
  155. this.getCurrentUserNow();
  156. }
  157. });
  158. },
  159. // 获取当前用户信息
  160. getCurrentUserNow() {
  161. get('/user/data/getCurrentUser').then((data) => {
  162. if (data["status"] == 200) {
  163. this.loginUser = data.data
  164. let user = uni.getStorageSync('userData');
  165. user.user.dept = data["data"].dept;
  166. user.user.currentHospital = data["data"].currentHospital;
  167. this.userInfo.dept.dept = data["data"].dept.dept;
  168. uni.setStorageSync('userData',user)
  169. let userInfo = uni.getStorageSync('userData').user
  170. this.isDept = this.specimenData.find(i=>i.id == userInfo.dept.id)
  171. }
  172. });
  173. },
  174. // 选择科室
  175. radioChange(evt) {
  176. this.deptId = evt.detail.value
  177. for (let i = 0; i < this.specimenData.length; i++) {
  178. if (this.specimenData[i].id == evt.detail.value) {
  179. this.current = i;
  180. break;
  181. }
  182. }
  183. },
  184. // 查看详情
  185. detail(item){
  186. // this.padChange('BL2410251554361\n')
  187. uni.navigateTo({
  188. url: `/pages/specimenPort/detail?detailId=${item.id}`
  189. });
  190. },
  191. // 获取标本间科室
  192. getDept(backType) {
  193. post('/common/common/getDictionary', {
  194. key: "dept_type",
  195. type: "list"
  196. }).then((res2) => {
  197. let item2 = res2.find(i => i.name == '标本间科室')
  198. let query = {
  199. idx: 0,
  200. sum: 9999,
  201. department: {
  202. hospital: {
  203. id: this.hosId || ""
  204. },
  205. type: {
  206. id: item2.id || ""
  207. },
  208. },
  209. };
  210. post('/data/fetchDataList/department', query).then((res) => {
  211. this.specimenData = res.list
  212. if(!backType){
  213. this.isShowFilter = true
  214. }
  215. let userInfo = uni.getStorageSync('userData').user
  216. this.isDept = this.specimenData.find(i=>i.id == userInfo.dept.id)
  217. this.$nextTick(_=>{
  218. if(this.isDept){
  219. for (let i = 0; i < this.specimenData.length; i++) {
  220. if (this.specimenData[i].id === userInfo.dept.id) {
  221. this.current = i;
  222. break;
  223. }
  224. }
  225. }
  226. })
  227. if(this.isDept){
  228. this.getList()
  229. }
  230. });
  231. });
  232. },
  233. // 分页数据
  234. getList() {
  235. uni.showLoading({
  236. title: "加载中",
  237. mask: true,
  238. });
  239. let query = {
  240. idx: this.idx,
  241. pathologyForm: {
  242. detailsType: "specimenDept",
  243. keyWords: "",
  244. hosId: this.hosId,
  245. },
  246. sum: 20
  247. }
  248. post('/data/fetchDataList/pathologyForm', query).then(res => {
  249. uni.hideLoading();
  250. if(res.list.length){
  251. this.hasMore = true;
  252. this.list = this.idx === 0 ? res.list : this.list.concat(res.list);
  253. }else{
  254. if(this.idx == 0){
  255. this.list = []
  256. }
  257. this.hasMore = false;
  258. }
  259. this.totalNum = res.totalNum;
  260. });
  261. },
  262. // PDA扫描
  263. padChange(scannerCode){
  264. scannerCode = scannerCode.replace('\n','')
  265. if (!this.SMFlag) {
  266. return;
  267. }
  268. this.SMFlag = false;
  269. uni.showLoading({
  270. title: "加载中",
  271. mask: true,
  272. });
  273. post("/pathology/scanCode", {
  274. barcode:scannerCode,
  275. platform:"app"
  276. }).then((res) => {
  277. this.SMFlag = true
  278. uni.hideLoading();
  279. if(res.status==200){
  280. if(res.data[0].status.name=='标本离体'){
  281. uni.navigateTo({
  282. url: `/pages/specimenPort/scan?data=${JSON.stringify(res.data[0])}&type=${res.type}`
  283. });
  284. }else{
  285. uni.showToast({
  286. title: '查询到标本申请单信息',
  287. duration: 1000,
  288. icon:'none'
  289. });
  290. setTimeout(_=>{
  291. uni.navigateTo({
  292. url: `/pages/specimenPort/detail?detailId=${res.data[0].id}`
  293. });
  294. },800)
  295. }
  296. }else{
  297. uni.showModal({
  298. title: "提示",
  299. content: `${res.msg} \n 扫描内容:${scannerCode}`,
  300. confirmColor:'#49b856',
  301. success: (res) => {
  302. if (res.confirm) {
  303. console.log("用户点击确定");
  304. } else if (res.cancel) {
  305. console.log("用户点击取消");
  306. }
  307. },
  308. });
  309. }
  310. })
  311. },
  312. },
  313. onReachBottom() {
  314. this.idx++;
  315. if (this.hasMore) {
  316. this.getList(); // 当触底时加载更多数据
  317. }
  318. },
  319. onBackPress(e) {
  320. // backbutton:物理按键返回
  321. if (e.from === 'backbutton') {
  322. uni.navigateTo({
  323. url: `/pages/homePage/homePage`
  324. });
  325. return true
  326. }
  327. },
  328. onShow() {
  329. let that = this
  330. // #ifdef APP-PLUS
  331. uni.$off('scan') // 每次进来先 移除全局自定义事件监听器
  332. uni.$on('scan', function(data) {
  333. that.padChange(data)
  334. })
  335. // #endif
  336. },
  337. onLoad(option) {
  338. let backType = option.backType ? option.backType : null
  339. this.getDept(backType)
  340. }
  341. }
  342. </script>
  343. <style lang="less" scoped>
  344. page {
  345. background: #F7F7F7;
  346. }
  347. .conte {
  348. .header {
  349. height: 80rpx;
  350. display: flex;
  351. justify-content: center;
  352. align-items: center;
  353. position: relative;
  354. position: fixed;
  355. width: 100%;
  356. background: #F7F7F7;
  357. .title {
  358. color: #57BC63;
  359. font-size: 32rpx;
  360. font-weight: 500;
  361. }
  362. .filter {
  363. position: absolute;
  364. right: 15rpx;
  365. top: 24rpx;
  366. .icon{
  367. font-size: 34rpx;
  368. }
  369. }
  370. }
  371. .height-list {
  372. height: 44px;
  373. }
  374. .list {
  375. // margin-bottom: 20rpx;
  376. background: #fff;
  377. .df-list {
  378. display: flex;
  379. justify-content: space-between;
  380. padding: 14rpx 20rpx;
  381. font-size: 28rpx;
  382. color: #555555;
  383. .df-list-over-left{
  384. overflow: hidden;
  385. flex: 1;
  386. text-overflow: ellipsis;
  387. white-space: nowrap;
  388. }
  389. .df-list-over{
  390. overflow: hidden;
  391. flex: 1;
  392. text-overflow: ellipsis;
  393. white-space: nowrap;
  394. margin-left: 20rpx;
  395. }
  396. }
  397. .list-border {
  398. border-bottom: 1px solid #D2D2D2;
  399. height: 46rpx;
  400. display: flex;
  401. justify-content: space-between;
  402. align-items: center;
  403. font-size: 32rpx !important;
  404. font-weight: 500;
  405. color: #000;
  406. }
  407. .list-content{
  408. height: 22rpx;
  409. background: #F7F7F7;
  410. }
  411. }
  412. .df {
  413. display: flex;
  414. height: 80rpx;
  415. align-items: center;
  416. padding: 0 20rpx;
  417. border-bottom: 1px solid #D2D2D2;
  418. }
  419. .execFilterMask{
  420. .execFilter{
  421. position: relative;
  422. background-color: #fff;
  423. height: 100vh;
  424. border-radius: 100rpx 100rpx 0 0;
  425. .execFilterHeader{
  426. height: 70rpx;
  427. display: flex;
  428. justify-content: center;
  429. align-items: center;
  430. border-bottom: 2rpx solid #ccc;
  431. }
  432. .execFilterBody{
  433. .execFilterItem{
  434. padding: 32rpx;
  435. border-bottom: 2rpx dashed #ccc;
  436. &:last-of-type{
  437. border-bottom: none;
  438. }
  439. .execFilterItemHeader{}
  440. .execFilterItemBody{
  441. display: flex;
  442. flex-wrap: wrap;
  443. padding: 32rpx 0 0;
  444. justify-content: space-between;
  445. text-align: left;
  446. .execFilterItemBox{
  447. width: 200rpx;
  448. height: 80rpx;
  449. text-align: center;
  450. line-height: 80rpx;
  451. background-color: #f6f6f6;
  452. margin-bottom: 20rpx;
  453. border-radius: 80rpx;
  454. &.active{
  455. color: #fff;
  456. background-color: #49b856;
  457. }
  458. }
  459. .deptName {
  460. height: 80rpx;
  461. background-color: #f6f6f6;
  462. border-radius: 20rpx;
  463. padding: 0 20rpx;
  464. width: 100%;
  465. }
  466. }
  467. }
  468. }
  469. .execFilterFooter {
  470. position: absolute;
  471. bottom: 0;
  472. right: 0;
  473. left: 0;
  474. line-height: 66rpx;
  475. height: 100rpx;
  476. display: flex;
  477. justify-content: space-between;
  478. .btn {
  479. height: 66rpx;
  480. flex: 1;
  481. margin: 0 1%;
  482. background-image: linear-gradient(to right, #72c172, #3bb197);
  483. color: #fff;
  484. border-radius: 8rpx;
  485. font-size: 28rpx;
  486. margin-top: 16rpx;
  487. text-align: center;
  488. }
  489. }
  490. }
  491. }
  492. }
  493. </style>