smallScreen.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <view class="smallScreen">
  3. <view class="smallScreen_scan" @click="Scan_ss(sData,sType)">
  4. <slot></slot>
  5. </view>
  6. <!-- 填写交接人账号弹窗 -->
  7. <selectAccount v-if="hosModels.disjunctor" :title="hosModels.title" :disjunctor="hosModels.disjunctor" @ok="hosOk"
  8. @cancel="hosCancel">
  9. </selectAccount>
  10. </view>
  11. </template>
  12. <script>
  13. import selectAccount from "../../components/selectAccount/selectAccount.vue";
  14. import {
  15. post,
  16. SM
  17. } from "../../http/http.js";
  18. export default {
  19. data() {
  20. return {
  21. currentCode: '', //当前小扫描的科室二维码
  22. currentData: {}, //当前小扫描的工单对象
  23. // 填写交接人账号弹窗model
  24. hosModels: {
  25. disjunctor: false,
  26. },
  27. SMFlag:true,
  28. }
  29. },
  30. props: {
  31. sData: {
  32. type: Object
  33. },
  34. sType: {
  35. type: Number
  36. }
  37. },
  38. methods: {
  39. // 如果不是静配,药配,标本配送,标本轮巡
  40. // 科室签到(小扫描)
  41. nextDeptOrder_ss(data, accountObj) {
  42. console.log(this.currentCode);
  43. let isKs = 0;
  44. let ids = [];
  45. let id = data.id;
  46. ids.push(id);
  47. let list = {
  48. code: "",
  49. ids: ids,
  50. };
  51. let code = "";
  52. let type = "";
  53. if (this.currentCode) {
  54. let gdStateValue = data.gdState.value; //工单状态value
  55. let associationTypeValue = data.taskType.associationType.value; //关联类型value
  56. // 患者陪检,并且工单状态是待到达
  57. if (
  58. gdStateValue == "4" &&
  59. associationTypeValue == "inspect"
  60. ) {
  61. list.code = this.currentCode; //其他
  62. type = "handleIns";
  63. }
  64. // 其他临床服务,并且工单状态是待到达||工单状态待送达
  65. if (
  66. (associationTypeValue == "other" &&
  67. gdStateValue == "4") ||
  68. gdStateValue == "5"
  69. ) {
  70. code = this.currentCode;
  71. type = "orderSign/" + code;
  72. list = {
  73. ids
  74. };
  75. if (accountObj) {
  76. list.handover = [accountObj.accountId];
  77. }
  78. isKs = 1;
  79. }
  80. if (
  81. (gdStateValue == "5" &&
  82. associationTypeValue == "inspect") ||
  83. associationTypeValue == "patientTransport"
  84. ) {
  85. code = this.currentCode;
  86. type = "orderSign/" + code;
  87. list = {
  88. ids
  89. };
  90. if (accountObj) {
  91. list.handover = [accountObj.accountId];
  92. }
  93. isKs = 1;
  94. }
  95. if (gdStateValue == "8") {
  96. code = this.currentCode; //患者陪检--检查
  97. type = "orderSign/" + code;
  98. list = {
  99. ids
  100. };
  101. if (accountObj) {
  102. list.handover = [accountObj.accountId];
  103. }
  104. isKs = 1;
  105. }
  106. if (
  107. gdStateValue == "4" &&
  108. associationTypeValue == "patientTransport"
  109. ) {
  110. list = {
  111. code: this.currentCode, //患者转运--检查
  112. ids: ids,
  113. };
  114. type = "handleTrans";
  115. }
  116. post("/workerOrder/" + type, list).then((res) => {
  117. uni.hideLoading();
  118. if (res) {
  119. if (res.status == 200) {
  120. if (
  121. gdStateValue == "4" &&
  122. associationTypeValue == "other"
  123. ) {
  124. uni.navigateTo({
  125. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  126. });
  127. }
  128. if (
  129. gdStateValue == "4" &&
  130. associationTypeValue != "other"
  131. ) {
  132. uni.navigateTo({
  133. url: `../../pages/scanning_Result/scanning_Result?type=${
  134. associationTypeValue
  135. }&type1=${res.type}&id=${data.id}&deptCode=${
  136. list.code
  137. }&patient=${res.patient}&patientCode=${
  138. res.patientCode
  139. }&deptName=${res.deptName}&bedNum=${
  140. res.bedNum
  141. }&status=${res.status}&msg=${
  142. res.msg
  143. }&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  144. });
  145. }
  146. if (gdStateValue == "8") {
  147. uni.navigateTo({
  148. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  149. });
  150. }
  151. if (gdStateValue == "5") {
  152. uni.navigateTo({
  153. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  154. });
  155. }
  156. } else {
  157. console.log(res, "扫描失败");
  158. if (res.type == "trans-ddd-1") {
  159. //起点科室扫描腕带码失败
  160. uni.navigateTo({
  161. url: `../../pages/scanning_Result/scanning_Result?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&qrcode=${this.currentCode}`,
  162. });
  163. } else {
  164. uni.navigateTo({
  165. url: `../../pages/scanning_Result/scanning_Result?type=${
  166. associationTypeValue
  167. }&type1=${res.type}&id=${data.id}&status=600&msg=${
  168. res.msg
  169. }&isKs=${isKs}&model=${encodeURIComponent(
  170. JSON.stringify(res)
  171. )}&qrcode=${this.currentCode}`,
  172. });
  173. }
  174. }
  175. } else {
  176. uni.navigateTo({
  177. url: `../../pages/scanning_Result/scanning_Result?id=${data.id}&status=600&msg=扫码失败!请扫描正确的二维码!&isKs=${isKs}&qrcode=${this.currentCode}`,
  178. });
  179. }
  180. });
  181. }
  182. },
  183. // 如果不是患者陪检或患者转运或其他
  184. // 科室签到
  185. nextDeptOrder_s(data, accountObj) {
  186. console.log(this.currentCode);
  187. let ids = [];
  188. let id = data.id;
  189. ids.push(id);
  190. let code = "";
  191. let postData = {
  192. ids
  193. };
  194. if (accountObj) {
  195. postData.handover = [accountObj.accountId];
  196. }
  197. if (this.currentCode) {
  198. code = this.currentCode;
  199. // 科室签到
  200. post("/workerOrder/orderSign/" + code, postData).then((res) => {
  201. uni.hideLoading();
  202. if (res.status == 200) {
  203. // 跳转到扫描科室
  204. // type1: res.type, //type类型
  205. // id: data.id, //工单ID
  206. // deptCode: code, //二维码
  207. // dept: res.dept //科室名称
  208. console.log(data,'工单')
  209. let endDepts = data.endDepts.map(v=>v.id).toString();
  210. console.log(endDepts,'smallScreen');
  211. uni.navigateTo({
  212. url: `../../pages/scanning_code/scanning_code?type=${data.taskType.associationType.value}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}&deptId=${res.deptId}&endDepts=${endDepts}`,
  213. });
  214. } else {
  215. uni.navigateTo({
  216. 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}`,
  217. });
  218. }
  219. });
  220. }
  221. },
  222. // type==1 如果不是静配,药配,标本配送,标本轮巡
  223. // type==2 如果不是患者陪检,患者转运,其他
  224. // 扫码(小扫描)
  225. Scan_ss(data, type) {
  226. if (!this.SMFlag) {
  227. return;
  228. }
  229. this.SMFlag = false;
  230. this.currentData = data;
  231. console.log(data, 'data');
  232. SM().then((ress1) => {
  233. uni.showLoading({
  234. title: "加载中",
  235. mask: true,
  236. });
  237. //检验二维码的有效性
  238. post("/dept/scanning", {
  239. content: ress1,
  240. taskTypeId: data.taskType.id,
  241. gdState: data.gdState.id,
  242. }).then((result) => {
  243. this.SMFlag = true;
  244. this.currentCode = result.code;
  245. if (result.state == 200 || result.state == 201) {
  246. if (result.account) {
  247. if (type == 1) {
  248. this.nextDeptOrder_ss(this.currentData, {
  249. account: result.account,
  250. accountName: result.name,
  251. accountId: result.id,
  252. });
  253. } else if (type == 2) {
  254. this.nextDeptOrder_s(this.currentData, {
  255. account: result.account,
  256. accountName: result.name,
  257. accountId: result.id,
  258. });
  259. }
  260. } else {
  261. if (type == 1) {
  262. this.nextDeptOrder_ss(this.currentData);
  263. } else if (type == 2) {
  264. this.nextDeptOrder_s(this.currentData);
  265. }
  266. }
  267. } else if (result.state == '0000') {
  268. uni.hideLoading();
  269. this.showSelectAccount(); //yeye
  270. } else {
  271. uni.hideLoading();
  272. uni.showToast({
  273. icon: "none",
  274. title: "请求失败!",
  275. });
  276. }
  277. });
  278. }).catch(err=>{
  279. this.SMFlag = true;
  280. });
  281. },
  282. // 填写交接人账号-确认
  283. hosOk(data) {
  284. console.log(data);
  285. const {
  286. accountName,
  287. account,
  288. accountId
  289. } = data;
  290. if (!accountName && !account) {
  291. //没有填写交接人
  292. uni.showModal({
  293. title: '提示',
  294. content: "请填写交接人账号!",
  295. showCancel: false,
  296. success: function(res) {
  297. if (res.confirm) {
  298. console.log('用户点击确定');
  299. } else if (res.cancel) {
  300. console.log('用户点击取消');
  301. }
  302. }
  303. });
  304. return;
  305. } else if (!accountName && account || accountName && !account) {
  306. //没有填写交接人
  307. uni.showModal({
  308. title: '提示',
  309. content: "请填写正确的交接人账号!",
  310. showCancel: false,
  311. success: function(res) {
  312. if (res.confirm) {
  313. console.log('用户点击确定');
  314. } else if (res.cancel) {
  315. console.log('用户点击取消');
  316. }
  317. }
  318. });
  319. return;
  320. }
  321. this.hosModels.disjunctor = false;
  322. let associationTypeValue = this.currentData.taskType.associationType.value;
  323. console.log(associationTypeValue)
  324. if (
  325. associationTypeValue !== "patientTransport" &&
  326. associationTypeValue !== "inspect" &&
  327. associationTypeValue !== "other"
  328. ) {
  329. this.nextDeptOrder_s(this.currentData, data);
  330. }
  331. if (
  332. associationTypeValue !== "jPBag" &&
  333. associationTypeValue !== "drugsBag" &&
  334. associationTypeValue !== "specimen" &&
  335. associationTypeValue !== "specimenPlan"
  336. ) {
  337. this.nextDeptOrder_ss(this.currentData, data);
  338. }
  339. },
  340. // 填写交接人账号-取消
  341. hosCancel() {
  342. this.hosModels.disjunctor = false;
  343. },
  344. // 填写交接人账号弹窗
  345. showSelectAccount() {
  346. this.hosModels = {
  347. title: '填写交接人账号',
  348. disjunctor: true,
  349. }
  350. },
  351. },
  352. components: {
  353. selectAccount
  354. },
  355. onShow(){
  356. this.SMFlag = true;
  357. }
  358. };
  359. </script>
  360. <style lang="less">
  361. .smallScreen {
  362. width: 100%;
  363. height: 100%;
  364. .smallScreen_scan {
  365. width: 100%;
  366. height: 100%;
  367. }
  368. }
  369. </style>