check_blood.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <view class="checkBlood">
  3. <view class="page_tab">
  4. <view class="page_tab_bar" :class="{ active: item.value === selectedLabelSlots }" v-for="item in tabs"
  5. :key="item.value" @click="clickHandler(item.value)">
  6. {{ item.label }}
  7. <text class="tab_num" v-if="item.value == 1">( {{ item.num }} )</text>
  8. </view>
  9. </view>
  10. <block v-if="selectedLabelSlots == 1">
  11. <view class="bloodType">
  12. <view class="bloodTypeItem" v-for="(item, key, index) in unComplete" :key="index">
  13. {{key}}:<text class="link" @click="goToList(item)">{{item.length}}</text>
  14. </view>
  15. </view>
  16. </block>
  17. <block v-if="selectedLabelSlots == 2">
  18. <view class="title">
  19. 血制品核对
  20. </view>
  21. <view class="order">
  22. <view class="">
  23. 工单号:{{order.gdcode||'无'}}
  24. </view>
  25. <view class="">
  26. 所属科室:{{order.endDepts?order.endDepts[0].dept:'无'}}
  27. </view>
  28. <view class="">
  29. 接收数量:{{receiveNum}}
  30. </view>
  31. </view>
  32. <view class="bloodType">
  33. <view class="bloodTypeItem" v-for="(item, key, index) in complete" :key="index">
  34. <text class="link_key">{{key}}:</text><text class="link" @click="goToList(item)">{{item.length}}</text>
  35. </view>
  36. </view>
  37. </block>
  38. <view class="foot_btn_spe">
  39. <view class="btn1" @click="Scanning_again()" v-if="configs.checkType.value == 1"> 继续扫描 </view>
  40. <view class="btn3" @click="checkComplete()">核对完成</view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import {
  46. get,
  47. post,
  48. SM,
  49. webHandle
  50. } from "../../http/http.js";
  51. export default {
  52. data() {
  53. return {
  54. configs: {},
  55. hosId: null,
  56. queryObj: {},
  57. SMFlag: true,
  58. // 接收数量
  59. receiveNum: 0,
  60. // 未扫描
  61. unComplete:{},
  62. // 已扫描
  63. complete:{},
  64. // 工单
  65. order: {},
  66. // 工单ID
  67. orderId: null,
  68. // 血液类型
  69. bloodTypes:[],
  70. // 当前选中tab页名称
  71. selectedLabelSlots: '2',
  72. // tab页信息
  73. tabs: [{
  74. label: "未扫描", //tab页名称
  75. value: "1", //值
  76. num: 0, //数量
  77. },
  78. {
  79. label: "已扫描",
  80. value: "2",
  81. },
  82. ],
  83. };
  84. },
  85. methods:{
  86. // 跳转血制品列表
  87. goToList(bloods){
  88. uni.navigateTo({
  89. url: `../blood_list/blood_list?bloods=${encodeURIComponent(JSON.stringify(bloods))}`,
  90. });
  91. },
  92. // 点击tab页切换
  93. clickHandler(value) {
  94. this.selectedLabelSlots = value;
  95. },
  96. //获取血液类型
  97. getBloodTypes(){
  98. uni.showLoading({
  99. title: "加载中",
  100. mask: true,
  101. });
  102. post('/common/common/getDictionary', {
  103. "type": "list",
  104. "key": "blood_trans_type"
  105. }).then(res => {
  106. this.bloodTypes = res;
  107. this.getTaskConfig();
  108. })
  109. },
  110. //获取血制品配置页面
  111. getTaskConfig(){
  112. let postData = {
  113. "idx": 0,
  114. "sum": 1,
  115. "taskTypeConfig": {
  116. "taskTypeDTO": {
  117. "hosId": {
  118. "id": this.hosId
  119. },
  120. "ordinaryField": {
  121. "key": "ordinary_field",
  122. "value": "blood"
  123. }
  124. }
  125. }
  126. };
  127. post('/simple/data/fetchDataList/taskTypeConfig', postData).then(result => {
  128. this.getInfo();
  129. if(result.status == 200){
  130. this.configs = result.list[0] || {};
  131. }else{
  132. uni.showToast({
  133. icon: "none",
  134. title: "请求失败!",
  135. });
  136. }
  137. })
  138. },
  139. //获取页面信息
  140. getInfo(){
  141. post('/transflow/checkData', {
  142. "type": "blood",
  143. "orderId": this.orderId
  144. }).then(res => {
  145. uni.hideLoading();
  146. if(res.state == 200){
  147. console.log(res);
  148. this.order = res.data.dto;
  149. this.complete = res.data.complete;
  150. this.unComplete = res.data.unComplete;
  151. this.receiveNum = 0;
  152. for (let key in this.unComplete) {
  153. this.tabs[0].num += this.unComplete[key].length;
  154. }
  155. for (let key in this.complete) {
  156. this.receiveNum += this.complete[key].length;
  157. }
  158. }else{
  159. uni.showToast({
  160. icon: "none",
  161. title: "请求失败!",
  162. });
  163. }
  164. })
  165. },
  166. // 继续扫描
  167. Scanning_again() {
  168. if (!this.SMFlag) {
  169. return;
  170. }
  171. this.SMFlag = false;
  172. SM().then((ress1) => {
  173. this.hand_scanning_common(ress1, 'scan');
  174. }).catch(err => {
  175. this.SMFlag = true;
  176. });
  177. },
  178. // 手动输入和扫码公共方法
  179. hand_scanning_common(ress1, type) {
  180. uni.showLoading({
  181. title: "加载中",
  182. mask: true,
  183. });
  184. //检验二维码的有效性
  185. post("/dept/scanning", {
  186. content: ress1,
  187. }).then((result) => {
  188. this.SMFlag = true;
  189. if (result.state == 200 || result.state == 201) {
  190. let codes = result.code;
  191. if (codes) {
  192. post("/transflow/scanBind", {type: 'blood',orderId: this.queryObj.orderId, code: ress1}).then((ress) => {
  193. uni.hideLoading();
  194. if (ress.state == 200 && ress.data.state != 400) {
  195. //扫描标本后会自动调用摄像头,继续扫描,直到status不是200
  196. setTimeout(()=>{
  197. if (type === 'scan') {
  198. this.Scanning_again();
  199. }
  200. },500)
  201. //todo
  202. uni.redirectTo({
  203. url: `../scanning_blood_process/scanning_blood_process?orderId=${this.queryObj.orderId}&bloodDTO=${encodeURIComponent(JSON.stringify(ress.data.dto))}&scanCount=${ress.data.scanCount}&status=200&scanOrHand=${type}`,
  204. });
  205. } else {
  206. uni.redirectTo({
  207. url: `../scanning_blood_process/scanning_blood_process?orderId=${this.queryObj.orderId}&status=500&scanOrHand=${type}&qrcode=${ress1}`,
  208. });
  209. }
  210. });
  211. } else {
  212. uni.hideLoading();
  213. }
  214. } else {
  215. uni.hideLoading();
  216. uni.showToast({
  217. icon: "none",
  218. title: "请求失败!",
  219. });
  220. }
  221. });
  222. // ------------------------------
  223. },
  224. // 核对完成
  225. checkComplete(){
  226. uni.showModal({
  227. title: "提示",
  228. content: "请确认是否核对完成?",
  229. success: (result) => {
  230. if (result.confirm) {
  231. console.log("用户点击确定");
  232. let postData = {
  233. "type": "blood",
  234. "orderId": this.orderId
  235. };
  236. uni.showLoading({
  237. title: "加载中",
  238. mask: true,
  239. });
  240. let postName = '';
  241. if(this.configs.checkType.value == 1 || (this.configs.checkType.value == 2 && this.order.gdState.value != 5)){
  242. // 起点终点科室按照血制品类型进行核对
  243. postName = '/transflow/checkComplete';
  244. }else if(this.configs.checkType.value == 2 && this.order.gdState.value == 5){
  245. // 终点科室无需扫码进行核对
  246. postName = '/transflow/complete';
  247. }
  248. post(postName, postData).then((ress) => {
  249. uni.hideLoading();
  250. if (ress.state == 200) {
  251. uni.navigateTo({
  252. url: `../receiptpage/receiptpage`,
  253. });
  254. } else {
  255. uni.showToast({
  256. icon: "none",
  257. title: "请求失败!",
  258. });
  259. }
  260. });
  261. } else if (result.cancel) {
  262. console.log("用户点击取消");
  263. }
  264. },
  265. });
  266. }
  267. },
  268. onLoad(options) {
  269. console.log(options, 'options');
  270. this.queryObj = options;
  271. this.orderId = options.orderId;
  272. this.getBloodTypes();
  273. },
  274. onShow() {
  275. this.SMFlag = true;
  276. },
  277. created(){
  278. this.hosId = uni.getStorageSync('userData').user.currentHospital.id;
  279. }
  280. }
  281. </script>
  282. <style lang="less" scoped>
  283. .checkBlood{
  284. width: 100%;
  285. height: 100%;
  286. position: relative;
  287. padding-top: 96rpx;
  288. .page_tab {
  289. width: 100%;
  290. height: 96rpx;
  291. display: flex;
  292. position: fixed;
  293. left: 0;
  294. top: 0;
  295. z-index: 999;
  296. .page_tab_bar {
  297. flex: 1;
  298. font-size: 36rpx;
  299. background: #fff;
  300. display: flex;
  301. justify-content: center;
  302. align-items: center;
  303. position: relative;
  304. &:after {
  305. content: "";
  306. position: absolute;
  307. left: 0;
  308. bottom: 0;
  309. height: 2rpx;
  310. width: 100%;
  311. background-color: transparent;
  312. }
  313. .tab_num {
  314. color: #ff3b53;
  315. margin-left: 8rpx;
  316. }
  317. .more {
  318. position: absolute;
  319. right: 20rpx;
  320. width: 40rpx;
  321. height: 4rpx;
  322. border-top: 2px solid #49b856;
  323. border-bottom: 2px solid #49b856;
  324. background-color: #49b856;
  325. padding: 5px 0;
  326. background-clip: content-box;
  327. }
  328. .more_picker {
  329. position: absolute;
  330. right: 0;
  331. height: 100%;
  332. opacity: 0;
  333. }
  334. &.active {
  335. color: #49b856;
  336. &:after {
  337. background-color: #49b856;
  338. }
  339. }
  340. }
  341. }
  342. .title{
  343. text-align: center;
  344. padding: 20rpx 0;
  345. border: 2rpx solid #e5e9ed;
  346. }
  347. .order{
  348. text-indent: 2em;
  349. padding: 20rpx 0;
  350. }
  351. .bloodType{
  352. width: 90%;
  353. border: 2rpx solid #e5e9ed;
  354. margin: 0 auto;
  355. margin-top: 40rpx;
  356. .bloodTypeItem{
  357. padding: 20rpx 0;
  358. display: flex;
  359. justify-content: space-between;
  360. .link_key{
  361. flex: 5;
  362. text-align: justify;
  363. }
  364. .link{
  365. flex: 1;
  366. display: flex;
  367. justify-content: center;
  368. align-items: center;
  369. text-decoration: underline;
  370. }
  371. }
  372. }
  373. .foot_btn_spe {
  374. line-height: 88rpx;
  375. height: 100rpx;
  376. margin-top: 40rpx;
  377. text-align: center;
  378. display: flex;
  379. justify-content: space-between;
  380. flex-wrap: wrap;
  381. view {
  382. height: 88rpx;
  383. flex: 1;
  384. margin: 0 1%;
  385. background-image: linear-gradient(to right, #72c172, #3bb197);
  386. color: #fff;
  387. border-radius: 8rpx;
  388. font-size: 32rpx;
  389. margin-top: 16rpx;
  390. }
  391. }
  392. }
  393. </style>