scanning_B.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <view class="Scanning_B">
  3. <view class="Scanning_top" v-if="res.status == 200 || res.status == 666">
  4. <view class="Scanning_top_icon">
  5. <text class="cubeic-ok icon_transport transport-duigou"></text>
  6. </view>
  7. <view class="Scanning_top_text">
  8. <view class="text1" v-if="res.status == 200">扫描成功</view>
  9. <view class="text1" v-else-if="res.status == 666">查询成功</view>
  10. </view>
  11. </view>
  12. <view class="Scanning_top" v-if="res.status != 200 && res.status != 666">
  13. <view class="Scanning_top_icon">
  14. <text class="cubeic-close icon_transport transport-shibai"></text>
  15. </view>
  16. <view class="Scanning_top_text">
  17. <view class="text1">扫描失败</view>
  18. </view>
  19. </view>
  20. <view class="Scanning_cont" v-if="res.status == 200 || res.status == 666">
  21. <view>标本类型 : {{ infoDATA.stype.name || "-" }}</view>
  22. <view>标本编码 : {{ infoDATA.scode || "-" }}</view>
  23. <view>标本状态 : {{ res.data.speState ? res.data.speState.name : "-" }}</view>
  24. <view>患者床号 : {{ infoDATA.bedNum || "-" }}</view>
  25. <view>申请科室 : {{ infoDATA.sickRoom || "-" }}</view>
  26. <view>检查科室 : {{ infoDATA.checkDept || "-" }}</view>
  27. <view>检验项目 : {{ res.data.specimenDesc || "-" }}</view>
  28. </view>
  29. <view class="Scanning_cont" v-else>
  30. <view>{{ res.msg }}</view>
  31. </view>
  32. <view class="foot_btn" v-if="res.status != 666">
  33. <view class="btn3" @click="showAlert()">知道了</view>
  34. <block v-if="res.scanCodeSpecimenOrderSign == 1">
  35. <view class="btn3" @click="orderSign(res.workOrder)" v-if="res.workOrder">执行工单</view>
  36. <view class="btn3" @click="buildAndOrderSign(res.data.id)" v-if="!res.workOrder && res.data">建单并签到</view>
  37. </block>
  38. </view>
  39. <!-- 填写交接人账号弹窗 -->
  40. <selectAccount v-if="hosModels.disjunctor" :title="hosModels.title" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  41. @cancel="hosCancel">
  42. </selectAccount>
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. post,
  48. webHandle
  49. } from "../../http/http.js";
  50. export default {
  51. data() {
  52. return {
  53. infoDATA: {},
  54. res: {},
  55. // 填写交接人账号弹窗model
  56. hosModels: {
  57. disjunctor: false,
  58. },
  59. currentCode: "",
  60. type: "", //类型,orderSign|buildAndOrderSign
  61. };
  62. },
  63. methods: {
  64. // 如果不是患者陪检或患者转运或其他
  65. // 科室签到
  66. nextDeptOrder_s(data, accountObj) {
  67. console.log(data, accountObj);
  68. let ids = [];
  69. let id = data.id;
  70. ids.push(id);
  71. let code = "";
  72. let postData = {
  73. ids,
  74. };
  75. if (this.type === 'orderSign') {
  76. postData.specimenOrderSign = data.specimenSet.map(v=>v.id); //破坏性,必须扫标本
  77. }
  78. if (accountObj) {
  79. postData.handover = [accountObj.accountId];
  80. }
  81. if (this.currentCode) {
  82. code = this.currentCode;
  83. // 科室签到
  84. post("/workerOrder/orderSign/" + code, postData).then((res) => {
  85. uni.hideLoading();
  86. if (res.status == 200) {
  87. // 跳转到扫描科室
  88. // type1: res.type, //type类型
  89. // id: data.id, //工单ID
  90. // deptCode: code, //二维码
  91. // dept: res.dept //科室名称
  92. uni.navigateTo({
  93. url: `/pages/scanning_code/scanning_code?type=${
  94. data.taskType.associationType.value
  95. }&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${
  96. res.dept
  97. }&accountObj=${encodeURIComponent(
  98. JSON.stringify(accountObj)
  99. )}&deptId=${res.deptId}`,
  100. });
  101. } else {
  102. uni.navigateTo({
  103. url: `/pages/scanning_Result/scanning_Result?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&isKs=1`,
  104. });
  105. }
  106. });
  107. }
  108. },
  109. // 执行工单
  110. orderSign(workOrder) {
  111. this.type = 'orderSign';
  112. uni.showLoading({
  113. title: "加载中",
  114. mask: true,
  115. });
  116. let postData = {
  117. content: workOrder.startDept.qrcode,
  118. taskTypeId: workOrder.taskType.id,
  119. gdState: workOrder.gdState.id,
  120. };
  121. //检验二维码的有效性
  122. post("/dept/scanning", postData).then((result) => {
  123. this.currentCode = result.code;
  124. if (result.state == 200 || result.state == 201) {
  125. if (result.account) {
  126. this.nextDeptOrder_s(workOrder, {
  127. account: result.account,
  128. accountName: result.name,
  129. accountId: result.id,
  130. });
  131. } else {
  132. this.nextDeptOrder_s(workOrder);
  133. }
  134. } else if (result.state == "0000") {
  135. uni.hideLoading();
  136. this.showSelectAccount();
  137. } else {
  138. uni.hideLoading();
  139. uni.showToast({
  140. icon: "none",
  141. title: "请求失败!",
  142. });
  143. }
  144. });
  145. },
  146. // 建单并签到
  147. buildAndOrderSign(speId) {
  148. this.type = 'buildAndOrderSign';
  149. uni.showLoading({
  150. title: "加载中",
  151. mask: true,
  152. });
  153. post("/workerOrder/specimenCreateAndSign", {
  154. speId,
  155. }).then((res) => {
  156. if (res.state == 200 || res.state == 201) {
  157. uni.hideLoading();
  158. if (res.status == 200) {
  159. // 跳转到扫描科室
  160. // type1: res.type, //type类型
  161. // id: data.id, //工单ID
  162. // deptCode: code, //二维码
  163. // dept: res.dept //科室名称
  164. uni.navigateTo({
  165. url: `/pages/scanning_code/scanning_code?type=${
  166. res.workOrder.taskType.associationType.value
  167. }&type1=${res.type}&id=${res.workOrder.id}&deptCode=${
  168. this.currentCode
  169. }&dept=${res.dept}&accountObj=${encodeURIComponent(
  170. JSON.stringify(undefined)
  171. )}&deptId=${res.deptId}`,
  172. });
  173. } else {
  174. uni.navigateTo({
  175. url: `/pages/scanning_Result/scanning_Result?type=${res.workOrder.taskType.associationType.value}&type1=${res.type}&id=${res.workOrder.id}&status=600&msg=${res.msg}&isKs=1`,
  176. });
  177. }
  178. } else if (res.state == "0000") {
  179. uni.hideLoading();
  180. this.currentCode = res.code;
  181. this.res.workOrder = res.workOrder;
  182. this.showSelectAccount();
  183. } else {
  184. uni.hideLoading();
  185. uni.showToast({
  186. icon: "none",
  187. title: res.msg || "请求失败!",
  188. });
  189. }
  190. });
  191. },
  192. // 填写交接人账号-确认
  193. hosOk(data) {
  194. console.log(data);
  195. const {
  196. accountName,
  197. account,
  198. accountId
  199. } = data;
  200. if (!accountName && !account) {
  201. //没有填写交接人
  202. uni.showModal({
  203. title: "提示",
  204. content: "请填写交接人账号!",
  205. showCancel: false,
  206. success: function(res) {
  207. if (res.confirm) {
  208. console.log("用户点击确定");
  209. } else if (res.cancel) {
  210. console.log("用户点击取消");
  211. }
  212. },
  213. });
  214. return;
  215. } else if ((!accountName && account) || (accountName && !account)) {
  216. //没有填写交接人
  217. uni.showModal({
  218. title: "提示",
  219. content: "请填写正确的交接人账号!",
  220. showCancel: false,
  221. success: function(res) {
  222. if (res.confirm) {
  223. console.log("用户点击确定");
  224. } else if (res.cancel) {
  225. console.log("用户点击取消");
  226. }
  227. },
  228. });
  229. return;
  230. }
  231. this.hosModels.disjunctor = false;
  232. uni.showLoading({
  233. title: "加载中",
  234. mask: true,
  235. });
  236. this.nextDeptOrder_s(this.res.workOrder, data);
  237. },
  238. // 填写交接人账号-取消
  239. hosCancel() {
  240. this.hosModels.disjunctor = false;
  241. },
  242. // 填写交接人账号弹窗
  243. showSelectAccount() {
  244. this.hosModels = {
  245. title: "填写交接人账号",
  246. disjunctor: true,
  247. };
  248. },
  249. // 知道了
  250. showAlert() {
  251. uni.navigateTo({
  252. url: "../receiptpage/receiptpage",
  253. });
  254. },
  255. },
  256. onLoad(options) {
  257. this.res = JSON.parse(options.res);
  258. this.infoDATA = JSON.parse(options.infoDATA); //详细信息
  259. console.log(this.infoDATA);
  260. // #ifdef APP-PLUS
  261. webHandle("no", "app");
  262. // #endif
  263. // #ifdef H5
  264. webHandle("no", "wx");
  265. // #endif
  266. },
  267. };
  268. </script>
  269. <style lang="less">
  270. .Scanning_B {
  271. padding: 0px 74rpx;
  272. .uni-modal__btn_primary{
  273. color: #49b856!important;
  274. }
  275. .Scanning_top {
  276. height: 270rpx;
  277. .Scanning_top_icon {
  278. width: 140rpx;
  279. height: 140rpx;
  280. margin: 0 auto;
  281. margin-top: 116rpx;
  282. border-radius: 50%;
  283. line-height: 140rpx;
  284. text-align: center;
  285. .cubeic-ok {
  286. font-size: 140rpx;
  287. color: #35b34a;
  288. }
  289. .cubeic-close {
  290. font-size: 140rpx;
  291. color: #ff3b53;
  292. }
  293. }
  294. .Scanning_top_text {
  295. .text1 {
  296. margin-top: 40rpx;
  297. font-size: 48rpx;
  298. text-align: center;
  299. }
  300. }
  301. }
  302. .Scanning_cont {
  303. font-size: 32rpx;
  304. view {
  305. margin-bottom: 16rpx;
  306. text-align: center;
  307. }
  308. .text {
  309. margin-top: 24rpx;
  310. color: #35b34a;
  311. }
  312. .text1 {
  313. margin-top: 24rpx;
  314. color: #ff3b53;
  315. }
  316. }
  317. .foot_btn {
  318. line-height: 88rpx;
  319. height: 100rpx;
  320. margin-top: 40rpx;
  321. display: flex;
  322. justify-content: center;
  323. .btn3 {
  324. flex: 1;
  325. height: 88rpx;
  326. background-image: linear-gradient(to right, #72c172, #3bb197);
  327. color: #fff;
  328. border-radius: 8rpx;
  329. font-size: 32rpx;
  330. margin-top: 16rpx;
  331. margin-right: 16rpx;
  332. text-align: center;
  333. &:last-of-type {
  334. margin-right: 0;
  335. }
  336. }
  337. }
  338. }
  339. </style>