smallScreen.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <template>
  2. <view class="smallScreen">
  3. <view class="smallScreen_scan" @click="getInspectAndPatientTransform(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. <!-- 弹窗 -->
  11. <showModel :title="models4.title" :icon="models4.icon" :disjunctor="models4.disjunctor"
  12. :radioInspectionDistanceItem="models4.radioInspectionDistanceItem" @ok="ok4" @cancel="cancel4" @radioChange="radioChange4" :operate="models4.operate">
  13. </showModel>
  14. </view>
  15. </template>
  16. <script>
  17. import showModel from "../../components/showModel/showModel.vue";
  18. import selectAccount from "../../components/selectAccount/selectAccount.vue";
  19. import {
  20. post,
  21. SM
  22. } from "../../http/http.js";
  23. export default {
  24. data() {
  25. return {
  26. selectRadio: [], //单选框选中的数据,第一项是qrcode,第二项是名称
  27. // 单选框弹窗model1
  28. models4: {
  29. disjunctor: false,
  30. },
  31. hosId: uni.getStorageSync("userData").user.currentHospital.id,
  32. currentCode: '', //当前小扫描的科室二维码
  33. currentData: {}, //当前小扫描的工单对象
  34. // 填写交接人账号弹窗model
  35. hosModels: {
  36. disjunctor: false,
  37. },
  38. SMFlag:true,
  39. }
  40. },
  41. props: {
  42. sData: {
  43. type: Object
  44. },
  45. sType: {
  46. type: Number
  47. }
  48. },
  49. methods: {
  50. // 获取是否需要选择陪检方式
  51. getInspectAndPatientTransform(sData,sType){
  52. console.log(this.sData,this.sType);
  53. // 患者陪检,患者其他服务,工单状态是待到达
  54. if((this.sData.taskType.associationType.value === 'inspect' || this.sData.taskType.associationType.value === 'patientTransport') && this.sData.gdState.value == 4){
  55. const postData = {
  56. "idx":0,
  57. "sum":1,
  58. "taskTypeConfig":{
  59. "taskTypeDTO":{
  60. "hosId": {"id": this.hosId},
  61. "associationType": {
  62. "key": "association_types",
  63. "value":"inspect",
  64. },
  65. },
  66. },
  67. };
  68. uni.showLoading({
  69. mask: true,
  70. title: '加载中'
  71. })
  72. post("/simple/data/fetchDataList/taskTypeConfig", postData).then((res) => {
  73. console.log(res)
  74. if (res.status == 200) {
  75. res.list = res.list || [];
  76. if(res.list[0].signTypeIds){
  77. // 如果开启
  78. const postData = {
  79. "idx":0,
  80. "sum":9999,
  81. "workOrderInspectScore":{
  82. "hosId": this.hosId,
  83. },
  84. };
  85. post("/simple/data/fetchDataList/workOrderInspectScore", postData).then((res) => {
  86. console.log(res)
  87. uni.hideLoading();
  88. if (res.status == 200) {
  89. res.list = res.list || [];
  90. let radioInspectionDistanceItem = res.list.map(v => ({id: v.id + "__" + v.inspectMode, inspectMode: v.inspectMode}));
  91. console.log(radioInspectionDistanceItem)
  92. this.models4 = {
  93. disjunctor: true,
  94. title: "请选择陪检方式",
  95. radioInspectionDistanceItem,
  96. icon: "",
  97. operate: {
  98. ok: "确定",
  99. cancel: "取消",
  100. },
  101. };
  102. } else {
  103. uni.showToast({
  104. icon: "none",
  105. title: "请求失败!",
  106. });
  107. }
  108. })
  109. }else{
  110. this.Scan_ss(sData,sType);
  111. }
  112. } else {
  113. uni.hideLoading();
  114. uni.showToast({
  115. icon: "none",
  116. title: "请求失败!",
  117. });
  118. }
  119. })
  120. }else{
  121. this.Scan_ss(sData,sType);
  122. }
  123. },
  124. // 选中单选框
  125. radioChange4(item) {
  126. console.log(item);
  127. this.selectRadio = item.split("__");
  128. },
  129. // 确定
  130. ok4() {
  131. console.log(this.selectRadio);
  132. if (!this.selectRadio.length) {
  133. return;
  134. }
  135. this.models4.disjunctor = false;
  136. this.Scan_ss(this.sData,this.sType);
  137. },
  138. cancel4() {
  139. this.models4.disjunctor = false;
  140. },
  141. // 如果不是静配,药配,标本配送,标本轮巡
  142. // 科室签到(小扫描)
  143. nextDeptOrder_ss(data, accountObj) {
  144. console.log(this.currentCode);
  145. let isKs = 0;
  146. let ids = [];
  147. let id = data.id;
  148. ids.push(id);
  149. let list = {
  150. code: "",
  151. ids: ids,
  152. };
  153. let code = "";
  154. let type = "";
  155. if (this.currentCode) {
  156. let gdStateValue = data.gdState.value; //工单状态value
  157. let associationTypeValue = data.taskType.associationType.value; //关联类型value
  158. // 患者陪检,并且工单状态是待到达
  159. if (
  160. gdStateValue == "4" &&
  161. associationTypeValue == "inspect"
  162. ) {
  163. list.code = this.currentCode; //其他
  164. type = "handleIns";
  165. }
  166. // 其他临床服务,并且工单状态是待到达||工单状态待送达
  167. if (
  168. (associationTypeValue == "other" &&
  169. gdStateValue == "4") ||
  170. gdStateValue == "5"
  171. ) {
  172. code = this.currentCode;
  173. type = "orderSign/" + code;
  174. list = {
  175. ids
  176. };
  177. if (accountObj) {
  178. list.handover = [accountObj.accountId];
  179. }
  180. isKs = 1;
  181. }
  182. if (
  183. (gdStateValue == "5" &&
  184. associationTypeValue == "inspect") ||
  185. associationTypeValue == "patientTransport"
  186. ) {
  187. code = this.currentCode;
  188. type = "orderSign/" + code;
  189. list = {
  190. ids
  191. };
  192. if (accountObj) {
  193. list.handover = [accountObj.accountId];
  194. }
  195. isKs = 1;
  196. }
  197. if (gdStateValue == "8") {
  198. code = this.currentCode; //患者陪检--检查
  199. type = "orderSign/" + code;
  200. list = {
  201. ids
  202. };
  203. if (accountObj) {
  204. list.handover = [accountObj.accountId];
  205. }
  206. isKs = 1;
  207. }
  208. if (
  209. gdStateValue == "4" &&
  210. associationTypeValue == "patientTransport"
  211. ) {
  212. list = {
  213. code: this.currentCode, //患者转运--检查
  214. ids: ids,
  215. };
  216. type = "handleTrans";
  217. }
  218. if(gdStateValue == "4" && (associationTypeValue == "inspect" || associationTypeValue == "patientTransport")){
  219. console.log(this.selectRadio)
  220. list.inspectMode = this.selectRadio.length > 0 ? this.selectRadio[0] : undefined;
  221. }
  222. post("/workerOrder/" + type, list).then((res) => {
  223. uni.hideLoading();
  224. if (res) {
  225. if (res.status == 200) {
  226. if (
  227. gdStateValue == "4" &&
  228. associationTypeValue == "other"
  229. ) {
  230. uni.navigateTo({
  231. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  232. });
  233. }
  234. if (
  235. gdStateValue == "4" &&
  236. associationTypeValue != "other"
  237. ) {
  238. uni.navigateTo({
  239. url: `../../pages/scanning_Result/scanning_Result?type=${
  240. associationTypeValue
  241. }&type1=${res.type}&id=${data.id}&deptCode=${
  242. list.code
  243. }&patient=${res.patient}&patientCode=${
  244. res.patientCode
  245. }&deptName=${res.deptName}&bedNum=${
  246. res.bedNum
  247. }&status=${res.status}&msg=${
  248. res.msg
  249. }&model=${encodeURIComponent(JSON.stringify(res))}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  250. });
  251. }
  252. if (gdStateValue == "8") {
  253. uni.navigateTo({
  254. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  255. });
  256. }
  257. if (gdStateValue == "5") {
  258. uni.navigateTo({
  259. url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
  260. });
  261. }
  262. } else {
  263. console.log(res, "扫描失败");
  264. if (res.type == "trans-ddd-1") {
  265. //起点科室扫描腕带码失败
  266. uni.navigateTo({
  267. url: `../../pages/scanning_Result/scanning_Result?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&status=600&msg=${res.msg}&qrcode=${this.currentCode}`,
  268. });
  269. } else {
  270. uni.navigateTo({
  271. url: `../../pages/scanning_Result/scanning_Result?type=${
  272. associationTypeValue
  273. }&type1=${res.type}&id=${data.id}&status=600&msg=${
  274. res.msg
  275. }&isKs=${isKs}&model=${encodeURIComponent(
  276. JSON.stringify(res)
  277. )}&qrcode=${this.currentCode}`,
  278. });
  279. }
  280. }
  281. } else {
  282. uni.navigateTo({
  283. url: `../../pages/scanning_Result/scanning_Result?id=${data.id}&status=600&msg=扫码失败!请扫描正确的二维码!&isKs=${isKs}&qrcode=${this.currentCode}`,
  284. });
  285. }
  286. });
  287. }
  288. },
  289. // 如果不是患者陪检或患者转运或其他
  290. // 科室签到
  291. nextDeptOrder_s(data, accountObj) {
  292. console.log(this.currentCode);
  293. let ids = [];
  294. let id = data.id;
  295. ids.push(id);
  296. let code = "";
  297. let postData = {
  298. ids
  299. };
  300. if (accountObj) {
  301. postData.handover = [accountObj.accountId];
  302. }
  303. if (this.currentCode) {
  304. code = this.currentCode;
  305. // 科室签到
  306. post("/workerOrder/orderSign/" + code, postData).then((res) => {
  307. uni.hideLoading();
  308. if (res.status == 200) {
  309. // 跳转到扫描科室
  310. // type1: res.type, //type类型
  311. // id: data.id, //工单ID
  312. // deptCode: code, //二维码
  313. // dept: res.dept //科室名称
  314. console.log(data,'工单')
  315. let endDepts = data.endDepts.map(v=>v.id).toString();
  316. console.log(endDepts,'smallScreen');
  317. uni.navigateTo({
  318. 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}`,
  319. });
  320. } else {
  321. uni.navigateTo({
  322. 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}`,
  323. });
  324. }
  325. });
  326. }
  327. },
  328. // type==1 如果不是静配,药配,标本配送,标本轮巡
  329. // type==2 如果不是患者陪检,患者转运,其他
  330. // 扫码(小扫描)
  331. Scan_ss(data, type) {
  332. if (!this.SMFlag) {
  333. return;
  334. }
  335. this.SMFlag = false;
  336. this.currentData = data;
  337. console.log(data, 'data');
  338. SM().then((ress1) => {
  339. uni.showLoading({
  340. title: "加载中",
  341. mask: true,
  342. });
  343. //检验二维码的有效性
  344. post("/dept/scanning", {
  345. content: ress1,
  346. taskTypeId: data.taskType.id,
  347. gdState: data.gdState.id,
  348. }).then((result) => {
  349. this.SMFlag = true;
  350. this.currentCode = result.code;
  351. if (result.state == 200 || result.state == 201) {
  352. if (result.account) {
  353. if (type == 1) {
  354. this.nextDeptOrder_ss(this.currentData, {
  355. account: result.account,
  356. accountName: result.name,
  357. accountId: result.id,
  358. });
  359. } else if (type == 2) {
  360. this.nextDeptOrder_s(this.currentData, {
  361. account: result.account,
  362. accountName: result.name,
  363. accountId: result.id,
  364. });
  365. }
  366. } else {
  367. if (type == 1) {
  368. this.nextDeptOrder_ss(this.currentData);
  369. } else if (type == 2) {
  370. this.nextDeptOrder_s(this.currentData);
  371. }
  372. }
  373. } else if (result.state == '0000') {
  374. uni.hideLoading();
  375. this.showSelectAccount(); //yeye
  376. } else {
  377. uni.hideLoading();
  378. uni.showToast({
  379. icon: "none",
  380. title: "请求失败!",
  381. });
  382. }
  383. });
  384. }).catch(err=>{
  385. this.SMFlag = true;
  386. });
  387. },
  388. // 填写交接人账号-确认
  389. hosOk(data) {
  390. console.log(data);
  391. const {
  392. accountName,
  393. account,
  394. accountId
  395. } = data;
  396. if (!accountName && !account) {
  397. //没有填写交接人
  398. uni.showModal({
  399. title: '提示',
  400. content: "请填写交接人账号!",
  401. showCancel: false,
  402. success: function(res) {
  403. if (res.confirm) {
  404. console.log('用户点击确定');
  405. } else if (res.cancel) {
  406. console.log('用户点击取消');
  407. }
  408. }
  409. });
  410. return;
  411. } else if (!accountName && account || accountName && !account) {
  412. //没有填写交接人
  413. uni.showModal({
  414. title: '提示',
  415. content: "请填写正确的交接人账号!",
  416. showCancel: false,
  417. success: function(res) {
  418. if (res.confirm) {
  419. console.log('用户点击确定');
  420. } else if (res.cancel) {
  421. console.log('用户点击取消');
  422. }
  423. }
  424. });
  425. return;
  426. }
  427. this.hosModels.disjunctor = false;
  428. let associationTypeValue = this.currentData.taskType.associationType.value;
  429. console.log(associationTypeValue)
  430. if (
  431. associationTypeValue !== "patientTransport" &&
  432. associationTypeValue !== "inspect" &&
  433. associationTypeValue !== "other"
  434. ) {
  435. this.nextDeptOrder_s(this.currentData, data);
  436. }
  437. if (
  438. associationTypeValue !== "jPBag" &&
  439. associationTypeValue !== "drugsBag" &&
  440. associationTypeValue !== "specimen" &&
  441. associationTypeValue !== "specimenPlan"
  442. ) {
  443. this.nextDeptOrder_ss(this.currentData, data);
  444. }
  445. },
  446. // 填写交接人账号-取消
  447. hosCancel() {
  448. this.hosModels.disjunctor = false;
  449. },
  450. // 填写交接人账号弹窗
  451. showSelectAccount() {
  452. this.hosModels = {
  453. title: '填写交接人账号',
  454. disjunctor: true,
  455. }
  456. },
  457. },
  458. components: {
  459. selectAccount
  460. },
  461. onShow(){
  462. this.SMFlag = true;
  463. },
  464. };
  465. </script>
  466. <style lang="less">
  467. .smallScreen {
  468. width: 100%;
  469. height: 100%;
  470. .smallScreen_scan {
  471. width: 100%;
  472. height: 100%;
  473. }
  474. }
  475. </style>