You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

497 lines
17 KiB

1 year ago
  1. <template>
  2. <div style="margin-top: -15px;">
  3. <div style="display: flex;justify-content: space-between;">
  4. <div
  5. style="display: flex;flex-wrap: wrap;background-color: #fff;border-radius: 8px;align-items: center;padding: 2px;width:700px;">
  6. <div class="query">
  7. <!--
  8. <el-select v-model="query.thirdInterfaceId" placeholder="请选择" style="width: 100px" size="small">
  9. <el-option v-for="item in thirdInterfaces" :key="item.id" :label="item.displayName" :value="item.id" />
  10. </el-select>
  11. -->
  12. <el-date-picker v-model="query.startDate" type="date" placeholder="起始日期" size="small"
  13. style="width:90px;" value-format="yyyy-MM-dd" :picker-options="pickerOptions" />
  14. <span class="spanClass"></span>
  15. <el-date-picker v-model="query.endDate" type="date" placeholder="截止日期" size="small"
  16. style="width:90px;" value-format="yyyy-MM-dd" :picker-options="pickerOptions" />
  17. </div>
  18. <div class="query">
  19. <span class="spanClass">检索关键字</span>
  20. <el-input placeholder="姓名、电话、身份证号" v-model="query.keyWord" size="small" clearable style="width: 240px" />
  21. </div>
  22. <div class="query">
  23. <span class="spanClass">状态</span>
  24. <el-select v-model="query.medicalStatus" placeholder="请选择" clearable style="width: 80px" size="small">
  25. <el-option v-for="item in localDict.medicalStatus" :key="item.value" :label="item.label" :value="item.value">
  26. </el-option>
  27. </el-select>
  28. </div>
  29. </div>
  30. <div style="margin-top: -38px;width: 80px;">
  31. <div>
  32. <el-button @click="peopleIcCard" class="commonbutton" style="width:80px;font-size: 14px;">读身份证</el-button>
  33. </div>
  34. <div>
  35. <el-button class="commonbutton" @click="btnQuery" style="margin-top: 6px; width:80px;">查询</el-button>
  36. </div>
  37. </div>
  38. </div>
  39. <div>
  40. <el-table :data="tableData" border style="width: 100%" row-key="id" height="430" highlight-current-row
  41. size="small" @row-click="rowClick" ref="webBooking">
  42. <el-table-column label="姓名" width="80" prop="patientName" align="center" />
  43. <el-table-column label="身份证号" width="150" prop="idNo" align="center" />
  44. <el-table-column label="预约时间" width="150" prop="bookingDate" align="center" />
  45. <el-table-column label="手机号" width="130" prop="phone" align="center" />
  46. <el-table-column label="性别" width="40" prop="sexId" align="center" />
  47. <el-table-column label="年龄" width="40" prop="age" align="center" />
  48. <el-table-column label="单位" width="150" prop="customerOrgId" align="center" />
  49. <el-table-column label="单位体检次数" width="150" prop="customerOrgRegisterId" align="center" />
  50. <el-table-column label="分组/套餐" width="120" prop="customerOrgGroupId" align="center">
  51. <template slot-scope="scope">
  52. <div>{{ scope.row.customerOrgGroupId ? scope.row.customerOrgGroupId : scope.row.medicalPackageName }}
  53. </div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="预约编号" width="120" prop="thirdBookingId" align="center" />
  57. <el-table-column label="状态" width="50" prop="medicalStatus" align="center" >
  58. <template slot-scope="scope">
  59. {{ dddw(localDict.medicalStatus,'value',scope.row.medicalStatus,'label') }}
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. </div>
  64. <div style="margin-top: 10px; display: flex;justify-content: space-between;">
  65. <div style="margin: -8px 0 0 0; font-size: 12px;">
  66. {{ asbDesc }}
  67. </div>
  68. <div>
  69. <el-button v-if="false" @click="btnTest">测试</el-button>
  70. </div>
  71. <div>
  72. <el-button class="commonbutton" @click="btnOk">确定</el-button>
  73. <el-button class="commonbutton" @click="btnClose">关闭</el-button>
  74. </div>
  75. </div>
  76. </div>
  77. </template>
  78. <script>
  79. import { mapState } from "vuex";
  80. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  81. import { dddw, deepCopy } from "../../utlis/proFunc";
  82. import moment from "moment";
  83. export default {
  84. components: {
  85. },
  86. data() {
  87. return {
  88. thirdInterfaces: [],
  89. tableData: [],
  90. currRowData: {},
  91. tableDataDetails: [],
  92. query: {
  93. thirdInterfaceId: "",
  94. idNo: "",
  95. mobilePhone: "",
  96. appointStartDate: "",
  97. appointStopDate: "",
  98. completeFlag: "0",
  99. keyWord:'',
  100. startDate:'',
  101. endDate:'',
  102. medicalStatus:'0'
  103. },
  104. asbDesc: '', //所选套餐描述
  105. localDict:{
  106. medicalStatus:[
  107. {label:'未开始',value:'0'}, // 0未开始 1已登记 2已完成
  108. {label:'已登记',value:'1'},
  109. {label:'已完成',value:'2'},
  110. ]
  111. }
  112. };
  113. },
  114. created() {
  115. let today = moment(new Date()).format("yyyy-MM-DD")
  116. this.query.endDate = today
  117. this.query.startDate = today
  118. },
  119. updated() {
  120. // this.$nextTick(() => {
  121. // this.$refs['webBookingDetaills'].doLayout()
  122. // })
  123. },
  124. //挂载完成
  125. mounted() {
  126. //回车替代查询
  127. this.enterToQuery()
  128. this.funMounted()
  129. },
  130. computed: {
  131. ...mapState([
  132. "pickerOptions",
  133. "window",
  134. "dict",
  135. "dataTransOpts",
  136. "dialogWin"
  137. ]),
  138. },
  139. methods: {
  140. dddw,
  141. funMounted() {
  142. this.dictInit()
  143. // .then(res => {
  144. // //this.btnQuery()
  145. // })
  146. },
  147. //数据初始化
  148. dictInit() {
  149. // return new Promise((resolve, reject) => {
  150. // let curDate = moment(new Date()).format('YYYY-MM-DD')
  151. // this.query.appointStartDate = curDate
  152. // this.query.appointStopDate = moment(Date.now() + 3600 * 1000 * 24 * 7).format('YYYY-MM-DD')
  153. // this.query.idNo = ''
  154. // this.query.mobilePhone = ''
  155. // this.tableData = []
  156. // this.tableDataDetails = []
  157. // // 获取接口列表,传07
  158. // postapi("/api/app/ThirdInterface/GetListByThirdInterfaceTypeAsync", { thirdInterfaceType: "07" })
  159. // .then(res => {
  160. // if (res.code > -1) {
  161. // this.thirdInterfaces = res.data
  162. // if (res.data && Array.isArray(res.data) && res.data.length > 0) this.query.thirdInterfaceId = res.data[0].id
  163. // resolve(res)
  164. // } else {
  165. // reject(res.message)
  166. // }
  167. // })
  168. // .catch(err => {
  169. // reject(err)
  170. // })
  171. // })
  172. },
  173. //读取身份证信息
  174. peopleIcCard() {
  175. if (!this.$peisAPI) {
  176. this.$message.info({ showClose: true, message: "此功能,需要在壳客户端才可运行!" })
  177. return
  178. }
  179. this.$peisAPI.peopleIcCard().then(res => {
  180. // console.log('peopleIcCard', res)
  181. let lres = JSON.parse(res)
  182. if (lres.code >= -1) {
  183. let idNos = parsIcCardtoLocal(lres.data, this.dict.sex, this.dict.nation)
  184. this.query.idNo = idNos.IDCode
  185. this.query.keyWord = idNos.IDCode
  186. // this.form.patientName = idNos.Name
  187. // this.form.birthDate = idNos.birthDate
  188. // this.form.sexId = idNos.sexId
  189. // this.form.age = idNos.age
  190. // this.form.nationId = idNos.nationId
  191. // this.form.idNo = idNos.IDCode
  192. // this.form.address = idNos.Address
  193. // this.peoplePhoto = 'data:image/bmp;base64,' + idNos.Photo
  194. // this.patientRegister.photo = 'data:image/bmp;base64,' + idNos.Photo
  195. this.btnQuery()
  196. } else {
  197. this.$message.error({ showClose: true, message: `${lres.message}` })
  198. }
  199. })
  200. },
  201. // 查询
  202. btnQuery() {
  203. // if (!(this.query.appointStartDate && this.query.appointStopDate)) {
  204. // this.$message.error({ showClose: true, message: "必须选择日期段!" })
  205. // return
  206. // }
  207. // if (!(this.query.idNo || this.query.mobilePhone)) {
  208. // this.$message.error({ showClose: true, message: "手机号或身份证号必须填写一项!" })
  209. // return
  210. // }
  211. if (!(this.query.startDate && this.query.endDate)) {
  212. this.$message.error({ showClose: true, message: "必须选择日期段!" })
  213. return
  214. }
  215. this.currRowData = {}
  216. this.tableData = []
  217. this.tableDataDetails = []
  218. let body = deepCopy(this.query)
  219. // body.appointStartDate = this.query.appointStartDate + " 00:00:00"
  220. // body.appointStopDate = this.query.appointStopDate + " 23:59:59"
  221. body.startDate = this.query.startDate + " 00:00:00"
  222. body.endDate = this.query.endDate + " 23:59:59"
  223. postapi('/api/app/ThirdBooking/GetThirdBookingList', body)
  224. .then(res => {
  225. if (res.code > -1) {
  226. this.tableData = res.data
  227. if (res.data && Array.isArray(res.data) && res.data.length == 1) {
  228. this.rowClick(res.data[0])
  229. this.$refs['webBooking'].setCurrentRow(res.data[0]);
  230. }
  231. }
  232. })
  233. },
  234. btnTest() {
  235. console.log('this.thirdInterfaces', this.thirdInterfaces)
  236. console.log('this.tableData', this.tableData)
  237. console.log('this.currRowData', this.currRowData)
  238. console.log('this.tableDataDetails', this.tableDataDetails)
  239. console.log('this.query', this.query)
  240. },
  241. rowClick(row) {
  242. this.currRowData = row
  243. // this.tableDataDetails = []
  244. // postapi('/api/app/AppointPatientRegister/GetAppointRegisterAsbitemListById', {
  245. // thirdInterFaceId: this.query.thirdInterfaceId,
  246. // appointPatientRegisterId: row.appointPatientRegisterId
  247. // }).then(res => {
  248. // if (res.code > -1) {
  249. // res.data.forEach(e => {
  250. // e.discount = e.standardPrice == 0 ? 100: Math.floor(e.chargePrice * 10000/e.standardPrice)/100
  251. // if(!e.isBelongGroupPackage){
  252. // e.isBelongGroupPackage = e.isInMedicalPackage
  253. // }
  254. // // e.standTotal = e.amount * e.standardPrice
  255. // e.total = e.amount * e.chargePrice
  256. // });
  257. // this.tableDataDetails = res.data
  258. // }
  259. // })
  260. },
  261. // 点击确定
  262. btnOk() {
  263. // if (!this.currRowData.appointPatientRegisterId) {
  264. // this.$message.warning({ showClose: true, message: "请选择预约的记录" })
  265. // return
  266. // }
  267. if (!this.currRowData.thirdBookingId) {
  268. this.$message.warning({ showClose: true, message: "请选择预约的记录" })
  269. return
  270. }
  271. this.dataTransOpts.tableS.appoint_patient_register = this.dataTrans(this.currRowData)
  272. // this.dataTransOpts.tableM.appoint_register_asbitem = deepCopy(this.tableDataDetails)
  273. this.dialogWin.WebBookingMzak = false
  274. },
  275. dataTrans(curRow){
  276. // { // 标准数据
  277. // "appointPatientRegisterId": "string",
  278. // "personId": "string",
  279. // "personName": "string",
  280. // "idNo": "string",
  281. // "mobileTelephone": "string",
  282. // "sexId": "string",
  283. // "sexName": "string",
  284. // "maritalStatusId": "string",
  285. // "maritalStatusName": "string",
  286. // "customerOrgId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  287. // "customerOrgName": "string",
  288. // "childCustomerOrgName": "string",
  289. // "customerOrgGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  290. // "customerOrgGroupName": "string",
  291. // "medicalPackageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  292. // "medicalPackageName": "string",
  293. // "completeFlag": "string",
  294. // "appointDate": "2024-09-27T08:53:32.520Z",
  295. // "remark": "string",
  296. // "medicalCenterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  297. // "customerOrgRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  298. // "pregnantFlag": "string",
  299. // "pregnantFlagName": "string",
  300. // "height": 0,
  301. // "weight": 0
  302. // }
  303. // { // 人寿数据
  304. // "thirdBookingId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  305. // "patientName": "string",
  306. // "customerOrgGroupId": "string",
  307. // "idNo": "string",
  308. // "sexId": "string",
  309. // "age": 0,
  310. // "bookingDate": "2024-09-27T08:53:32.306Z",
  311. // "phone": "string",
  312. // "medicalStatus": "string",
  313. // "customerOrgRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  314. // "customerOrgId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  315. // }
  316. let ret = Object.assign({},curRow,{
  317. appointPatientRegisterId:curRow.thirdBookingId,
  318. mobileTelephone:curRow.phone,
  319. personName:curRow.patientName
  320. })
  321. return ret
  322. },
  323. // 点击关闭
  324. btnClose() {
  325. this.dataTransOpts.tableS.appoint_patient_register = {}
  326. this.dataTransOpts.tableM.appoint_register_asbitem = []
  327. this.dialogWin.WebBookingMzak = false
  328. },
  329. //自定义计算列
  330. getSummaries(param) {
  331. const { columns, data } = param;
  332. const sumCol = [6] //需合计的列
  333. const sums = [];
  334. let count = this.tableDataDetails.length
  335. let pack = this.tableDataDetails.filter(e => { return e.isBelongGroupPackage == 'Y' }).length
  336. this.asbDesc = `共选 ${count} 个项目,其中套餐/分组 ${pack} 个,加做 ${count - pack}`
  337. columns.forEach((column, index) => {
  338. //console.log('column, index,data',column, index,data)
  339. //显示合计列
  340. if (index == 1) {
  341. sums[index] = `合计`;
  342. return;
  343. }
  344. //不合计的列
  345. if (sumCol.indexOf(index) == -1) {
  346. sums[index] = '';
  347. return;
  348. }
  349. sums[index] = 0
  350. data.forEach(e => {
  351. if (!isNaN(e[column.property])) {
  352. if (index == 1) {
  353. sums[index] += e[column.property] * e['amount']
  354. } else {
  355. sums[index] += e[column.property]
  356. }
  357. }
  358. })
  359. sums[index] = Math.round(sums[index] * 100) / 100 //+ ' 元';
  360. // const values = data.map(item => Number(item[column.property]));
  361. // if (!values.every(value => isNaN(value))) {
  362. // sums[index] = values.reduce((prev, curr) => {
  363. // const value = Number(curr);
  364. // if (!isNaN(value)) {
  365. // //return prev + curr; //原始
  366. // return prev + curr; //改造
  367. // } else {
  368. // return prev;
  369. // }
  370. // }, 0);
  371. // sums[index] = sums[index].toFixed(2) + ' 元';
  372. // } else {
  373. // sums[index] = 'N/A';
  374. // }
  375. });
  376. this.totalStand = sums[1];
  377. //console.log('this.totalFoucs/this.discountFoucs',this.totalFoucs,this.discountFoucs)
  378. if (!this.totalFoucs) this.total = sums[5];
  379. if (!this.discountFoucs) this.discount = Math.round(this.total * 10000 / this.totalStand) / 100;
  380. return sums;
  381. },
  382. //回车替代查询
  383. enterToQuery() {
  384. // console.log('enterToTab');
  385. this.$nextTick(() => {
  386. let inputs = document.querySelectorAll(["input"]); //用数组可以读取多个标签的元素 //.inline-input
  387. // 为每个输入框添加键盘事件监听器
  388. inputs.forEach((input, i) => {
  389. // console.log('input',input);
  390. input.addEventListener('keydown', (event) => {
  391. if (event.keyCode === 13) {
  392. // 阻止回车键的默认行为(换行)
  393. event.preventDefault();
  394. // 如果按下的是回车查询
  395. // console.log(input.getAttribute('placeholder'),input.value)
  396. let placeholder = input.getAttribute('placeholder')
  397. switch (placeholder) {
  398. case '预约手机号':
  399. case '身份证号':
  400. case '姓名、电话、身份证号':
  401. this.btnQuery()
  402. input.select()
  403. break;
  404. }
  405. }
  406. });
  407. input.addEventListener('click', (event) => {
  408. let placeholder = input.getAttribute('placeholder')
  409. switch (placeholder) {
  410. case '预约手机号':
  411. case '身份证号':
  412. case '姓名、电话、身份证号':
  413. input.select()
  414. break;
  415. }
  416. });
  417. });
  418. });
  419. },
  420. },
  421. //监听事件()
  422. watch: {
  423. "dataTransOpts.plus.WebBookingMzak": {
  424. // immediate:true,
  425. handler(newVal, oldVal) {
  426. console.log(`watch dataTransOpts.plus.WebBookingMzak newVal: ${newVal}, oldVal: ${oldVal} `);
  427. if (newVal != oldVal) this.funMounted()
  428. }
  429. },
  430. },
  431. };
  432. </script>
  433. <style scoped>
  434. @import '../../assets/css/global_card.css';
  435. @import '../../assets/css/global_input.css';
  436. @import '../../assets/css/global_table.css';
  437. @import '../../assets/css/global.css';
  438. .query {
  439. margin-right: 10px;
  440. font-size: 14px;
  441. color: #232748;
  442. font-weight: 400;
  443. font-family: "NotoSansSC-Regular";
  444. }
  445. .spanClass {
  446. font-size: 14px;
  447. padding: 0 2px 0 0;
  448. }
  449. </style>