bigScreen.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. <template>
  2. <view class="toolbar" @click="Scanning()" hover-class="seimin-btn-hover">
  3. <text class="toolbar-icon icon_transport transport-saoma"></text>
  4. <text class="toolbar-sao">扫一扫</text>
  5. <!-- 填写交接人工号弹窗 -->
  6. <selectAccount @click.stop.native v-if="hosModels.disjunctor" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  7. @cancel="hosCancel">
  8. </selectAccount>
  9. </view>
  10. </template>
  11. <script>
  12. import {
  13. post,
  14. SM
  15. } from "../../http/http.js";
  16. export default {
  17. data() {
  18. return {
  19. // 填写交接人工号弹窗model
  20. hosModels: {
  21. disjunctor: false,
  22. },
  23. userId: {
  24. ids: [],
  25. },
  26. workData: [],
  27. infoDATA: {},
  28. tabType: "", //当前选中项
  29. selectArr: [], //选中项
  30. code: "",
  31. currentCode: '', //当前小扫描的科室二维码
  32. SMFlag: true,
  33. }
  34. },
  35. methods: {
  36. // 填写交接人工号-确认
  37. hosOk(data) {
  38. console.log(data);
  39. const {
  40. accountName,
  41. account,
  42. accountId
  43. } = data;
  44. if (!accountName && !account) {
  45. //没有填写交接人
  46. uni.showModal({
  47. title: "提示",
  48. content: "请填写交接人工号!",
  49. showCancel: false,
  50. success: function(res) {
  51. if (res.confirm) {
  52. console.log("用户点击确定");
  53. } else if (res.cancel) {
  54. console.log("用户点击取消");
  55. }
  56. },
  57. });
  58. return;
  59. } else if ((!accountName && account) || (accountName && !account)) {
  60. //没有填写交接人
  61. uni.showModal({
  62. title: "提示",
  63. content: "请填写正确的交接人工号!",
  64. showCancel: false,
  65. success: function(res) {
  66. if (res.confirm) {
  67. console.log("用户点击确定");
  68. } else if (res.cancel) {
  69. console.log("用户点击取消");
  70. }
  71. },
  72. });
  73. return;
  74. }
  75. this.hosModels.disjunctor = false;
  76. this.orderDeptHandler(false, data);
  77. },
  78. // 填写交接人工号-取消
  79. hosCancel() {
  80. this.hosModels.disjunctor = false;
  81. this.flag = true;
  82. },
  83. // 填写交接人工号弹窗
  84. showSelectAccount() {
  85. this.hosModels = {
  86. disjunctor: true,
  87. };
  88. },
  89. //科室签到
  90. //trueBigScanner----判断是否大扫描
  91. //bigScanner----判断是否需要交接人
  92. //accountObj----弹窗填写的交接人信息
  93. orderDeptHandler(bigScanner, accountObj) {
  94. let type = "orderSign/" + this.code;
  95. let list = {
  96. ids: this.userId.ids,
  97. trueBigScanner: ['666']
  98. };
  99. bigScanner && (list.bigScanner = ['666']);
  100. if (accountObj) {
  101. list.handover = [accountObj.accountId];
  102. }
  103. uni.showLoading({
  104. title: "加载中",
  105. mask: true,
  106. });
  107. post("/workerOrder/" + type, list).then((res) => {
  108. console.log(this.tabType)
  109. uni.hideLoading();
  110. if (res.status == 200) {
  111. if (this.tabType == 'specimenPlan') {
  112. // -----------------------------
  113. console.log(this.selectArr, '选中工单')
  114. let gd = this.infoDATA.specimenPlan.find(v => v.id == this.selectArr[0]);
  115. let startDeptId = gd.startDept.id; //起点科室id
  116. let isDigitalHandover = gd.taskType.isDigitalHandover; //是否数字交接开关
  117. let signDeptId = res.deptId; //签到的科室id
  118. let gdId = gd.id;
  119. let gdState = gd.gdState.value;
  120. let endDepts = gd.endDepts.map(v => v.id).toString();
  121. uni.navigateTo({
  122. url: `../scanning_djEnd/scanning_djEnd?type=${
  123. this.tabType
  124. }&type1=${res.type}&code=${this.code}&dept=${
  125. res.dept
  126. }&ids=${encodeURIComponent(
  127. JSON.stringify(this.userId.ids)
  128. )}&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}&startDeptId=${startDeptId}&isDigitalHandover=${isDigitalHandover}&signDeptId=${signDeptId}&gdId=${gdId}&gdState=${gdState}&endDepts=${endDepts}`,
  129. });
  130. } else if (this.tabType == 'specimen') {
  131. // 同济是false
  132. if (res.deptType && res.deptType.value === 'middleRoom') {
  133. // if (false) {
  134. // 如果是中转科室
  135. uni.navigateTo({
  136. url: `../checkAfterBigScreen/checkAfterBigScreen?type=${
  137. this.tabType
  138. }&type1=${res.type}&code=${this.code}&dept=${
  139. res.dept
  140. }&ids=${encodeURIComponent(
  141. JSON.stringify(this.userId.ids)
  142. )}&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}`,
  143. });
  144. } else {
  145. uni.navigateTo({
  146. url: `../scanning_djEnd/scanning_djEnd?type=${
  147. this.tabType
  148. }&type1=${res.type}&code=${this.code}&dept=${
  149. res.dept
  150. }&ids=${encodeURIComponent(
  151. JSON.stringify(this.userId.ids)
  152. )}&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}`,
  153. });
  154. }
  155. }
  156. } else if (res.status == "0000") {
  157. this.showSelectAccount();
  158. } else {
  159. this.flag = true;
  160. uni.navigateTo({
  161. url: `../scanning_djEnd/scanning_djEnd?type=${this.tabType}&type1=${
  162. res.type
  163. }&code=${this.code}&dept=${res.dept}&ids=${encodeURIComponent(
  164. JSON.stringify(this.userId.ids)
  165. )}&model=${encodeURIComponent(JSON.stringify(res))}&deptId=${res.deptId}`,
  166. });
  167. }
  168. });
  169. },
  170. // 底部扫描
  171. Scanning(qrcodePrefix = '') {
  172. if (!this.SMFlag) {
  173. return;
  174. }
  175. this.SMFlag = false;
  176. SM().then((content) => {
  177. uni.showLoading({
  178. title: "加载中",
  179. mask: true,
  180. });
  181. //检验二维码的有效性(扫码前必须验证)
  182. post("/dept/scanning", {
  183. content,
  184. })
  185. .then((result) => {
  186. this.currentCode = result.code;
  187. this.SMFlag = true;
  188. // 200检测通过,201没有有效期也通过。
  189. if (result.state == 200 || result.state == 201) {
  190. let data = {
  191. code: result.code, //二维码
  192. };
  193. //微信—大扫描(科室码,患者码,标本码,快捷建单码,药包码)
  194. let code = result.code.includes(qrcodePrefix) ? result.code : qrcodePrefix + result.code;
  195. post("/workerOrder/scanCode", { code })
  196. .then((res) => {
  197. uni.hideLoading();
  198. if (res.status == 200) {
  199. // 扫描标本码
  200. if (res.type == "specimen") {
  201. let infoDATA = {
  202. stype: res.data.stype,
  203. scode: res.data.scode,
  204. patientName: res.data.patientName,
  205. sickRoom: res.data.sickRoom ?
  206. res.data.sickRoom.dept : "-",
  207. checkDept: res.data.checkDept ?
  208. res.data.checkDept.dept : "-",
  209. bedNum: res.data.bedNum,
  210. };
  211. uni.navigateTo({
  212. url: `../scanning_B/scanning_B?res=${encodeURIComponent(
  213. JSON.stringify(res)
  214. )}&infoDATA=${encodeURIComponent(
  215. JSON.stringify(infoDATA)
  216. )}`,
  217. });
  218. } else if (res.type == "patient") {
  219. //如果是患者腕带码
  220. // code: data.code //二维码
  221. res.workOrder = res.workOrder ? res.workOrder : []; //liao
  222. uni.navigateTo({
  223. url: `../scanning_ins/scanning_ins?code=${
  224. data.code
  225. }&infoDATA=${encodeURIComponent(
  226. JSON.stringify(res.data)
  227. )}&workData=${encodeURIComponent(
  228. JSON.stringify(res.workOrder)
  229. )}&patientOrders=${encodeURIComponent(
  230. JSON.stringify(res.patientOrders)
  231. )}`,
  232. });
  233. } else if (res.type == "quickOrder") {
  234. //快捷建单
  235. if(res.data.isDigitalHandover == 1){
  236. uni.navigateTo({
  237. url: `../specimenChecking/specimenChecking?infoDATA=${encodeURIComponent(
  238. JSON.stringify(res.data)
  239. )}`,
  240. });
  241. }else{
  242. uni.navigateTo({
  243. url: `../shortcutbuildOrders/shortcutbuildOrders?infoDATA=${encodeURIComponent(
  244. JSON.stringify(res.data)
  245. )}`,
  246. });
  247. }
  248. } else if (res.type == "dept") {
  249. // 扫描科室码
  250. // code: data.code //二维码
  251. let infoDATA = res.data;
  252. console.log(infoDATA)
  253. // 判断是否是标本配送,并且仅仅只有这一种业务类型,默认全选,并跳转到下一步;
  254. // 判断是否是标本轮巡 ,并且仅仅只有这一种业务类型,并且只有一个工单,默认选中,并跳转到下一步;
  255. if(Object.keys(infoDATA).length === 1 && (infoDATA.specimen || (infoDATA.specimenPlan && infoDATA.specimenPlan.length === 1))){
  256. this.infoDATA = infoDATA;
  257. this.workData = infoDATA.specimen || infoDATA.specimenPlan;
  258. this.tabType = infoDATA.specimen ? 'specimen' : 'specimenPlan';
  259. this.code = data.code;
  260. this.selectArr = [];
  261. for (var i = 0; i < this.workData.length; i++) {
  262. this.selectArr.push(this.workData[i].id);
  263. }
  264. this.userId.ids = this.selectArr;
  265. this.orderDeptHandler(true);
  266. }else{
  267. uni.navigateTo({
  268. url: `../scanning_all/scanning_all?infoDATA=${encodeURIComponent(
  269. JSON.stringify(infoDATA)
  270. )}&code=${data.code}&deptName=${res.deptName}&deptId=${res.deptId}`,
  271. });
  272. }
  273. } else if (res.type == 'drugsBag') {
  274. //扫药包码
  275. uni.navigateTo({
  276. url: `/pages/scanning_drug/scanning_drug?drugsBagId=${res.drugsBagId}&drugsBagBatchNo=${res.drugsBagBatchNo}`,
  277. });
  278. } else if (res.type == 'nucleicAcid') {
  279. //扫核酸码
  280. uni.navigateTo({
  281. url: `/pages/scanning_nucleicAcid/scanning_nucleicAcid?qrcode=${data.code}`,
  282. });
  283. } else if (res.type == 'blood') {
  284. //扫血制品
  285. // 判断size,多个则进入新页面选择
  286. if(res.size > 1){
  287. uni.navigateTo({
  288. url: `/pages/bloodSelect/bloodSelect?qrcode=${data.code}&navigateTo=scanning_blood`,
  289. });
  290. } else {
  291. uni.navigateTo({
  292. url: `/pages/scanning_blood/scanning_blood?qrcode=${data.code}`,
  293. });
  294. }
  295. } else if (res.type == 'receiveOrder') {
  296. //扫快捷接单
  297. uni.showModal({
  298. title: "提示",
  299. content: `您本次接单包括${res.names.join('、')},一共含有${res.data.length}个工单,是否确认接单?`,
  300. success: function(result) {
  301. if (result.confirm) {
  302. uni.showLoading({
  303. title: "加载中",
  304. mask: true,
  305. });
  306. post("/workerOrder/receiveOrders", {ids: res.data.toString()}).then((result) => {
  307. uni.hideLoading();
  308. if (result.status == 200) {
  309. uni.showModal({
  310. title: "提示",
  311. content: `本次接单包括${res.names.join('、')},${res.data.length}个工单已接单完成`,
  312. showCancel: false,
  313. success: function(res) {
  314. if (res.confirm) {
  315. console.log("用户点击确定");
  316. uni.redirectTo({
  317. url: "../receiptpage/receiptpage",
  318. });
  319. } else if (res.cancel) {
  320. console.log("用户点击取消");
  321. }
  322. },
  323. });
  324. } else {
  325. uni.showToast({
  326. icon: "none",
  327. title: result.msg || "接口获取数据失败!",
  328. });
  329. }
  330. });
  331. } else if (result.cancel) {
  332. console.log("用户点击取消");
  333. }
  334. },
  335. });
  336. } else if (res.type == 'bloodTake') {
  337. if(res.data){
  338. //新血制品-扫科室
  339. uni.navigateTo({
  340. url: `/pages/startOrderSignBlood/startOrderSignBlood?deptId=${res.deptId}&deptName=${res.deptName}&taskTypeId=${res.taskTypeId}`,
  341. });
  342. }else{
  343. // 走type是dept的流程
  344. // 扫描科室码
  345. // code: data.code //二维码
  346. let infoDATA = res.data;
  347. console.log(infoDATA)
  348. // 判断是否是标本配送,并且仅仅只有这一种业务类型,默认全选,并跳转到下一步;
  349. // 判断是否是标本轮巡 ,并且仅仅只有这一种业务类型,并且只有一个工单,默认选中,并跳转到下一步;
  350. if(Object.keys(infoDATA).length === 1 && (infoDATA.specimen || (infoDATA.specimenPlan && infoDATA.specimenPlan.length === 1))){
  351. this.infoDATA = infoDATA;
  352. this.workData = infoDATA.specimen || infoDATA.specimenPlan;
  353. this.tabType = infoDATA.specimen ? 'specimen' : 'specimenPlan';
  354. this.code = data.code;
  355. this.selectArr = [];
  356. for (var i = 0; i < this.workData.length; i++) {
  357. this.selectArr.push(this.workData[i].id);
  358. }
  359. this.userId.ids = this.selectArr;
  360. this.orderDeptHandler(true);
  361. }else{
  362. uni.navigateTo({
  363. url: `../scanning_all/scanning_all?infoDATA=${encodeURIComponent(
  364. JSON.stringify(infoDATA)
  365. )}&code=${data.code}&deptName=${res.deptName}&deptId=${res.deptId}`,
  366. });
  367. }
  368. }
  369. }
  370. } else {
  371. uni.navigateTo({
  372. url: `../scanning_Result/scanning_Result?status=${res.status}&msg=${res.msg}&qrcode=${this.currentCode}`,
  373. });
  374. }
  375. });
  376. } else {
  377. uni.hideLoading();
  378. uni.showToast({
  379. icon: "none",
  380. title: result.info || "接口获取数据失败!",
  381. });
  382. }
  383. })
  384. }).catch(err => {
  385. this.SMFlag = true;
  386. });
  387. },
  388. },
  389. onShow() {
  390. this.SMFlag = true;
  391. }
  392. };
  393. </script>
  394. <style lang="less">
  395. // 底部扫一扫
  396. .toolbar {
  397. position: fixed;
  398. left: 0;
  399. right: 0;
  400. bottom: 30rpx;
  401. z-index: 999;
  402. height: 88rpx;
  403. display: flex;
  404. justify-content: center;
  405. align-items: center;
  406. box-sizing: border-box;
  407. border-radius: 4rpx;
  408. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.24);
  409. background-color: #e5e9ed;
  410. .toolbar-icon {
  411. font-size: 52rpx;
  412. margin-right: 16rpx;
  413. color: #07863c;
  414. }
  415. .toolbar-sao {
  416. font-size: 36rpx;
  417. color: #333;
  418. }
  419. }
  420. </style>