sendBackPatient.vue 12 KB

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