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.

1150 lines
38 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div style="display: flex; margin-left: 10px; margin-top: 10px;">
  3. <div style="width:220px;">
  4. <div>
  5. <span>项目类别</span>
  6. <el-cascader :options="dict.itemTypeTree" v-model="itemTypeIds" style="margin-left: 3px;width:160px;"
  7. :props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" :show-all-levels="false"
  8. clearable filterable @change="changeItemType" size="small">
  9. </el-cascader>
  10. </div>
  11. <div class="mainareaBox">
  12. <el-table :data="asbItem"
  13. :height="(window.pageHeight > 700 ? (window.pageHeight - 440) : 260)" @row-dblclick="dbClickChoosedAsb" highlight-current-row
  14. @selection-change="handleSelectionChange" size="small" :row-class-name="handleRowClassName"
  15. @row-click="chooseAsbItem">
  16. <!--
  17. <el-table-column type="selection" align="center" width="40" />
  18. -->
  19. <el-table-column prop="displayName" label="未选组合项目" />
  20. <!--
  21. <el-table-column prop="price" label="标准价格" width="70">
  22. <template slot-scope="scope">
  23. <div style="text-align: center;">{{ scope.row.price }}</div>
  24. </template>
  25. </el-table-column>
  26. <el-table-column prop="forSexId" label="适用性别" width="70">
  27. <template slot-scope="scope">
  28. <div style="text-align: center;">{{ ldddw(dict.forSex, "id", scope.row.forSexId, "displayName") }}</div>
  29. </template>
  30. </el-table-column>
  31. -->
  32. </el-table>
  33. </div>
  34. </div>
  35. <div style="width:100px;margin-top: 70px;">
  36. <div class="btnList">
  37. <el-button type="primary" @click="addAbs(asbItemChoosed,'choosed')" style="width:90px;">添加 <i class="el-icon-arrow-right"></i>
  38. </el-button>
  39. </div>
  40. <div class="btnList">
  41. <el-button type="success" @click="addAbs(asbItemChoosed,'all')" style="width:90px;">全添加 <i class="el-icon-d-arrow-right"></i>
  42. </el-button>
  43. </div>
  44. <div class="btnList">
  45. <el-button type="warning" @click="delAbs(patientRegisterAbsChoosed,'choosed')" style="width:90px;"><i class="el-icon-arrow-left"> 移除</i>
  46. </el-button>
  47. </div>
  48. <div class="btnList">
  49. <el-button type="danger" @click="delAbs(patientRegisterAbsChoosed,'all')" style="width:90px;"><i class="el-icon-d-arrow-left"> 全移除</i>
  50. </el-button>
  51. </div>
  52. <!-- 不显示保存当已选组合有修改时失去焦点自动保存
  53. <div class="btnList">
  54. <el-button type="success" @click="onSubmit('保存')">保存 <i class="el-icon-check"></i>
  55. </el-button>
  56. </div>
  57. -->
  58. </div>
  59. <div :style="'width:' + (window.pageWidth - 110 - 20 - 230 - 100) + 'px;'">
  60. <div style="display: flex;">
  61. <div class="disTotal">
  62. <el-tooltip class="item" effect="dark" content="根据输入的折扣,自动计算折后总价" placement="top">
  63. <span>折扣 </span>
  64. </el-tooltip>
  65. <el-input style="width:55px;" v-model="discount" size="small" type="number" @input="changeAllDiscount"
  66. @focus="discountFoucs = true" @blur="discountFoucs = false" />
  67. </div>
  68. <div class="disTotal">
  69. <el-tooltip class="item" effect="dark" content="总金额即该人员此次体检实收金额,并根据此金额自动计算折扣" placement="top">
  70. <span>总金额 </span>
  71. </el-tooltip>
  72. <el-input style="width:70px;" v-model="total" size="small" type="number" @input="changeTotal" ref="total"
  73. @focus="totalFoucs = true" @blur="totalFoucs = false" />
  74. </div>
  75. <div class="disTotal">
  76. <el-select v-model="asbItemId" placeholder="快速选择组合项目" size="small"
  77. filterable :filter-method="filterMethod"
  78. clearable @clear="quickAsb = deepCopy(asbItemQuick)"
  79. @change="quickChoosedAsb" default-first-option ref="quickAsbOCX"
  80. style="width:150px;text-align: left;padding-right: 15px;">
  81. <el-option v-for="item in quickAsb" :key="item.id" :value="item.id" :label="item.displayName" />
  82. </el-select>
  83. </div>
  84. </div>
  85. <div class="mainareaBox">
  86. <el-table :data="prAsb" highlight-current-row border ref="patientRegister_patientRegisterAbs"
  87. :height="(window.pageHeight > 700 ? (window.pageHeight - 440) : 260)" width="100%" :summary-method="getSummaries"
  88. show-summary :row-class-name="handleRowClassName" @row-dblclick="removeAbs" @selection-change="selecteditems" size="small"
  89. @row-click="removeAsbItem">
  90. <!-- temporaryselection personnelUnit.nogroupselected-->
  91. <!-- 取消勾选换成选中
  92. <el-table-column type="selection" align="center"/>
  93. -->
  94. <el-table-column label="已选组合项目" min-width="120" prop="asbitemName" >
  95. <template slot-scope="scope">
  96. <div>
  97. <i v-if="scope.row.groupPackageId" class="el-icon-star-on" style="font-size: 14px;color: purple;"></i>{{ scope.row.asbitemName }}
  98. </div>
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="标准价格" prop="standardPrice" min-width="70" align="center" />
  102. <el-table-column label="折扣" prop="discount" min-width="60">
  103. <template slot-scope="scope">
  104. <el-input type="number" v-model="scope.row.discount" size="small" @input="changeDiscount(scope.$index)" />
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="数量" prop="amount" min-width="50">
  108. <template slot-scope="scope">
  109. <el-input type="number" v-model="scope.row.amount" size="small" @input="changeDiscount(scope.$index)" />
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="实收价格" prop="chargePrice" min-width="70">
  113. <template slot-scope="scope">
  114. <el-input type="number" v-model="scope.row.chargePrice" size="small"
  115. @input="changePrice(scope.$index)" /> <!--立即触发保存 @blur="onSubmit('')" -->
  116. </template>
  117. </el-table-column>
  118. <el-table-column prop="total" label="金额" min-width="70" align="center"/>
  119. <el-table-column prop="standardPrice" label="标准金额" min-width="70" v-if="false" />
  120. <el-table-column label="支付方式" prop="payTypeFlag" min-width="100">
  121. <template slot-scope="scope">
  122. <el-select v-model="scope.row.payTypeFlag" size="small">
  123. <el-option v-for="item in dict.payType" :key="item.id" :label="item.displayName" :value="item.id" />
  124. </el-select>
  125. </template>
  126. </el-table-column>
  127. <el-table-column prop="isCharge" label="收费" min-width="40" align="center">
  128. <template slot-scope="scope">
  129. <el-checkbox :value="scope.row.isCharge == 'Y'" />
  130. </template>
  131. </el-table-column>
  132. <el-table-column prop="checkCompleteFlag" label="状态" min-width="40" align="center">
  133. <template slot-scope="scope">
  134. <div>{{ dddw(dict.checkCompleteFlag, "id", scope.row.checkCompleteFlag, "displayName") }}</div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column prop="isLock" label="锁" min-width="40" align="center">
  138. <template slot-scope="scope">
  139. <el-checkbox :value="scope.row.isLock == 'Y'" />
  140. </template>
  141. </el-table-column>
  142. <el-table-column prop="creatorName" label="登记人" min-width="70" align="center"></el-table-column>
  143. <el-table-column prop="creationTime" label="登记日期" win-width="90" align="center">
  144. <template slot-scope="scope">
  145. <div>{{ scope.row.creationTime ? moment(scope.row.creationTime).format('yyyy-MM-DD'):'' }}</div>
  146. </template>
  147. </el-table-column>
  148. </el-table>
  149. </div>
  150. </div>
  151. </div>
  152. </template>
  153. <script>
  154. import moment from 'moment';
  155. import { mapState, mapActions } from "vuex";
  156. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  157. import { arrayFilter, arrayReduce, arrayExistObj, dddw, deepCopy, tcdate} from "../../utlis/proFunc";
  158. import proApi from "../../utlis/proApi";
  159. export default {
  160. props: ["prForm","prAsbOpraOpts","triggerHeadSave","refreshFormId"],
  161. data() {
  162. return {
  163. oldFormId:'', //配合登记人员复制新增使用
  164. itemType: [], //项目类别
  165. itemTypeIds: '', //被选中的项目类别ID
  166. asbItem:[], //左侧显示的未选组合项目
  167. asbItemAll:[], //所有未选组合项目
  168. asbItemChoosed: [], //勾选的 未选组合项目
  169. startPoint:-1,
  170. //patientRegisterAbs:[], //体检人员所选组合项目 放vuex
  171. patientRegisterAbsChoosed: [], //勾选的 体检人员所选组合项目
  172. PstartPoint:-1,
  173. //patientRegisterAbsDel: [], //体检人员 待删除的组合项目
  174. prAsb:[], //当前显示的已选组合项目(新增与编辑的在一起)
  175. prAsbDels:[], //待提交 删除的组合项目
  176. groupAsbs:[], //分组包含的项目
  177. packageAsbs:[], //套餐包含的项目
  178. asbItemId: '',
  179. discount: 100,
  180. total: 0,
  181. totalStand: 0,
  182. quickAsb: [],
  183. totalFoucs: false, //总价是否获取焦点
  184. discountFoucs: false, //总折扣是否获取焦点
  185. };
  186. },
  187. computed: {
  188. ...mapState(["window", "dict", "customerOrg", "patientRegister", "personnelUnit"]),
  189. },
  190. created(){
  191. this.dictInit()
  192. },
  193. updated(){
  194. this.$nextTick(() => {
  195. this.$refs['patientRegister_patientRegisterAbs'].doLayout()
  196. })
  197. },
  198. mounted() {
  199. },
  200. methods: {
  201. ...mapActions(['getCustomerOrgGroup', 'getPatientRegisterAbs']),
  202. dddw,moment,deepCopy,
  203. // 初始化字典信息
  204. dictInit(){
  205. // 项目类别 树结构
  206. getapi("/api/app/item-type/by-code-all").then((res) => {
  207. if (res.code != -1) {
  208. this.dict.itemTypeTree = res.data;
  209. tcdate(this.dict.itemTypeTree);
  210. }
  211. });
  212. // 获取组合项目
  213. postapi('/api/app/asbitem/getasbitemlist',{isFilterActive:'Y'}).then(res =>{
  214. if(res.code != -1){
  215. this.asbItem = res.data
  216. this.asbItemAll = res.data
  217. this.asbItemQuick = res.data
  218. this.quickAsb = res.data
  219. }
  220. });
  221. },
  222. // 获取人员组合项目信息
  223. async getPrAsb(id){
  224. // debugger
  225. // 清空待删除、分组、套餐
  226. console.log('getPrAsb(id)',`getPrAsb(${id})`)
  227. this.prAsbDels = []
  228. this.groupAsbs = []
  229. this.packageAsbs = []
  230. let result = await proApi.getPrAsb(id)
  231. this.prAsb = result.data
  232. this.refreshAsbitem()
  233. },
  234. // 复制新增 拷贝明细项目
  235. async copyNew(){
  236. if(this.oldFormId){
  237. let result = await proApi.getPrAsb(this.oldFormId)
  238. this.prAsb = result.data
  239. this.prAsb.forEach(e => {
  240. e.id = '';
  241. e.patientRegisterId = '';
  242. e.isCharge = 'N';
  243. e.checkCompleteFlag = '0'
  244. e.isLock = 'N'
  245. })
  246. this.refreshAsbitem()
  247. }
  248. },
  249. // 刷新未选组合项目
  250. refreshAsbitem(){
  251. let asbItemAll = deepCopy(this.asbItemAll)
  252. arrayReduce(asbItemAll, this.prAsb, "id=asbitemId");
  253. this.changeItemType();
  254. this.asbItemQuick = deepCopy(asbItemAll);
  255. this.quickAsb = deepCopy(asbItemAll);
  256. },
  257. handleRowClassName({ row, rowIndex }) {
  258. if (row.choosed) {
  259. return 'current-row';
  260. } else {
  261. return '';
  262. }
  263. },
  264. //选择 未选的组合项目
  265. chooseAsbItem(row){
  266. this.asbItem.forEach((e,index) => {
  267. e.index = index;
  268. return e
  269. });
  270. // 按住了shift键
  271. if (this.window.shift) {
  272. //清除所有选择
  273. this.asbItem.forEach(e => {
  274. e.choosed = false;
  275. return e
  276. });
  277. if (this.startPoint == - 1) {
  278. this.asbItem[row.index].choosed = true;
  279. this.startPoint = row.index;
  280. return
  281. }
  282. if (this.startPoint > row.index) {
  283. for (let i = row.index; i <= this.startPoint; i++) {
  284. this.asbItem[i].choosed = true
  285. }
  286. } else if (this.startPoint <= row.index) {
  287. for (let i = this.startPoint; i <= row.index; i++) {
  288. this.asbItem[i].choosed = true
  289. }
  290. }
  291. return
  292. }
  293. // 按住了ctrl 键
  294. if (this.window.ctrl) {
  295. console.log('this.window.ctrl',this.window.ctrl,this.asbItem)
  296. this.asbItem[row.index].choosed = true;
  297. this.startPoint = row.index;
  298. return
  299. }
  300. // 未按住了ctrl 、shift 键
  301. //清除所有选择
  302. //console.log('清除所有选择')
  303. this.asbItem.forEach(e => {
  304. e.choosed = false;
  305. return e
  306. });
  307. this.asbItem[row.index].choosed = true;
  308. this.startPoint = row.index;
  309. },
  310. //选择 已选的组合项目
  311. removeAsbItem(row){
  312. this.prAsb.forEach((e,index) => {
  313. e.index = index;
  314. return e
  315. });
  316. // 按住了shift键
  317. if (this.window.shift) {
  318. //清除所有选择
  319. this.prAsb.forEach(e => {
  320. e.choosed = false;
  321. return e
  322. });
  323. if (this.PstartPoint == - 1) {
  324. this.prAsb[row.index].choosed = true;
  325. this.PstartPoint = row.index;
  326. return
  327. }
  328. if (this.PstartPoint > row.index) {
  329. for (let i = row.index; i <= this.PstartPoint; i++) {
  330. this.prAsb[i].choosed = true
  331. }
  332. } else if (this.PstartPoint <= row.index) {
  333. for (let i = this.PstartPoint; i <= row.index; i++) {
  334. this.prAsb[i].choosed = true
  335. }
  336. }
  337. return
  338. }
  339. // 按住了ctrl 键
  340. if (this.window.ctrl) {
  341. console.log('this.window.ctrl',this.window.ctrl,this.prAsb)
  342. this.prAsb[row.index].choosed = true;
  343. this.PstartPoint = row.index;
  344. return
  345. }
  346. // 未按住了ctrl 、shift 键
  347. //清除所有选择
  348. //console.log('清除所有选择')
  349. this.prAsb.forEach(e => {
  350. e.choosed = false;
  351. return e
  352. });
  353. this.prAsb[row.index].choosed = true;
  354. this.PstartPoint = row.index;
  355. },
  356. //更新所选组合项目
  357. async onSubmit(msg) {
  358. let ret = false
  359. ret = await this.batchAddAsb()
  360. if(!ret){
  361. if(msg) this.$message.warning(`组合项目 ${msg} 失败!`)
  362. return
  363. }
  364. ret = await this.batchDelAsb()
  365. if(!ret){
  366. if(msg) this.$message.warning(`组合项目 ${msg} 失败!`)
  367. return
  368. }
  369. ret = await this.batchEditAsb()
  370. if(!ret){
  371. if(msg) this.$message.warning(`组合项目 ${msg} 失败!`)
  372. return
  373. }
  374. console.log('this.prAsbOpraOpts.formId',this.prAsbOpraOpts.formId)
  375. if(this.prAsbOpraOpts.formId){
  376. this.refreshFormId()
  377. }else{
  378. //触发保存人员基本信息
  379. this.triggerHeadSave()
  380. this.getPrAsb(this.prForm.id)
  381. }
  382. },
  383. //未选组合项目 勾选情况
  384. handleSelectionChange(val) {
  385. // this.selecteddata = val;
  386. this.asbItemChoosed = val;
  387. //console.log(this.asbItemChoosed);
  388. },
  389. // 添加组合项目
  390. ///api/app/register-asbitem/many/3fa85f64-5717-4562-b3fc-2c963f66afa6'
  391. addAbs(asbItemChoosed,oprType) {
  392. let checked = true
  393. let payTypeFlag = '0' //默认个人支付
  394. //勾选时不需要此操作 start
  395. if(oprType && oprType == 'all'){
  396. asbItemChoosed = deepCopy(this.asbItem)
  397. }else if(oprType && oprType == 'choosed'){
  398. asbItemChoosed = []
  399. this.asbItem.forEach(e =>{
  400. if(e.choosed){
  401. asbItemChoosed.push(e)
  402. e.choosed = false
  403. }
  404. })
  405. }
  406. //勾选时不需要此操作 end
  407. if (asbItemChoosed.length < 1) {
  408. this.$message.warning("请选择要添加的组合项目")
  409. return
  410. }
  411. //性别、年龄判断
  412. // "displayName": "身高体重",
  413. // "shortName": "哈f哈",
  414. // "forSexId": "F",
  415. // "itemTypeId": "3a0b16de-75b9-c910-c61b-844709a88940",
  416. // "price": 0,
  417. console.log('asbItemChoosed.length', asbItemChoosed.length)
  418. for (let i = 0; i < asbItemChoosed.length; i++) {
  419. if (this.prForm.sexId == 'U') break //未选性别时,无需判断组合项目性别限制
  420. if (asbItemChoosed[i].forSexId == 'A') continue
  421. if (asbItemChoosed[i].forSexId != this.prForm.sexId) {
  422. this.$message.warning(`所选项目:${asbItemChoosed[i].displayName},不适合当前人员性别`)
  423. checked = false
  424. break
  425. }
  426. }
  427. //console.log(222,checked)
  428. if (!checked) return
  429. if (this.prForm.customerOrgId != this.dict.personOrgId) payTypeFlag = '1'
  430. for (let i = 0; i < asbItemChoosed.length; i++) {
  431. let pojo = {
  432. asbitemId: asbItemChoosed[i].id,
  433. asbitemName: asbItemChoosed[i].displayName,
  434. patientRegisterId: this.prForm.id,
  435. standardPrice: asbItemChoosed[i].price,
  436. chargePrice: asbItemChoosed[i].price,
  437. payTypeFlag,
  438. isCharge: "N",
  439. discount:100,
  440. amount: 1,
  441. total: asbItemChoosed[i].price,
  442. }
  443. this.prAsb.push(pojo)
  444. }
  445. this.refreshAsbitem()
  446. },
  447. //人员已选组合项目 勾选情况
  448. selecteditems(val) {
  449. this.patientRegisterAbsChoosed = val
  450. },
  451. //批量提交添加组合项目
  452. async batchAddAsb() {
  453. let ret = false
  454. let patientRegisterId = this.prForm.id || this.prAsbOpraOpts.formId
  455. if(!patientRegisterId){
  456. this.$message.warning("人员基本信息未保存");
  457. return ret
  458. }
  459. let registerAsbitems = []
  460. this.prAsb.forEach(e => {
  461. if(!e.id){
  462. registerAsbitems.push({
  463. asbitemId: e.asbitemId,
  464. patientRegisterId,
  465. standardPrice: e.standardPrice,
  466. chargePrice: e.chargePrice,
  467. payTypeFlag: e.payTypeFlag,
  468. isCharge: e.isCharge,
  469. amount: e.amount,
  470. groupPackageId: e.groupPackageId
  471. })
  472. }
  473. })
  474. if(registerAsbitems.length == 0) return true
  475. let body = {
  476. organizationUnitId:this.prForm.organizationUnitId,
  477. registerAsbitems,
  478. isAutoMerger:'Y'
  479. }
  480. try {
  481. let res = await postapi('/api/app/registerasbitem/createregisterasbitemmany', body)
  482. if(res.code != -1) ret = true
  483. } catch (error) {
  484. console.log('批量添加组合项目失败',error)
  485. }
  486. return ret
  487. },
  488. //批量提交更新组合项目
  489. async batchEditAsb() {
  490. let ret = false
  491. let body = []
  492. this.prAsb.forEach(e => {
  493. if(e.id){
  494. body.push({
  495. registerAsbitemId:e.id,
  496. input: {
  497. chargePrice: e.chargePrice,
  498. payTypeFlag: e.payTypeFlag,
  499. isCharge: e.isCharge,
  500. amount: e.amount,
  501. groupPackageId: e.groupPackageId
  502. }
  503. })
  504. }
  505. })
  506. if(body.length == 0) return true
  507. try {
  508. let res = await postapi(`/api/app/registerasbitem/updatemany`, body)
  509. if(res.code != -1) ret = true
  510. } catch (error) {
  511. console.log('批量提交更新组合项目失败',error)
  512. }
  513. return ret
  514. },
  515. //批量提交删除组合项目
  516. async batchDelAsb() {
  517. let ret = false
  518. if(this.prAsbDels.length == 0) return true
  519. let registerAsbitemIds=[]
  520. this.prAsbDels.forEach(e => {
  521. registerAsbitemIds.push(e.id)
  522. })
  523. console.log(`/api/app/registerasbitem/deletemany`, {registerAsbitemIds})
  524. try {
  525. let res = await postapi(`/api/app/registerasbitem/deletemany`, {registerAsbitemIds})
  526. if(res.code != -1) ret = true
  527. } catch (error) {
  528. console.log('批量删除组合项目失败',error)
  529. }
  530. return ret
  531. },
  532. //删除 人员已选中的组合项目
  533. ///api/app/register-asbitem/many?RegisterAsbitemIds=3fa85f64-5717-4562-b3fc-2c963f66afa6
  534. delAbs(absForDel,oprType) {
  535. let chargeComplete = ''
  536. let lfind = -1
  537. let tempRd = {}
  538. //勾选时不需要此操作 start
  539. if(oprType && oprType == 'all'){
  540. absForDel = deepCopy(this.prAsb)
  541. }else if(oprType && oprType == 'choosed'){
  542. absForDel = []
  543. this.prAsb.forEach(e =>{
  544. if(e.choosed){
  545. absForDel.push(e)
  546. e.choosed = false
  547. }
  548. })
  549. }
  550. //勾选时不需要此操作 end
  551. if (absForDel.length < 1) {
  552. this.$message.warning("请选择要移除的组合项目")
  553. return
  554. }
  555. absForDel.forEach(e => {
  556. // 如果已经收费 或 体检,则不允许删除
  557. if (e.isCharge == 'Y' || (e.checkCompleteFlag && e.checkCompleteFlag != '0')) {
  558. chargeComplete += e.asbitemName + ','
  559. }else{
  560. lfind = arrayExistObj(this.prAsb, 'asbitemId', e.asbitemId)
  561. if(lfind > -1){
  562. tempRd = Object.assign({},this.prAsb.splice(lfind,1)[0])
  563. if(e.id) this.prAsbDels.push(tempRd)
  564. }
  565. }
  566. })
  567. //刷新
  568. this.refreshAsbitem()
  569. if (chargeComplete) {
  570. this.$message({ type: "info", message: `所选项目:${chargeComplete}已收费或已检,不可删除!` });
  571. }
  572. },
  573. //双击删除已选项目
  574. removeAbs(row) {
  575. this.delAbs([row]);
  576. },
  577. //项目类别过滤 组合项目,未过滤已选择的组合项目
  578. changeItemType() {
  579. //console.log('getAsbItemByItemType', typeof this.itemTypeIds, this.itemTypeIds)
  580. let asbItemAll = deepCopy(this.asbItemAll)
  581. let lv = "";
  582. if (typeof this.itemTypeIds == "object") {
  583. if(this.itemTypeIds.length > 0) lv = this.itemTypeIds[this.itemTypeIds.length - 1];
  584. }
  585. if (lv) {
  586. this.asbItem = arrayFilter(asbItemAll, "itemTypeId", lv);
  587. } else {
  588. this.asbItem = deepCopy(asbItemAll);
  589. }
  590. arrayReduce(this.asbItem, this.prAsb, "id=asbitemId");
  591. },
  592. //选中 分组 所包含的组合项目
  593. getGroupAsbs(id){
  594. if(!id){
  595. this.groupAsbs = []
  596. this.changeGroup(id)
  597. return
  598. }
  599. getapi(`/api/app/customerorggroupdetail/getcustomerorggroupdetailinasbitem?CustomerOrgGroupId=${id}`)
  600. .then((res) => {
  601. if(res.code != -1){
  602. this.groupAsbs = res.data
  603. this.changeGroup(id)
  604. }
  605. });
  606. },
  607. //选中 套餐 所包含的组合项目
  608. getPackageAsbs(id){
  609. if(!id){
  610. this.packageAsbs = []
  611. this.changePackage(id)
  612. return
  613. }
  614. postapi('/api/app/medicalpackagedetail/getmedicalpackageinasbitem',{medicalPackageId:id})
  615. .then((res) => {
  616. if(res.code != -1){
  617. this.packageAsbs = res.data
  618. this.changePackage(id)
  619. }
  620. });
  621. },
  622. // 更换分组
  623. changeGroup(newId){
  624. //已收费项目,不更改收费方式、价格及数量,只更改分组id
  625. let payTypeFlag = '0'
  626. let lfind = -1
  627. let tempRd = {}
  628. if(!newId){
  629. this.setGroupPackageNull()
  630. return
  631. }
  632. if (this.prForm.customerOrgId != this.dict.personOrgId) payTypeFlag = '1' //单位支付
  633. for(let i = this.prAsb.length - 1;i>-1;i--){
  634. lfind = arrayExistObj(this.groupAsbs,'asbitemId',this.prAsb[i].asbitemId)
  635. if(lfind > -1){
  636. //找到了则更新此项目
  637. tempRd = Object.assign({},this.groupAsbs.splice(lfind,1)[0])
  638. this.prAsb[i].groupPackageId = newId
  639. if(this.prAsb[i].isCharge != 'Y'){
  640. this.prAsb[i].payTypeFlag = payTypeFlag
  641. this.prAsb[i].amount = tempRd.customerOrgGroupDetailAmount
  642. this.prAsb[i].standardPrice = tempRd.price
  643. this.prAsb[i].chargePrice = tempRd.customerOrgGroupDetailPrice
  644. this.prAsb[i].discount = tempRd.discount
  645. }
  646. }else{
  647. //没找到则移除此项目
  648. if(this.prAsb[i].isCharge == 'Y' || (this.prAsb[i].checkCompleteFlag && this.prAsb[i].checkCompleteFlag != '0')){
  649. this.prAsb[i].groupPackageId = null
  650. }else{
  651. tempRd = Object.assign({},this.prAsb.splice(i,1)[0])
  652. if(tempRd.id) this.prAsbDels.push(tempRd)
  653. }
  654. }
  655. }
  656. // debugger
  657. //未找到则添加(如果在待删除中找到记录,则待删除中记录移至当前显示记录中来)
  658. this.groupAsbs.forEach(e =>{
  659. lfind = arrayExistObj(this.prAsbDels,'asbitemId',e.asbitemId)
  660. if(lfind > -1){
  661. tempRd = Object.assign(this.prAsbDels.splice(lfind,1)[0],
  662. {
  663. groupPackageId:newId,
  664. standardPrice:e.price,
  665. chargePrice:e.customerOrgGroupDetailPrice,
  666. payTypeFlag,
  667. isCharge: "N",
  668. discount:e.discount,
  669. amount:e.customerOrgGroupDetailAmount,
  670. total: Math.round(e.customerOrgGroupDetailAmount * e.customerOrgGroupDetailPrice * 100)/100
  671. }
  672. )
  673. }else{
  674. tempRd = {
  675. groupPackageId:newId,
  676. asbitemId:e.asbitemId,
  677. asbitemName:e.displayName,
  678. patientRegisterId:this.prForm.id,
  679. standardPrice:e.price,
  680. chargePrice:e.customerOrgGroupDetailPrice,
  681. payTypeFlag,
  682. isCharge: "N",
  683. discount:e.discount,
  684. amount:e.customerOrgGroupDetailAmount,
  685. total: Math.round(e.customerOrgGroupDetailAmount * e.customerOrgGroupDetailPrice * 100)/100
  686. }
  687. }
  688. this.prAsb.push(tempRd)
  689. })
  690. this.refreshAsbitem()
  691. },
  692. // 更换套餐
  693. changePackage(newId){
  694. //已收费项目,不更改收费方式、价格及数量,只更改分组id
  695. let payTypeFlag = '0'
  696. let lfind = -1
  697. let tempRd = {}
  698. if(!newId){
  699. this.setGroupPackageNull()
  700. return
  701. }
  702. if (this.prForm.customerOrgId != this.dict.personOrgId) payTypeFlag = '1' //单位支付
  703. for(let i = this.prAsb.length - 1;i>-1;i--){
  704. lfind = arrayExistObj(this.packageAsbs,'id',this.prAsb[i].asbitemId)
  705. if(lfind > -1){
  706. //找到了则更新此项目
  707. tempRd = Object.assign({},this.packageAsbs.splice(lfind,1)[0])
  708. this.prAsb[i].groupPackageId = newId
  709. if(this.prAsb[i].isCharge != 'Y'){
  710. this.prAsb[i].payTypeFlag = payTypeFlag
  711. this.prAsb[i].amount = tempRd.medicalPackageDetailAmount
  712. this.prAsb[i].standardPrice = tempRd.price
  713. this.prAsb[i].chargePrice = tempRd.medicalPackageDetailPrice
  714. this.prAsb[i].discount = tempRd.discount
  715. }
  716. }else{
  717. //没找到则移除此项目
  718. if(this.prAsb[i].isCharge == 'Y' || (this.prAsb[i].checkCompleteFlag && this.prAsb[i].checkCompleteFlag != '0')){
  719. this.prAsb[i].groupPackageId = null
  720. }else{
  721. tempRd = Object.assign({},this.prAsb.splice(i,1)[0])
  722. if(tempRd.id) this.prAsbDels.push(tempRd)
  723. }
  724. }
  725. }
  726. //未找到则添加(如果在待删除中找到记录,则待删除中记录移至当前显示记录中来)
  727. this.packageAsbs.forEach(e =>{
  728. lfind = arrayExistObj(this.prAsbDels,'asbitemId',e.id)
  729. if(lfind > -1){
  730. tempRd = Object.assign(this.prAsbDels.splice(lfind,1)[0],
  731. {
  732. groupPackageId:newId,
  733. standardPrice:e.price,
  734. chargePrice:e.medicalPackageDetailPrice,
  735. payTypeFlag,
  736. isCharge: "N",
  737. discount:e.discount,
  738. amount:e.medicalPackageDetailAmount,
  739. total: Math.round(e.medicalPackageDetailAmount * e.medicalPackageDetailPrice * 100)/100
  740. }
  741. )
  742. }else{
  743. tempRd = {
  744. groupPackageId:newId,
  745. asbitemId:e.id,
  746. asbitemName:e.displayName,
  747. patientRegisterId:this.prForm.id,
  748. standardPrice:e.price,
  749. chargePrice:e.medicalPackageDetailPrice,
  750. payTypeFlag,
  751. isCharge: "N",
  752. discount:e.discount,
  753. amount:e.medicalPackageDetailAmount,
  754. total: Math.round(e.medicalPackageDetailAmount * e.medicalPackageDetailPrice * 100)/100
  755. }
  756. }
  757. this.prAsb.push(tempRd)
  758. })
  759. this.refreshAsbitem()
  760. },
  761. // 从 有分组/套餐 切换成 无分组/套餐 时
  762. setGroupPackageNull(){
  763. this.prAsb.forEach(e =>{
  764. e.groupPackageId = null
  765. })
  766. },
  767. //双击选择组合项目
  768. dbClickChoosedAsb(row) {
  769. this.addAbs([row]);
  770. },
  771. //快速选择组合项目
  772. quickChoosedAsb(v) {
  773. //远程查询时,设置了 value-key 也不管用,只能取到value console.log('quickChoosedAsb',v)
  774. let lfind = -1
  775. if (v) {
  776. lfind = arrayExistObj(this.asbItemQuick, 'id', v)
  777. if (lfind > -1) {
  778. this.addAbs([this.asbItemQuick[lfind]])
  779. }
  780. }
  781. //this.$refs['quickAsbOCX'].focus(); //asbItemId
  782. this.$nextTick(() => {
  783. this.$refs['quickAsbOCX'].blur(); //total asbItemId
  784. this.asbItemId = ''
  785. this.quickAsb = deepCopy(this.asbItemQuick)
  786. this.$refs['quickAsbOCX'].focus(); //total asbItemId
  787. });
  788. },
  789. //快速选择组合项目时,调整可按拼间简码及简称查找
  790. filterMethod(keyWords) {
  791. //console.log('filterMethod',this.asbItemQuick)
  792. if (keyWords) {
  793. this.quickAsb = [];
  794. this.asbItemQuick.forEach(item => {
  795. if (item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  796. || item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  797. || item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1) {
  798. this.quickAsb.push(item);
  799. }
  800. });
  801. } else {
  802. this.quickAsb = deepCopy(this.asbItemQuick);
  803. }
  804. },
  805. //修改总折扣
  806. changeAllDiscount() {
  807. if (!this.discount || this.discount == 0) return
  808. if (!this.prAsb || this.prAsb.length == 0) return
  809. this.prAsb.forEach(e => {
  810. e.discount = this.discount
  811. e.chargePrice = Math.round(e.standardPrice * this.discount) / 100
  812. e.total = Math.round(e.standardPrice * this.discount * e.amount) / 100
  813. });
  814. // this.onSubmit('')
  815. },
  816. //修改总金额
  817. changeTotal() {
  818. if (!this.total) return
  819. if (!this.prAsb || this.prAsb.length == 0) return
  820. let sumChargeDetails = Number(0) //单个标准价折后价 合计总计
  821. let qtyIsOneLast = 0 //数量为1的最后行项目,用于返写金额
  822. // console.log('this.total / this.totalStand',this.total , this.totalStand)
  823. this.discount = Math.round((100 * this.total / this.totalStand) * 100)/100
  824. this.prAsb.forEach((e, index) => {
  825. if (e.amount == 1) qtyIsOneLast = index
  826. e.discount = this.discount
  827. e.chargePrice = Math.round((e.standardPrice * this.discount / 100) * 100)/100
  828. e.total = Math.round((e.standardPrice * this.discount * e.amount / 100) * 100)/100
  829. sumChargeDetails += Math.round((e.standardPrice * this.discount * e.amount / 100) * 100)/100
  830. });
  831. // console.log('this.total - sumChargeDetails', sumChargeDetails, this.total - sumChargeDetails)
  832. //平衡金额(按总价折扣后,再根据折扣合计 会出现金额差)
  833. if (this.total != sumChargeDetails) {
  834. console.log('qtyIsOneLast',qtyIsOneLast)
  835. this.prAsb[qtyIsOneLast].total =
  836. Math.round((Number(this.prAsb[qtyIsOneLast].total) + Number(this.total) - Number(sumChargeDetails))*100)/100
  837. this.prAsb[qtyIsOneLast].chargePrice =
  838. Math.round(this.prAsb[qtyIsOneLast].total * 100 / this.prAsb[qtyIsOneLast].amount)/100
  839. if(this.prAsb[qtyIsOneLast].standardPrice != 0){
  840. this.prAsb[qtyIsOneLast].discount =
  841. Math.round(this.prAsb[qtyIsOneLast].chargePrice * 10000/this.prAsb[qtyIsOneLast].standardPrice)/100
  842. }
  843. }
  844. //this.onSubmit('')
  845. },
  846. //修改数量
  847. changeDiscount(index) {
  848. //console.log('index',index)
  849. if (!this.prAsb || this.prAsb.length == 0) return
  850. if (!this.prAsb[index].discount) return
  851. //console.log(this.prAsb[index].chargePrice,this.prAsb[index].standardPrice)
  852. this.prAsb[index].chargePrice = Math.round(this.prAsb[index].standardPrice * this.prAsb[index].discount)/100
  853. this.prAsb[index].total = this.prAsb[index].chargePrice * this.prAsb[index].amount
  854. // this.onSubmit('')
  855. },
  856. //修改单价
  857. changePrice(index) {
  858. //console.log('index',index)
  859. if (!this.prAsb || this.prAsb.length == 0) return
  860. if (!this.prAsb[index].chargePrice) return
  861. //console.log(this.prAsb[index].chargePrice,this.prAsb[index].standardPrice)
  862. this.prAsb[index].discount = Math.round(this.prAsb[index].chargePrice * 10000 / this.prAsb[index].standardPrice)/100
  863. // this.onSubmit('')
  864. },
  865. //自定义计算列
  866. getSummaries(param) {
  867. const { columns, data } = param;
  868. const sumCol = [1, 5] //需合计的列
  869. const sums = [];
  870. columns.forEach((column, index) => {
  871. //console.log('column, index,data',column, index,data)
  872. //显示合计列
  873. if (index === 0) {
  874. sums[index] = '合计';
  875. return;
  876. }
  877. //不合计的列
  878. if (sumCol.indexOf(index) == -1) {
  879. sums[index] = '';
  880. return;
  881. }
  882. sums[index] = 0
  883. data.forEach(e => {
  884. if (!isNaN(e[column.property])){
  885. if(index == 1){
  886. sums[index] += e[column.property] * e['amount']
  887. }else{
  888. sums[index] += e[column.property]
  889. }
  890. }
  891. })
  892. sums[index] = Math.round(sums[index] * 100)/100 //+ ' 元';
  893. // const values = data.map(item => Number(item[column.property]));
  894. // if (!values.every(value => isNaN(value))) {
  895. // sums[index] = values.reduce((prev, curr) => {
  896. // const value = Number(curr);
  897. // if (!isNaN(value)) {
  898. // //return prev + curr; //原始
  899. // return prev + curr; //改造
  900. // } else {
  901. // return prev;
  902. // }
  903. // }, 0);
  904. // sums[index] = sums[index].toFixed(2) + ' 元';
  905. // } else {
  906. // sums[index] = 'N/A';
  907. // }
  908. });
  909. this.totalStand = sums[1];
  910. //console.log('this.totalFoucs/this.discountFoucs',this.totalFoucs,this.discountFoucs)
  911. if (!this.totalFoucs) this.total = sums[5];
  912. if (!this.discountFoucs) this.discount = Math.round(this.total * 10000 / this.totalStand)/100;
  913. return sums;
  914. },
  915. },
  916. //监听事件
  917. watch: {
  918. //配合复制新增使用 查询人员下的组合项目
  919. "prForm.id":{
  920. immediate: true, // 立即执行
  921. deep: true, // 深度监听复杂类型内变化
  922. handler(newVal,oldVal){
  923. this.oldFormId = oldVal
  924. if(newVal != oldVal){
  925. if(newVal == ''){
  926. this.getPrAsb(newVal)
  927. }else if(newVal != this.prAsbOpraOpts.formId){
  928. this.getPrAsb(newVal)
  929. }
  930. }
  931. }
  932. },
  933. //人员 id 未变的情况下,触发刷新,主要针对收费
  934. "prAsbOpraOpts.prAsbQuery":{
  935. // immediate: true, // 立即执行
  936. deep: true, // 深度监听复杂类型内变化
  937. handler(newVal,oldVal){
  938. console.log('watch:prAsbOpraOpts.prAsbQuery:',newVal,oldVal)
  939. if(newVal != oldVal){
  940. this.getPrAsb(this.prForm.id)
  941. }
  942. }
  943. },
  944. //按钮更新支付方式
  945. "prAsbOpraOpts.payTypeFlag":{
  946. // immediate: true, // 立即执行
  947. deep: true, // 深度监听复杂类型内变化
  948. handler(newVal, oldVal) {
  949. if (newVal != oldVal && newVal != '') {
  950. this.prAsb.forEach(e =>{
  951. e.payTypeFlag = newVal;
  952. return e;
  953. });
  954. // this.onSubmit('调整支付方式');
  955. }
  956. }
  957. },
  958. //更换分组
  959. "prAsbOpraOpts.prAsbGroup":{
  960. // immediate: true, // 立即执行
  961. deep: true, // 深度监听复杂类型内变化
  962. handler(newVal, oldVal) {
  963. if (newVal != oldVal) {
  964. this.getGroupAsbs(this.prForm.customerOrgGroupId)
  965. }
  966. }
  967. },
  968. //更换套餐
  969. "prAsbOpraOpts.prAsbPackage":{
  970. // immediate: true, // 立即执行
  971. deep: true, // 深度监听复杂类型内变化
  972. handler(newVal, oldVal) {
  973. if (newVal != oldVal) {
  974. this.getPackageAsbs(this.prForm.medicalPackageId)
  975. }
  976. }
  977. },
  978. //复制新增 拷贝明细项目
  979. "prAsbOpraOpts.copyNew":{
  980. // immediate: true, // 立即执行
  981. deep: true, // 深度监听复杂类型内变化
  982. handler(newVal, oldVal) {
  983. if (newVal != oldVal) {
  984. this.copyNew()
  985. }
  986. }
  987. },
  988. //体检信息保存,触发已选组合项目保存
  989. "prAsbOpraOpts.prAsbSave"(newVal, oldVal) {
  990. console.log("patientRegister.saveTimes newVal:", newVal, " oldVal:", oldVal);
  991. if (newVal != oldVal) {
  992. this.onSubmit('');
  993. }
  994. },
  995. },
  996. };
  997. </script>
  998. <style lang="scss" scoped>
  999. @import "../../assets/css/global_table.css";
  1000. @import "../../assets/css/global_input.css";
  1001. @import "../../assets/css/global.css";
  1002. .mainareaBox {
  1003. border: 1px solid #000;
  1004. height: v-bind("(window.pageHeight > 700 ? (window.pageHeight - 440) : 260) + 'px'");
  1005. margin-top: 5px;
  1006. }
  1007. .btnList {
  1008. margin-top: 5px;
  1009. margin-left: 5px;
  1010. margin-right: 5px;
  1011. }
  1012. .disTotal {
  1013. margin-left: 10px;
  1014. }
  1015. </style>