scanning_B.vue 11 KB

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