toDoorService.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>上门服务代预约</title>
  7. <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  9. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  10. <link rel="stylesheet" href="../../../plugins/toastr/toastr.min.css" />
  11. <link rel="stylesheet" href="../../../plugins/element-ui/element-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/date.css" />
  13. <link rel="stylesheet" href="../css/common.css" />
  14. <style>
  15. #app {
  16. font-size: 14px;
  17. }
  18. .form-box {
  19. padding: 16px 20px 20px;
  20. }
  21. .form-item {
  22. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  23. padding: 4px 0;
  24. display: flex;
  25. justify-content: space-between;
  26. align-items: center;
  27. height: 44px;
  28. }
  29. .form-label {
  30. }
  31. .service-box {
  32. padding: 4px 0;
  33. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  34. }
  35. .service-item {
  36. margin-left: 20px;
  37. margin-right: 10px;
  38. height: 24px;
  39. }
  40. .address-box {
  41. padding: 4px 0;
  42. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  43. }
  44. .flex {
  45. display: flex;
  46. justify-content: space-between;
  47. align-items: center;
  48. }
  49. .reservation-btn {
  50. display: block;
  51. width: 300px;
  52. margin: 20px auto;
  53. }
  54. .no-service {
  55. text-align: center;
  56. line-height: 40px;
  57. }
  58. .required-icon {
  59. position: relative;
  60. }
  61. .required-icon::after {
  62. content: '*';
  63. position: absolute;
  64. left: -10px;
  65. color: #ed2d2d;
  66. top: 50%;
  67. transform: translateY(-50%);
  68. }
  69. </style>
  70. </head>
  71. <body>
  72. <div id="app" v-cloak>
  73. <div class="form-box">
  74. <div class="service-box">
  75. <div class="flex">
  76. <div class="form-label">本次预定的服务</div>
  77. <div class="form-value" style="cursor: pointer" @click="toSelectService">
  78. (已造
  79. <span style="color: #11b7f5">{{serviceList.length}}</span>
  80. 项)
  81. <i class="el-icon-arrow-right"></i>
  82. </div>
  83. </div>
  84. <div class="service-list">
  85. <div class="service-item flex" v-for="item in serviceList">
  86. <div style="width: 300px">{{item.title}}</div>
  87. <div style="padding-left: 20px">x{{item.num}}</div>
  88. <div style="color: #ed2d2d">¥{{item.expense}}</div>
  89. </div>
  90. <div v-if="serviceList.length == 0" class="no-service">暂未选择服务</div>
  91. </div>
  92. </div>
  93. <div class="form-item">
  94. <div class="form-label">服务对象</div>
  95. <div class="form-value">{{patientInfo.name}}</div>
  96. </div>
  97. <div class="form-item">
  98. <div class="form-label">签约地区</div>
  99. <div class="form-value">{{patientInfo.townName}}</div>
  100. </div>
  101. <div class="form-item">
  102. <div class="form-label">联系方式</div>
  103. <div class="form-value">{{patientInfo.mobile}}</div>
  104. </div>
  105. <div class="address-box">
  106. <div class="flex required-icon">
  107. <div>上门地址</div>
  108. <el-input v-model="serveAddress" placeholder="请输入上门地址" size="small" style="width: 200px" @change="getAddressPoint"></el-input>
  109. </div>
  110. <div id="map2" style="height: 200px; margin: 10px"></div>
  111. </div>
  112. <div class="service-box">
  113. <div class="form-label" style="height: 32px; line-height: 32px">请说明居民需要什么服务?</div>
  114. <el-input v-model="serveDesc" placeholder="请简要描述居民的病情..." type="textarea" :maxlength="100" :rows="3" resize="none"></el-input>
  115. </div>
  116. <div class="form-item">
  117. <div class="form-label required-icon">希望服务时间</div>
  118. <div class="form-value">
  119. <el-date-picker v-model="time" type="date" style="width: 150px" size="small" value-format="yyyy-MM-dd" placeholder="选择日期时间"></el-date-picker>
  120. <el-time-picker
  121. is-range
  122. v-model="time1"
  123. start-placeholder="开始时间"
  124. end-placeholder="结束时间"
  125. placeholder="选择时间范围"
  126. range-separator="-"
  127. value-format="HH:mm"
  128. size="small"
  129. style="width: 240px"></el-time-picker>
  130. </div>
  131. </div>
  132. <div class="form-item">
  133. <div class="form-label required-icon">服务医生</div>
  134. <div class="form-value" style="width: 200px; text-align: right; cursor: pointer" @click="toSelectDoctor">
  135. {{doctor.name}}
  136. <i class="el-icon-arrow-right"></i>
  137. </div>
  138. </div>
  139. </div>
  140. <el-button type="primary" class="reservation-btn" @click="reservationFn">提交预约</el-button>
  141. </div>
  142. <!-- <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&d2GXayjVT86kMvm5FRKvGgY0EjlXdRNx"></script> -->
  143. <script type="text/javascript" src="../../../js/api-map-baidu.lite.js"></script>
  144. <script type="text/javascript" src="../../../js/vue.js"></script>
  145. <script type="text/javascript" src="../../../js/jquery-2.2.4.js"></script>
  146. <script type="text/javascript" src="../../../js/es6-promise.js" charset="utf-8"></script>
  147. <script type="text/javascript" src="../../../plugins/toastr/toastr.min.js"></script>
  148. <script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
  149. <script type="text/javascript" src="../../../api/http-request.js"></script>
  150. <script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
  151. <script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
  152. <script type="text/javascript" src="../../../api/recover_api.js"></script>
  153. <script type="text/javascript" src="../../../js/underscore-1.9.1.js"></script>
  154. <script type="text/javascript" src="../../../js/util.js" charset="utf-8"></script>
  155. <script>
  156. new Vue({
  157. el: '#app',
  158. data() {
  159. return {
  160. patient: null,
  161. patientInfo: {},
  162. serveDesc: '',
  163. time: null,
  164. time1: null,
  165. serviceList: [],
  166. bmap: null,
  167. serveAddress: null,
  168. marker: null,
  169. doctor: { name: '' },
  170. detailId: null,
  171. docInfo: null,
  172. serveLat: null,
  173. serveLon: null,
  174. relationCode: null
  175. }
  176. },
  177. mounted() {
  178. this.patient = GetRequest().patient
  179. this.detailId = GetRequest().detailId
  180. this.relationCode = GetRequest().relationCode
  181. this.docInfo = JSON.parse(localStorage.getItem('docInfo'))
  182. this.doctor={
  183. doctor: this.docInfo.code,
  184. name: this.docInfo.name,
  185. jobName: this.docInfo.jobName
  186. }
  187. this.getPatientInfo()
  188. this.initMap()
  189. },
  190. methods: {
  191. toSelectService() {
  192. var vm = this
  193. // this.$message.warning('暂无可供选择的服务,请在下方直接描述您所需的服务')
  194. sessionStorage.setItem('serviceList', JSON.stringify(this.serviceList))
  195. top.layer.open({
  196. type: 2,
  197. area: ['600px', '800px'],
  198. shade: 0.5,
  199. title: '选择服务',
  200. fixed: true, //不固定
  201. maxmin: true,
  202. closeBtn: 1,
  203. // shift: 5,
  204. shadeClose: false, //点击遮罩关闭层
  205. content: `../../rehabilitation/html/serviceDialog.html`,
  206. end: function () {
  207. var val = sessionStorage.getItem('serviceList')
  208. if (val) {
  209. sessionStorage.removeItem('serviceList')
  210. vm.serviceList = JSON.parse(val)
  211. }
  212. }
  213. })
  214. },
  215. getPatientInfo() {
  216. var vm = this
  217. httpRequest.post('doctor/patient_label_info/patient', { data: { patient: this.patient } }).then(function (res) {
  218. vm.patientInfo = res.data
  219. })
  220. },
  221. initMap() {
  222. var vm = this
  223. // 初始化地图, 设置中心点坐标和地图级别
  224. vm.bmap = new BMap.Map('map2')
  225. var point = new BMap.Point(116.404, 39.915) // 创建点坐标
  226. vm.bmap.centerAndZoom(point, 15) // 初始化地图,设置中心点坐标和缩放级别
  227. // 添加缩放控件
  228. var zoomCtrl = new BMap.ZoomControl({
  229. anchor: BMAP_ANCHOR_BOTTOM_RIGHT
  230. })
  231. vm.bmap.addControl(zoomCtrl)
  232. vm.marker = new BMap.Marker(point)
  233. vm.bmap.addOverlay(vm.marker)
  234. vm.bmap.enableDragging()
  235. // vm.bmap.enableScrollWheelZoom()
  236. vm.bmap.addEventListener('click', function (e) {
  237. console.log(e,"e");
  238. // return
  239. vm.getAddress(e.point)
  240. vm.bmap.clearOverlays()
  241. vm.marker = new BMap.Marker(e.point) //中心点坐标红点
  242. vm.bmap.addOverlay(vm.marker) // 增加中心点坐标红点
  243. vm.bmap.centerAndZoom(new BMap.Point(e.point.lng, e.point.lat)) // 设置地图中心
  244. })
  245. },
  246. getAddress(center) {
  247. var vm = this
  248. var params = {
  249. ak: 'd2GXayjVT86kMvm5FRKvGgY0EjlXdRNx',
  250. output: 'json',
  251. coordtype: 'bd09ll',
  252. location: center.lat + ',' + center.lng
  253. }
  254. httpRequest.get('https://api.map.baidu.com/reverse_geocoding/v3/', { data: params }, function (res) {
  255. if (res.status == 0) {
  256. vm.serveAddress = res.result.formatted_address
  257. } else {
  258. vm.$message.warning('获取地址失败')
  259. }
  260. })
  261. },
  262. getAddressPoint() {
  263. var vm = this
  264. var params = {
  265. ak: 'd2GXayjVT86kMvm5FRKvGgY0EjlXdRNx',
  266. output: 'json',
  267. address: vm.serveAddress,
  268. city: '厦门市'
  269. }
  270. httpRequest.get('third/door/findAreaMap', { data: params }).then(function (res) {
  271. if (res.status == 200) {
  272. res = JSON.parse(res.data)
  273. if (res.status == 0) {
  274. if (res.result.location) {
  275. vm.bmap.clearOverlays()
  276. vm.serveLat = res.result.location.lat
  277. vm.serveLon = res.result.location.lng
  278. vm.marker = new BMap.Marker(res.result.location) //中心点坐标红点
  279. vm.bmap.addOverlay(vm.marker)
  280. vm.bmap.centerAndZoom(new BMap.Point(res.result.location.lng, res.result.location.lat), 15) // 设置地图中心
  281. }
  282. } else {
  283. vm.$message.warning('获取坐标失败')
  284. }
  285. }
  286. })
  287. },
  288. toSelectDoctor() {
  289. var vm = this
  290. top.layer.open({
  291. type: 2,
  292. area: ['500px', '700px'],
  293. shade: 0.5,
  294. title: '选择服务医生',
  295. fixed: true, //不固定
  296. maxmin: true,
  297. closeBtn: 1,
  298. // shift: 5,
  299. shadeClose: false, //点击遮罩关闭层
  300. content: `../../rehabilitation/html/selectDoctor.html?patient=${this.patient}`,
  301. end: function () {
  302. var val = sessionStorage.getItem('selectDoctor')
  303. if (val) {
  304. sessionStorage.removeItem('selectDoctor')
  305. vm.doctor = JSON.parse(val)
  306. }
  307. }
  308. })
  309. },
  310. reservationFn() {
  311. var nowDate = new Date().getTime()
  312. var serviceDate = new Date(this.time + ' ' + this.time1[0]).getTime()
  313. var vm = this
  314. if (!vm.serveAddress) {
  315. vm.$message.warning('请输入上门地址')
  316. return
  317. }
  318. if (!vm.time) {
  319. vm.$message.warning('请输入希望服务时间')
  320. return
  321. }
  322. if (!vm.doctor.name) {
  323. vm.$message.warning('请选择服务医生')
  324. return
  325. }
  326. if (!this.time1) {
  327. vm.$message.warning('请输入希望服务时间')
  328. return
  329. }
  330. if (nowDate >= serviceDate) {
  331. this.$message.warning('服务时间不能早于当前时间')
  332. return
  333. }
  334. var params = {
  335. dataJson: JSON.stringify({
  336. rehabilitationDetailId: this.detailId,
  337. patientCode: this.patient,
  338. patientName: this.patientInfo.name,
  339. doctorCode: vm.docInfo.code,
  340. doctorName: vm.docInfo.name,
  341. relationRecordType: 4,
  342. relationRecordCode: '',
  343. status: 0,
  344. node: '',
  345. relationRecordImg: ''
  346. })
  347. }
  348. var packageItemArr = []
  349. this.serviceList.forEach(function (item) {
  350. packageItemArr.push({
  351. type: 1,
  352. code: item.code,
  353. name: item.title,
  354. fee: item.expense,
  355. feeDiscount: 0,
  356. number: item.num,
  357. status: 1
  358. })
  359. })
  360. var param = {
  361. jsonData: JSON.stringify({
  362. order: {
  363. proxyPatient: vm.docInfo.code,
  364. proxyPatientName: vm.docInfo.name,
  365. proxyPatientPhone: vm.docInfo.mobile,
  366. patient: vm.patient,
  367. patientName: vm.patientInfo.name,
  368. patientPhone: vm.patientInfo.mobile,
  369. patientExpectedServeTime: `${vm.time} ${vm.time1[0]}-${vm.time1[1]}`,
  370. serveDesc: vm.serveDesc,
  371. serveTown: vm.patientInfo.townName,
  372. serveAddress: vm.serveAddress,
  373. serveLat: vm.serveLat,
  374. serveLon: vm.serveLon,
  375. doctor: vm.doctor.doctor,
  376. doctorName: vm.doctor.name,
  377. doctorType: vm.doctor.jobName,
  378. id: null, //重新派单增加orderId
  379. relationCode: vm.relationCode
  380. },
  381. deleteItemArr: [], ////重新派单编辑服务项需传原来服务项id
  382. packageItemArr: packageItemArr, //提交的服务项
  383. hospital: {
  384. code: vm.docInfo.hospital
  385. }
  386. })
  387. }
  388. if (this.relationCode) {
  389. // 内部 代预约
  390. this.createSend(param)
  391. } else {
  392. // 外部 代预约
  393. this.saveRehabilitationOperateRecord(params, param)
  394. }
  395. },
  396. saveRehabilitationOperateRecord(params, param) {
  397. var vm = this
  398. var url = 'doctor/specialist/rehabilitation/saveRehabilitationOperateRecord'
  399. httpRequest.post(url, { data: params }).then(function (res) {
  400. if (res.status == 200) {
  401. var jsonData = JSON.parse(param.jsonData)
  402. jsonData.order.relationCode = res.data.id
  403. param.jsonData = JSON.stringify(jsonData)
  404. vm.createSend(param)
  405. } else {
  406. vm.$message.error(res.msg || '服务记录失败')
  407. }
  408. })
  409. },
  410. createSend(param) {
  411. var vm = this
  412. var url = 'doctor/serviceOrder/proxyCreate'
  413. httpRequest.post(url, { data: param }).then(function (res) {
  414. if (res.status == 200) {
  415. vm.$message.success('预约成功!')
  416. if (vm.relationCode) {
  417. // 内部
  418. vm.createOperateRecord()
  419. } else {
  420. vm.updateNoteAndImageRehabilitationOperate('代预约成功')
  421. // 外部
  422. }
  423. } else {
  424. vm.$message.error(res.msg)
  425. }
  426. })
  427. },
  428. createOperateRecord(cb) {
  429. var vm = this
  430. var url = 'doctor/specialist/rehabilitation/saveRehabilitationOperateRecord',
  431. obj = {
  432. rehabilitationDetailId: vm.detailId,
  433. patientCode: vm.patient,
  434. patientName: vm.patientInfo.patientName,
  435. doctorCode: vm.docInfo.code,
  436. doctorName: vm.docInfo.name,
  437. relationRecordType: 5, //上传附件
  438. relationRecordCode: '',
  439. status: 0
  440. }
  441. var params = {
  442. dataJson: JSON.stringify(obj)
  443. }
  444. httpRequest.post(url, { data: params }).then(function (res) {
  445. if (res.status == 200) {
  446. console.log('vm.done()')
  447. vm.done()
  448. }
  449. })
  450. },
  451. updateNoteAndImageRehabilitationOperate(text) {
  452. var vm = this
  453. var params = {
  454. planDetailId: vm.detailId,
  455. node: text,
  456. image: ''
  457. }
  458. var uRl = '/doctor/specialist/rehabilitation/updateNoteAndImageRehabilitationOperate'
  459. httpRequest.post(uRl, { data: params }).then(function (res) {
  460. if (res.status == 200) {
  461. var index = parent.layer.getFrameIndex(window.name)
  462. parent.layer.close(index)
  463. } else {
  464. vm.$message.error(res.msg || '服务记录失败')
  465. }
  466. })
  467. },
  468. done() {
  469. var vm = this
  470. var url = '/doctor/specialist/rehabilitation/updateNoteAndImageRehabilitationOperate'
  471. var params = {
  472. planDetailId: vm.detailId,
  473. node: vm.notes || '',
  474. image: ''
  475. }
  476. if (vm.relationCode) {
  477. params.relationCode = vm.relationCode
  478. }
  479. httpRequest.post(url, { data: params }).then(function (res) {
  480. if (res.status == 200) {
  481. var index = parent.layer.getFrameIndex(window.name)
  482. parent.layer.close(index)
  483. }
  484. })
  485. }
  486. }
  487. })
  488. </script>
  489. </body>
  490. </html>