patientBuild.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <view class="patientBuild">
  3. <view class="qco_msg" v-html="patientMsg"></view>
  4. <view class="select_block_wrap">
  5. <view class="uni-list">
  6. <checkbox-group @change="checkboxChange">
  7. <label class="select_block" v-for="good in goods" :key="good.value">
  8. <checkbox color="#09BB07" :value="good.value" :checked="good.checked" />
  9. <view>{{good.name}}</view>
  10. </label>
  11. </checkbox-group>
  12. </view>
  13. </view>
  14. <!-- 加急 -->
  15. <view class="remarks" v-if="patientTaskType.allowUrgent == 1">
  16. <view class="remarks_nav">
  17. 是否加急
  18. </view>
  19. <view class="remarks_btn">
  20. <text class="remarks_btn_name">加急</text>
  21. <switch class="remarks_btn_value" color="#09BB07" :checked="isUrgent" @change="switchChange" />
  22. </view>
  23. <textarea v-if="isUrgent" class="remarks_textarea" auto-height :maxlength="100" placeholder-style="color:#999;"
  24. placeholder="请填写加急原因" v-model.trim="urgentRemark" :adjust-position="false" />
  25. <view class="remarks_tips" v-if="isYYBuild">
  26. <view class="tips">系统支持提前预约送检服务,您是否需要!</view>
  27. <view class="tips">我不需要预约,希望送检人员立即上门,点击立即建单;</view>
  28. <view class="tips">我需要提前预约送检服务,点击预约建单;</view>
  29. </view>
  30. </view>
  31. <!-- 底部 -->
  32. <seiminFooterBtn :btns="btns"></seiminFooterBtn>
  33. <seiminModel ref="seiminModel" :otherData="{timestamp,date,time}"></seiminModel>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. backPress
  39. } from '../../utils/index.js';
  40. import cloneDeep from 'lodash/cloneDeep';
  41. import {
  42. mapState,
  43. mapMutations,
  44. } from "vuex";
  45. import {
  46. ASSOCIATION_TYPES
  47. } from "../../utils/enum.association_types.js";
  48. export default {
  49. onBackPress() {
  50. backPress();
  51. },
  52. data() {
  53. return {
  54. reFresh: '',
  55. ASSOCIATION_TYPES,
  56. // 时间戳
  57. timestamp: new Date().getTime(),
  58. // 预约日期
  59. date: false,
  60. // 预约时间
  61. time: false,
  62. // 预约建单按钮是否显示
  63. isYYBuild: false,
  64. // 有预约时间并且是选中的
  65. hasYYtimeChecks: [],
  66. // 是否加急
  67. isUrgent: false,
  68. // 设备
  69. goods: [],
  70. //患者建单信息展示
  71. patientMsg: '',
  72. // 传递过来的参数
  73. queryParams: {},
  74. // 加急原因
  75. urgentRemark: "",
  76. //底部按钮
  77. btns: [],
  78. };
  79. },
  80. computed: {
  81. ...mapState('other', [
  82. 'patientBuildTrip',
  83. 'patientTaskType',
  84. 'selectedPatient',
  85. 'patientBuildData',
  86. ]),
  87. },
  88. methods: {
  89. ...mapMutations('other', ['changePatientBuildData']),
  90. // 切换是否加急
  91. switchChange(e) {
  92. this.isUrgent = e.detail.value;
  93. this.urgentRemark = '';
  94. // this.isYYBuild = !this.isUrgent;
  95. this.showBtns(!this.isUrgent);
  96. },
  97. // 选择设备
  98. checkboxChange: function(e) {
  99. console.log(e, this.goods);
  100. var goods = this.goods,
  101. values = e.detail.value;
  102. for (var i = 0, lenI = goods.length; i < lenI; ++i) {
  103. const item = goods[i]
  104. if (values.includes(item.value)) {
  105. this.$set(item, 'checked', true)
  106. } else {
  107. this.$set(item, 'checked', false)
  108. }
  109. }
  110. },
  111. // 立即建单,isYY 是否预约建单
  112. buildOrder(isYY = false) {
  113. console.log(this.urgentRemark)
  114. console.log(this.isUrgent)
  115. console.log(this.goods)
  116. // 加急原因非空
  117. if (this.isUrgent && !this.urgentRemark) {
  118. this.$refs.seiminModel.show({
  119. skin: 'toast',
  120. icon: 'warn',
  121. content: '请填写加急原因',
  122. })
  123. return;
  124. }
  125. // 存储建单数据
  126. // 设备
  127. this.changePatientBuildData({
  128. key: 'goods',
  129. value: this.goods.filter(v => v.checked)
  130. })
  131. // 加急
  132. this.changePatientBuildData({
  133. key: 'urgent',
  134. value: {
  135. isUrgent: this.isUrgent,
  136. urgentRemark: this.urgentRemark,
  137. }
  138. })
  139. // 预约时间
  140. this.changePatientBuildData({
  141. key: 'yyTime',
  142. value: isYY ? `${this.$refs.seiminModel.dateVal} ${this.$refs.seiminModel.timeVal}:00` : ''
  143. })
  144. // 是否预约建单
  145. this.changePatientBuildData({
  146. key: 'isYY',
  147. value: isYY
  148. })
  149. // 跳转
  150. uni.navigateTo({
  151. url: '/pages/patientBuildConfirm/patientBuildConfirm'
  152. })
  153. },
  154. // 需要预约建单-事件
  155. yyInspectChange() {
  156. if (this.patientTaskType.associationType.value === this.ASSOCIATION_TYPES['患者陪检业务']) {
  157. //陪检
  158. let obj = this.hasYYtimeChecks.find((item) => {
  159. return (
  160. new Date(item.yyTime).getTime() - new Date().getTime() > 0
  161. );
  162. });
  163. if (obj) {
  164. this.showDateTime();
  165. } else {
  166. this.date = true;
  167. this.time = false;
  168. this.timestamp = new Date().getTime();
  169. }
  170. } else {
  171. //转运
  172. this.date = true;
  173. this.time = false;
  174. this.timestamp = new Date().getTime();
  175. }
  176. },
  177. // 是否加急
  178. allowUrgentChange(isUrgent) {
  179. console.log(isUrgent, this.isYYBuild)
  180. if (this.isYYBuild) {
  181. this.isYYBuild = !isUrgent;
  182. if (!this.isYYBuild) {
  183. this.date = false;
  184. this.time = false;
  185. this.timestamp = new Date().getTime();
  186. }
  187. } else {
  188. this.date = false;
  189. this.time = false;
  190. this.timestamp = new Date().getTime();
  191. }
  192. },
  193. //回显时间日期
  194. showDateTime() {
  195. //当前时间要大于生效时间
  196. let isYYBuild = this.hasYYtimeChecks.every((item) => {
  197. return (
  198. new Date(item.yyTime).getTime() - new Date().getTime() > 0
  199. );
  200. });
  201. //如果勾选需要预约检查
  202. if (isYYBuild) {
  203. //筛选离当前时间最近的
  204. let timeList = this.hasYYtimeChecks
  205. .map((item) => new Date(item.yyTime).getTime())
  206. .sort();
  207. this.date = true;
  208. this.time = true;
  209. this.timestamp = new Date(timeList[0] - 0);
  210. } else {
  211. this.date = false;
  212. this.time = false;
  213. this.timestamp = new Date().getTime();
  214. }
  215. },
  216. // 初始化
  217. init() {
  218. // 提示文字
  219. this.patientMsg = `患者<b class="green">${this.selectedPatient.patientName}</b>即将出科,请您选择送检人员需携带哪些设备!`;
  220. let goods = this.patientBuildTrip.goods ? cloneDeep(this.patientBuildTrip.goods) : []; // 设备
  221. let checks = this.patientBuildData.checks ? cloneDeep(this.patientBuildData.checks) : []; // 检查
  222. this.goods = goods;
  223. // 患者陪检业务和患者其他服务业务相关处理
  224. this.hasYYtimeChecks = checks.filter((v) => Boolean(v.yyTime));
  225. let isPriority = checks.some(v => v.priority == 1);
  226. // 检查有紧急度,则加急
  227. if (isPriority) {
  228. this.isUrgent = true;
  229. this.urgentRemark = '系统根据检查信息,自动进行加急';
  230. } else {
  231. this.isUrgent = false;
  232. this.urgentRemark = '';
  233. }
  234. //判断预约建单按钮
  235. console.log(this.patientBuildTrip)
  236. if (
  237. (this.patientTaskType.associationType.value === this.ASSOCIATION_TYPES['患者陪检业务'] &&
  238. checks.length && this.patientTaskType.appointmentSwitch == 1) ||
  239. (this.patientTaskType.associationType.value === this.ASSOCIATION_TYPES['患者其他服务业务'] &&
  240. this.patientTaskType.appointmentOtherSwitch == 1)
  241. ) {
  242. //选中的检查数组都有预约时间并且允许预约建单
  243. this.isYYBuild = true;
  244. this.allowUrgentChange(this.isUrgent);
  245. if (!this.isUrgent) {
  246. //不加急状态下,回显时间
  247. this.showDateTime();
  248. }
  249. this.yyInspectChange();
  250. } else {
  251. //不允许预约建单
  252. this.isYYBuild = false;
  253. this.date = false;
  254. this.time = false;
  255. this.timestamp = new Date().getTime();
  256. this.yyInspectChange();
  257. }
  258. // 底部按钮展示
  259. this.showBtns(this.isYYBuild);
  260. },
  261. // 底部按钮展示
  262. showBtns(flag) {
  263. console.log(flag, this.isYYBuild)
  264. if (flag && this.isYYBuild) {
  265. //患者陪检业务或患者其他服务业务,并且预约建单开关打开的情况下
  266. this.btns = [{
  267. name: "上一步",
  268. type: "primary",
  269. click: () => {
  270. uni.navigateBack();
  271. },
  272. }, {
  273. name: "预约建单",
  274. type: "primary",
  275. click: () => {
  276. this.$refs.seiminModel.show({
  277. skin: 'yyDate',
  278. title: '',
  279. content: '请您选择希望陪检人员上门的时间',
  280. btns: [{
  281. name: '取消'
  282. },
  283. {
  284. name: '预约建单',
  285. click: () => {
  286. if (this.$refs.seiminModel.dateVal && this.$refs.seiminModel.timeVal) {
  287. this.buildOrder(true);
  288. }
  289. }
  290. }
  291. ]
  292. })
  293. },
  294. }, {
  295. name: "立即建单",
  296. type: "primary",
  297. click: () => {
  298. this.buildOrder();
  299. },
  300. }, ];
  301. } else {
  302. this.btns = [{
  303. name: "上一步",
  304. type: "primary",
  305. click: () => {
  306. uni.navigateBack();
  307. },
  308. }, {
  309. name: "立即建单",
  310. type: "primary",
  311. click: () => {
  312. this.buildOrder();
  313. },
  314. }, ];
  315. }
  316. },
  317. },
  318. onLoad(queryParams) {
  319. this.queryParams = queryParams;
  320. this.init();
  321. },
  322. };
  323. </script>
  324. <style lang="scss" scoped>
  325. .patientBuild {
  326. margin-bottom: 100rpx;
  327. ::v-deep .uni-checkbox-input {
  328. border-radius: 50%;
  329. }
  330. ::v-deep .uni-checkbox-input-checked {
  331. background-color: #09BB07;
  332. &:before {
  333. color: #fff;
  334. }
  335. }
  336. ::v-deep uni-checkbox:not([disabled]) .uni-checkbox-input:hover {
  337. border-color: #09BB07;
  338. }
  339. .qco_msg {
  340. min-height: 144rpx;
  341. padding: 32rpx;
  342. color: #999;
  343. line-height: 40rpx;
  344. font-size: 32rpx;
  345. text-align: center;
  346. }
  347. .select_block_wrap {
  348. @include border(top);
  349. // 设备
  350. .select_block {
  351. padding: 0 30rpx;
  352. height: 88rpx;
  353. font-size: 34rpx;
  354. background-color: #fff;
  355. position: relative;
  356. @include flex(flex-start, center);
  357. &:last-of-type {
  358. &::after {
  359. opacity: 0;
  360. }
  361. }
  362. &::after {
  363. content: '';
  364. height: 1px;
  365. width: calc(100vw - 30rpx);
  366. background-color: #E5E5E5;
  367. position: absolute;
  368. right: 0;
  369. bottom: 0;
  370. }
  371. .select_label {
  372. color: #000;
  373. }
  374. }
  375. }
  376. // 备注
  377. .remarks {
  378. min-height: 150rpx;
  379. background-color: #f9fafb;
  380. @include border(top);
  381. .remarks_nav {
  382. padding: 0 25rpx;
  383. height: 66rpx;
  384. font-size: 28rpx;
  385. color: #666;
  386. @include flex(flex-start, center);
  387. @include border(bottom);
  388. }
  389. .remarks_btn {
  390. padding: 0 25rpx;
  391. font-size: 34rpx;
  392. height: 88rpx;
  393. background-color: #fff;
  394. @include border(bottom);
  395. @include flex(space-between, center);
  396. }
  397. .remarks_textarea {
  398. padding: 22rpx 25rpx;
  399. width: 100%;
  400. min-height: 150rpx;
  401. background-color: #fff;
  402. @include border(bottom);
  403. }
  404. .remarks_tips {
  405. padding: 32rpx 25rpx;
  406. color: #999;
  407. font-size: 28rpx;
  408. line-height: 40rpx;
  409. }
  410. }
  411. }
  412. </style>