sendBackPatient.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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. <text class="orders green">{{index + 1}}</text>
  11. <view class="name">姓名:</view>
  12. <view class="value">{{item.patientName}}</view>
  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. this.patientList.forEach(v => {
  179. postData.workOrder.push({
  180. sourceId: 4,
  181. "hosId": this.hosId,
  182. "startDept": {
  183. "id": this.currentStartDept.id
  184. },
  185. "createDept": this.currentStartDept.id,
  186. "patient": {
  187. "patientCode": v.patientCode
  188. },
  189. "worker": {
  190. "id": userId
  191. },
  192. })
  193. })
  194. post("/workerOrder/returnSickRoom", postData).then((res) => {
  195. console.log(res)
  196. uni.hideLoading();
  197. if (res.status == 200) {
  198. uni.showToast({
  199. icon: 'success',
  200. title: '建单成功',
  201. duration: 2000,
  202. mask: true,
  203. });
  204. setTimeout(() => {
  205. uni.navigateTo({
  206. url: `/pages/receiptpage/receiptpage`,
  207. });
  208. }, 2000)
  209. } else {
  210. uni.showToast({
  211. icon: "none",
  212. title: res.msg || "接口获取数据失败!",
  213. });
  214. }
  215. })
  216. } else if (res.cancel) {
  217. console.log("用户点击取消");
  218. }
  219. },
  220. });
  221. },
  222. // 扫一扫
  223. scan(isFlag = false) {
  224. if (!this.SMFlag) {
  225. return;
  226. }
  227. this.SMFlag = false;
  228. SM().then((ress1) => {
  229. this.hand_scanning_common(ress1, 'scan', isFlag);
  230. }).catch(err => {
  231. this.SMFlag = true;
  232. });
  233. },
  234. // 手动输入和扫码公共方法
  235. hand_scanning_common(ress1, type, isFlag = false) {
  236. // ----------------
  237. uni.showLoading({
  238. title: "加载中",
  239. mask: true,
  240. });
  241. //检验二维码的有效性
  242. post("/dept/scanning", {
  243. content: ress1,
  244. }).then((result) => {
  245. this.SMFlag = true;
  246. if (result.state == 200 || result.state == 201) {
  247. let codes = result.code;
  248. if (codes) {
  249. this.input_common(ress1, type, isFlag);
  250. } else {
  251. uni.hideLoading();
  252. }
  253. } else {
  254. uni.hideLoading();
  255. uni.showToast({
  256. icon: "none",
  257. title: result.info || "接口获取数据失败!",
  258. });
  259. }
  260. });
  261. // ------------------------------
  262. },
  263. // 将患者添加到患者列表
  264. input_common(ress1, type, isFlag = false){
  265. uni.showLoading({
  266. title: "加载中",
  267. mask: true,
  268. });
  269. post("/patient/patientByCode ", { code: ress1 }).then((ress) => {
  270. uni.hideLoading();
  271. if (ress.status == 200) {
  272. let flag = this.patientList.find(v => v.id == ress.data.id);
  273. if(flag){
  274. uni.showToast({
  275. icon: "none",
  276. title: "患者已存在!",
  277. });
  278. }else{
  279. this.patientList.unshift(ress.data);
  280. uni.showToast({
  281. icon: "none",
  282. title: "添加患者成功!",
  283. });
  284. }
  285. } else {
  286. uni.showToast({
  287. icon: "none",
  288. title: ress.msg || "接口获取数据失败!",
  289. });
  290. }
  291. });
  292. },
  293. },
  294. onLoad(options) {
  295. console.log(options, "options");
  296. this.queryObj = options;
  297. this.patientList = [{id: options.patientId, patientName: options.patientName, residenceNo: options.patientResidenceNo, patientCode: options.patientCode}]
  298. // #ifdef APP-PLUS
  299. webHandle("no", "app");
  300. // #endif
  301. // #ifdef H5
  302. webHandle("no", "wx");
  303. // #endif
  304. },
  305. };
  306. </script>
  307. <style lang="less" scoped>
  308. .green{
  309. color:#49b856;
  310. }
  311. .Scanning_Result {
  312. background: #EBEBEB;
  313. display: flex;
  314. flex-direction: column;
  315. height: 100vh;
  316. .Scanning_top {
  317. display: flex;
  318. justify-content: center;
  319. align-items: center;
  320. height: 63rpx;
  321. font-size: 28rpx;
  322. font-weight: bold;
  323. background-color: #fff;
  324. margin-top: 16rpx;
  325. }
  326. .Scanning_cont {
  327. flex: 1;
  328. min-height: 0;
  329. display: flex;
  330. flex-direction: column;
  331. .scrollContent{
  332. flex: 1;
  333. min-height: 0;
  334. }
  335. .column{
  336. padding: 24rpx 44rpx;
  337. font-size: 26rpx;
  338. margin-top: 16rpx;
  339. background-color: #fff;
  340. .top,.bottom{
  341. height: 50%;
  342. display: flex;
  343. align-items: center;
  344. .name{
  345. }
  346. .value{
  347. flex: 1;
  348. }
  349. }
  350. .top{
  351. position: relative;
  352. /deep/ .uni-checkbox-input.uni-checkbox-input-checked{
  353. color: #fff !important;
  354. background: #49b856 !important;
  355. border-color: #49b856 !important;
  356. }
  357. .orders{
  358. width: 54rpx;
  359. text-align: center;
  360. // position: absolute;
  361. // left: -64rpx;
  362. // top: 50%;
  363. // transform: translateY(-50%);
  364. font-size: 28rpx;
  365. font-weight: bold;
  366. }
  367. }
  368. .bottom{
  369. margin-top: 16rpx;
  370. }
  371. }
  372. }
  373. .foot_btn_spe {
  374. display: flex;
  375. flex-direction: column;
  376. align-items: center;
  377. gap: 24rpx;
  378. font-weight: bold;
  379. padding: 24rpx;
  380. .column{
  381. width: 100%;
  382. height: 78rpx;
  383. display: flex;
  384. align-items: center;
  385. justify-content: space-between;
  386. gap: 24rpx;
  387. .btn {
  388. height: 100%;
  389. flex: 1;
  390. background: linear-gradient( 90deg, #6FC073 0%, #3DB197 100%);
  391. color: #fff;
  392. border-radius: 4rpx;
  393. font-size: 30rpx;
  394. display: flex;
  395. justify-content: center;
  396. align-items: center;
  397. }
  398. }
  399. }
  400. }
  401. </style>