sendBackPatient.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <view class="Scanning_Result">
  3. <view class="Scanning_top">
  4. 患者总数量:<text class="green">{{patientList.length}}</text>
  5. </view>
  6. <view class="Scanning_cont">
  7. <scroll-view scroll-y class="scrollContent">
  8. <view class="column" v-for="(item, index) in patientList" :key="item.id">
  9. <view class="top">
  10. <view class="name">姓名:</view>
  11. <view class="value">{{item.patientName}}</view>
  12. <text class="orders green">{{index + 1}}</text>
  13. </view>
  14. <view class="bottom">
  15. <view class="name">住院号:</view>
  16. <view class="value">{{item.residenceNo}}</view>
  17. </view>
  18. </view>
  19. </scroll-view>
  20. </view>
  21. <view class="foot_btn_spe">
  22. <view class="column">
  23. <view class="btn" @click="scan()">扫一扫</view>
  24. <view class="btn" @click="hand_again()">手动录入</view>
  25. </view>
  26. <view class="column" v-if="patientList.length">
  27. <view class="btn" @click="scanDept()">建单</view>
  28. </view>
  29. </view>
  30. <!-- 手动查询患者弹窗 -->
  31. <handViewPatient v-if="patientModels.disjunctor" :title="patientModels.title"
  32. :disjunctor="patientModels.disjunctor" @ok="patientOk" @cancel="patientCancel">
  33. </handViewPatient>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. get,
  39. post,
  40. SM,
  41. webHandle
  42. } from "@/http/http.js";
  43. export default {
  44. data() {
  45. return {
  46. hosId: uni.getStorageSync("userData").user.currentHospital.id,
  47. patientList: [],//患者列表
  48. queryObj: {}, //路由传递过来的数据
  49. scanCount: '', //已扫描数量
  50. SMFlag: true,
  51. // 手动查询弹窗model
  52. patientModels: {
  53. disjunctor: false,
  54. },
  55. };
  56. },
  57. onShow() {
  58. this.SMFlag = true;
  59. },
  60. methods: {
  61. // 送回病房-扫描科室
  62. scanDept() {
  63. if (!this.SMFlag) {
  64. return;
  65. }
  66. this.SMFlag = false;
  67. let code = "";
  68. SM().then((ress1) => {
  69. uni.showLoading({
  70. title: "加载中",
  71. mask: true,
  72. });
  73. //检验二维码的有效性
  74. post("/dept/scanning", {
  75. content: ress1,
  76. }).then((result) => {
  77. this.SMFlag = true;
  78. if (result.state == 200 || result.state == 201) {
  79. let ress = result.code;
  80. if (ress) {
  81. code = ress;
  82. // 科室扫描
  83. let postData = {
  84. "type": "query",
  85. "qrCode": code
  86. };
  87. post("/dept/scanChangeDept", postData).then((res) => {
  88. uni.hideLoading();
  89. if (res.status == 200) {
  90. if (res.data) {
  91. if(res.data.deptDTO){
  92. this.currentStartDept = res.data.deptDTO;
  93. }else{
  94. this.currentStartDept = res.data;
  95. }
  96. this.buildOrder();
  97. } else {
  98. uni.hideLoading();
  99. uni.showToast({
  100. icon: "none",
  101. title: "请扫描正确的科室码!",
  102. });
  103. }
  104. } else {
  105. uni.hideLoading();
  106. uni.showToast({
  107. icon: "none",
  108. title: res.msg || "接口获取数据失败!",
  109. });
  110. }
  111. });
  112. }
  113. } else {
  114. uni.hideLoading();
  115. uni.showToast({
  116. icon: "none",
  117. title: result.info || "接口获取数据失败!",
  118. });
  119. }
  120. });
  121. }).catch(err => {
  122. this.SMFlag = true;
  123. });
  124. },
  125. // 手动查询-确认
  126. patientOk(data) {
  127. console.log(data);
  128. if (!data.id) {
  129. //没有查询到患者
  130. uni.showModal({
  131. title: '提示',
  132. content: "没有查询到患者!",
  133. showCancel: false,
  134. success: function(res) {
  135. if (res.confirm) {
  136. console.log('用户点击确定');
  137. } else if (res.cancel) {
  138. console.log('用户点击取消');
  139. }
  140. }
  141. });
  142. return;
  143. }
  144. this.patientModels.disjunctor = false;
  145. this.hand_scanning_common(data.residenceNo, 'hand');
  146. },
  147. // 手动查询-取消
  148. patientCancel() {
  149. this.patientModels.disjunctor = false;
  150. },
  151. // 手动查询弹窗
  152. showHandViewDrugsbag() {
  153. this.patientModels = {
  154. title: '填写患者住院号',
  155. disjunctor: true,
  156. }
  157. },
  158. // 手动录入
  159. hand_again() {
  160. this.showHandViewDrugsbag();
  161. },
  162. // 核对交接
  163. buildOrder(){
  164. uni.showModal({
  165. title: "提示",
  166. content: "您确定建单吗?",
  167. success: (res) => {
  168. if (res.confirm) {
  169. console.log("用户点击确定");
  170. uni.showLoading({
  171. mask: true,
  172. title: '加载中'
  173. })
  174. let userId = uni.getStorageSync("userData").user.id;
  175. let postData = {
  176. "workOrder": [],
  177. };
  178. console.log(this.patientList);
  179. this.patientList.forEach(v => {
  180. postData.workOrder.push({
  181. sourceId: 4,
  182. "hosId": this.hosId,
  183. "startDept": {
  184. "id": this.currentStartDept.id
  185. },
  186. "createDept": this.currentStartDept.id,
  187. "patient": {
  188. "patientCode": v.patientCode
  189. },
  190. "worker": {
  191. "id": userId
  192. },
  193. })
  194. })
  195. post("/workerOrder/returnSickRoom", postData).then((res) => {
  196. console.log(res)
  197. uni.hideLoading();
  198. if (res.status == 200) {
  199. uni.showToast({
  200. icon: 'success',
  201. title: '建单成功',
  202. duration: 2000,
  203. mask: true,
  204. });
  205. setTimeout(() => {
  206. uni.navigateTo({
  207. url: `/pages/receiptpage/receiptpage`,
  208. });
  209. }, 2000)
  210. } else {
  211. uni.showToast({
  212. icon: "none",
  213. title: res.msg || "接口获取数据失败!",
  214. });
  215. }
  216. })
  217. } else if (res.cancel) {
  218. console.log("用户点击取消");
  219. }
  220. },
  221. });
  222. },
  223. // 扫一扫
  224. scan(isFlag = false) {
  225. if (!this.SMFlag) {
  226. return;
  227. }
  228. this.SMFlag = false;
  229. SM().then((ress1) => {
  230. this.hand_scanning_common(ress1, 'scan', isFlag);
  231. }).catch(err => {
  232. this.SMFlag = true;
  233. });
  234. },
  235. // 手动输入和扫码公共方法
  236. hand_scanning_common(ress1, type, isFlag = false) {
  237. // ----------------
  238. uni.showLoading({
  239. title: "加载中",
  240. mask: true,
  241. });
  242. //检验二维码的有效性
  243. post("/dept/scanning", {
  244. content: ress1,
  245. }).then((result) => {
  246. this.SMFlag = true;
  247. if (result.state == 200 || result.state == 201) {
  248. let codes = result.code;
  249. if (codes) {
  250. this.input_common(ress1, type, isFlag);
  251. } else {
  252. uni.hideLoading();
  253. }
  254. } else {
  255. uni.hideLoading();
  256. uni.showToast({
  257. icon: "none",
  258. title: result.info || "接口获取数据失败!",
  259. });
  260. }
  261. });
  262. // ------------------------------
  263. },
  264. // 将患者添加到患者列表
  265. input_common(ress1, type, isFlag = false){
  266. uni.showLoading({
  267. title: "加载中",
  268. mask: true,
  269. });
  270. post("/patient/patientByCode ", { code: ress1 }).then((ress) => {
  271. uni.hideLoading();
  272. if (ress.status == 200) {
  273. let flag = this.patientList.find(v => v.id == ress.data.id);
  274. if(flag){
  275. uni.showToast({
  276. icon: "none",
  277. title: "患者已存在!",
  278. });
  279. }else{
  280. this.patientList.unshift(ress.data);
  281. uni.showToast({
  282. icon: "none",
  283. title: "添加患者成功!",
  284. });
  285. }
  286. } else {
  287. uni.showToast({
  288. icon: "none",
  289. title: ress.msg || "接口获取数据失败!",
  290. });
  291. }
  292. });
  293. },
  294. },
  295. onLoad(options) {
  296. console.log(options, "options");
  297. this.queryObj = options;
  298. this.patientList = [{id: options.patientId, patientName: options.patientName, residenceNo: options.patientResidenceNo, patientCode: options.patientCode}]
  299. // #ifdef APP-PLUS
  300. webHandle("no", "app");
  301. // #endif
  302. // #ifdef H5
  303. webHandle("no", "wx");
  304. // #endif
  305. },
  306. };
  307. </script>
  308. <style lang="less" scoped>
  309. .green{
  310. color:#49b856;
  311. }
  312. .Scanning_Result {
  313. background: #EBEBEB;
  314. display: flex;
  315. flex-direction: column;
  316. height: 100vh;
  317. .Scanning_top {
  318. display: flex;
  319. justify-content: center;
  320. align-items: center;
  321. height: 63rpx;
  322. font-size: 28rpx;
  323. font-weight: bold;
  324. background-color: #fff;
  325. margin-top: 16rpx;
  326. }
  327. .Scanning_cont {
  328. flex: 1;
  329. min-height: 0;
  330. display: flex;
  331. flex-direction: column;
  332. .scrollContent{
  333. flex: 1;
  334. min-height: 0;
  335. }
  336. .column{
  337. padding: 24rpx 64rpx;
  338. font-size: 26rpx;
  339. margin-top: 16rpx;
  340. background-color: #fff;
  341. .top,.bottom{
  342. height: 50%;
  343. display: flex;
  344. align-items: center;
  345. .name{
  346. }
  347. .value{
  348. flex: 1;
  349. }
  350. }
  351. .top{
  352. position: relative;
  353. .orders{
  354. width: 64rpx;
  355. text-align: center;
  356. position: absolute;
  357. left: -64rpx;
  358. top: 50%;
  359. transform: translateY(-50%);
  360. font-size: 28rpx;
  361. font-weight: bold;
  362. }
  363. }
  364. .bottom{
  365. margin-top: 16rpx;
  366. }
  367. }
  368. }
  369. .foot_btn_spe {
  370. display: flex;
  371. flex-direction: column;
  372. align-items: center;
  373. gap: 24rpx;
  374. font-weight: bold;
  375. padding: 24rpx;
  376. .column{
  377. width: 100%;
  378. height: 78rpx;
  379. display: flex;
  380. align-items: center;
  381. justify-content: space-between;
  382. gap: 24rpx;
  383. .btn {
  384. height: 100%;
  385. flex: 1;
  386. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  387. color: #fff;
  388. border-radius: 4rpx;
  389. font-size: 30rpx;
  390. display: flex;
  391. justify-content: center;
  392. align-items: center;
  393. }
  394. }
  395. }
  396. }
  397. </style>