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.

1146 lines
40 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
  1. <template>
  2. <div>
  3. <el-card>
  4. <div slot="header">体检收费</div>
  5. <div style="display: flex; width: 100%;">
  6. <!-- 查询条件 与列表 -->
  7. <div class="queryDivClass">
  8. <!-- 查询条件 -->
  9. <div style="height: 80px;">
  10. <div style="display:flex;">
  11. <div>
  12. <span>登记日期</span>
  13. <el-date-picker v-model="query.startDate" type="date" placeholder="起始日期" size="small" style="width:90px;"/>
  14. <span></span>
  15. <el-date-picker v-model="query.endDate" type="date" placeholder="截止日期" size="small" style="width:90px;"/>
  16. </div>
  17. <div style="margin-left:10px;">
  18. <el-button type="primary" class="btnClass" @click="Query" size="small" style="width:95px;">查询</el-button>
  19. </div>
  20. </div>
  21. <div style="display:flex;margin-top:10px;">
  22. <el-radio-group v-model="query.chargeFlag" @input="Query" size="mini" style="margin-top:8px;">
  23. <el-radio label="N">未收费</el-radio>
  24. <el-radio label="Y">已收费</el-radio>
  25. <el-radio label="B">已退费</el-radio>
  26. </el-radio-group>
  27. <div v-if="query.chargeFlag != 'N'" style="margin-left:20px;">
  28. <span>发票号</span>
  29. <el-input placeholder="发票/收据号" v-model="query.invoiceNo" size="small" style="width: 100px;" clearable
  30. @change="Query('invoiceNo')" />
  31. </div>
  32. </div>
  33. </div>
  34. <!-- 列表 -->
  35. <div class="prListDivClass">
  36. <el-table :data="patientList" border highlight-current-row ref="patientList"
  37. :height="(window.pageHeight > 600 ? (window.pageHeight - 230) : 370)" @row-click="rowClick" size="small">
  38. <!--
  39. <el-table-column prop="patientRegisterId" label="体检记录ID" />
  40. -->
  41. <el-table-column prop="customerOrgParentName" label="单位" width="180">
  42. <template slot-scope="scope">
  43. <div>{{ scope.row.customerOrgParentName ? scope.row.customerOrgParentName : scope.row.customerOrgName }}
  44. </div>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop="patientName" label="姓名" />
  48. <el-table-column prop="sexId" label="性别" />
  49. <el-table-column prop="age" label="年龄" />
  50. <el-table-column prop="patientRegisterNo" label="条码号" width="150" />
  51. <el-table-column prop="patientNo" label="档案号" />
  52. <el-table-column prop="medicalTimes" label="体检次数" />
  53. <el-table-column prop="isVip" label="是否VIP">
  54. <template slot-scope="scope">
  55. <div>{{ scope.row.isVip == "Y" ? "是" : "否" }}</div>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="salesman" label="介绍人" />
  59. <el-table-column prop="invoiceNo" label="发票号" />
  60. <el-table-column prop="invoiceOrgName" label="发票抬头" />
  61. <!--
  62. <el-table-column prop="chargeId" label="介绍人" />
  63. <el-table-column prop="chargeBackId" label="介绍人" />
  64. -->
  65. <el-table-column prop="email" label="邮箱" width="180" />
  66. <el-table-column prop="idNo" label="身份证" width="150" />
  67. <el-table-column prop="mobileTelephone" label="手机" width="100" />
  68. <el-table-column prop="telephone" label="电话" width="100" />
  69. <el-table-column prop="address" label="地址" width="300" />
  70. </el-table>
  71. </div>
  72. </div>
  73. <!-- 收费操作 -->
  74. <div class="queryDivClass" style="margin-left:5px;">
  75. <!-- 查询信息 -->
  76. <div style="height: 40px;">
  77. <div style="display: flex; flex-wrap: wrap;margin-top:40px; height:40px; width: 100%;">
  78. <div class="query">
  79. <span>条码号</span>
  80. <el-input placeholder="条码号" v-model="query.patientRegisterNo" size="small" style="width: 140px;" clearable
  81. @change="Query('patientRegisterNo')" />
  82. </div>
  83. <div class="query">
  84. <span>档案号</span>
  85. <el-input placeholder="档案号" v-model="query.patientNo" size="small" style="width: 100px;" clearable
  86. @change="Query('patientNo')" />
  87. </div>
  88. <div class="query">
  89. <span>姓名</span>
  90. <el-input placeholder="姓名" v-model="query.patientName" size="small" style="width: 100px;" disabled
  91. @change="Query" />
  92. </div>
  93. </div>
  94. </div>
  95. <!-- 收费信息 -->
  96. <div class="prListDivClass">
  97. <!-- charge -->
  98. <div style="height:148px;">
  99. <el-form ref="form" :model="form" label-width="80px" :rules="rules" size="small"
  100. :disabled="query.chargeFlag != 'N'">
  101. <el-row>
  102. <el-col :span="12">
  103. <el-form-item label="发票号" prop="invoiceNo">
  104. <el-input v-model="form.invoiceNo" />
  105. </el-form-item>
  106. </el-col>
  107. <el-col :span="12">
  108. <el-form-item label="开票抬头" prop="invoiceOrgName">
  109. <el-input v-model="form.invoiceOrgName" />
  110. </el-form-item>
  111. </el-col>
  112. </el-row>
  113. <el-row>
  114. <el-col :span="12">
  115. <el-form-item label="折扣" prop="discount">
  116. <el-input v-model="form.discount" @input="discountToDetails" />
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="12">
  120. <el-form-item label="应收金额" prop="total">
  121. <el-input v-model="form.total" @input="totalToDetails" />
  122. </el-form-item>
  123. </el-col>
  124. </el-row>
  125. <el-row v-if="query.chargeFlag == 'N'">
  126. <el-col :span="12">
  127. <el-form-item label="预收金额" prop="preTotal">
  128. <el-input v-model="form.preTotal" @input="findBalance" />
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="12">
  132. <el-form-item label="找零" prop="balance">
  133. <el-input v-model="form.balance" disabled />
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. </el-form>
  138. </div>
  139. <!-- charge_pay -->
  140. <div>
  141. <div style="margin-top:5px;font-size:10px;">{{ query.chargeFlag == 'B' ? '退' : '收' }}费方式</div>
  142. <el-table :data="chargePays" border highlight-current-row size="small"
  143. :height="window.pageHeight > 600 ? (window.pageHeight - 270 - 146) / 2 : 92">
  144. <el-table-column prop="payModeId" :label="(query.chargeFlag == 'B' ? '退' : '收') + '费方式'" width="180">
  145. <template slot-scope="scope">
  146. <div>{{ dddw(dict.payMode, "id", scope.row.payModeId, "displayName") }}</div>
  147. </template>
  148. </el-table-column>
  149. <el-table-column prop="chargeMoney" label="金额">
  150. <template slot-scope="scope">
  151. <el-input type="number" v-model="scope.row.chargeMoney" size="small" @input="inputMoney"
  152. :disabled="query.chargeFlag == 'B'" />
  153. </template>
  154. </el-table-column>
  155. <el-table-column prop="cardRegisterId" label="会员卡">
  156. <template slot-scope="scope">
  157. <el-select v-model="scope.row.cardRegisterId" placeholder="请选择" size="small" filterable clearable
  158. :disabled="scope.row.payModeId == '05' && query.chargeFlag != 'B' ? false : true">
  159. <el-option v-for="item in cardRegister" :key="item.id" :label="item.cardNo" :value="item.id" />
  160. </el-select>
  161. </template>
  162. </el-table-column>
  163. </el-table>
  164. </div>
  165. <!-- asbitem -->
  166. <div>
  167. <div style="margin-top:5px; font-size:10px;">{{ query.chargeFlag == 'N' ? '待收' : (query.chargeFlag == 'Y' ?
  168. '已收' : '已退') }}费项目</div>
  169. <el-table :data="asbItemsForFee" border highlight-current-row
  170. :height="window.pageHeight > 600 ? (window.pageHeight - 270 - 146) / 2 : 92" size="small"
  171. @selection-change="handleSelectionChange" ref="asbItemsForFeeTable">
  172. <el-table-column type="selection" align="center" v-if="query.chargeFlag == 'N'" />
  173. <el-table-column label="组合项目" width="120" prop="asbitemName" />
  174. <el-table-column label="标准价格" prop="standardPrice" width="80" align="center" />
  175. <el-table-column label="折扣" prop="discount" width="60" align="center">
  176. <template slot-scope="scope">
  177. <el-input type="number" v-model="scope.row.discount" v-if="query.chargeFlag == 'N'"
  178. :disabled="scope.row.isCharge == 'Y' ? true : false" size="small"
  179. @input="changeDiscount(scope.row)" />
  180. <div v-if="query.chargeFlag != 'N'">{{ scope.row.discount }}</div>
  181. </template>
  182. </el-table-column>
  183. <el-table-column label="数量" prop="amount" width="50" align="center" />
  184. <el-table-column label="实收价格" prop="chargePrice" width="80" align="center">
  185. <template slot-scope="scope">
  186. <el-input type="number" v-model="scope.row.chargePrice" v-if="query.chargeFlag == 'N'"
  187. :disabled="scope.row.isCharge == 'Y' ? true : false" size="small" @input="changePrice(scope.row)" />
  188. <div v-if="query.chargeFlag != 'N'">{{ scope.row.chargePrice }}</div>
  189. </template>
  190. </el-table-column>
  191. <el-table-column prop="total" label="金额" width="70" v-if="false" />
  192. <el-table-column prop="standardPrice" label="标准金额" width="80" v-if="false" />
  193. <el-table-column label="支付方式" prop="payTypeFlag" width="100" align="center">
  194. <template slot-scope="scope">
  195. <div>{{ dddw(dict.payType, "id", scope.row.payTypeFlag, "displayName") }}</div>
  196. </template>
  197. </el-table-column>
  198. <el-table-column prop="checkCompleteFlag" label="状态" align="center">
  199. <template slot-scope="scope">
  200. <div>{{ dddw(dict.checkCompleteFlag, "id", scope.row.checkCompleteFlag, "displayName") }}</div>
  201. </template>
  202. </el-table-column>
  203. <el-table-column prop="creatorName" label="登记人" align="center" />
  204. <el-table-column prop="creationTime" label="登记日期" width="90" align="center">
  205. <template slot-scope="scope">
  206. <div v-if="scope.row.creationTime">{{ moment(scope.row.creationTime).format('yyyy-MM-DD') }}</div>
  207. </template>
  208. </el-table-column>
  209. </el-table>
  210. </div>
  211. </div>
  212. </div>
  213. <div class="btnDivClass">
  214. <div class="btnListClass">
  215. <el-button type="primary" class="btnClass" @click="charge"
  216. :disabled="query.chargeFlag == 'N' ? false : true">收费</el-button>
  217. </div>
  218. <div class="btnListClass">
  219. <el-button type="danger" class="btnClass" @click="chargeBack"
  220. :disabled="query.chargeFlag == 'Y' ? false : true">退费</el-button>
  221. </div>
  222. <div class="btnListClass">
  223. <el-button type="success" class="btnClass" @click="chargePrint('0007', false, form.id)"
  224. :disabled="query.chargeFlag == 'B' ? true : false">打印</el-button>
  225. </div>
  226. <div class="btnListClass">
  227. <el-button type="success" class="btnClass" @click="chargePrint('0007', true, form.id)"
  228. :disabled="query.chargeFlag == 'B' ? true : false">打印预览</el-button>
  229. </div>
  230. </div>
  231. </div>
  232. </el-card>
  233. </div>
  234. </template>
  235. <script>
  236. import moment from 'moment';
  237. import { mapState, mapActions } from "vuex";
  238. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  239. import { tcdate, dddw, arrayExistObj, deepCopy } from "../../utlis/proFunc";
  240. import PatientRegisterQuery from "../../components/patientRegister/patientRegisterQuery.vue";
  241. import PatientRegisterRefuseList from "../../components/patientRegister/PatientRegisterRefuseList.vue";
  242. export default {
  243. components: {
  244. PatientRegisterQuery,
  245. PatientRegisterRefuseList,
  246. },
  247. props:["patientRegisterNo"],
  248. data() {
  249. return {
  250. query: {
  251. chargeFlag: 'N', // N:未收费,Y:已收费,B:已退费
  252. dateRange: null,
  253. startDate: null,
  254. endDate: null,
  255. patientRegisterNo: '',
  256. patientNo: '',
  257. invoiceNo: '',
  258. patientName: '',
  259. },//查询条件
  260. patientList: [],//人员列表
  261. form: {
  262. id: null,
  263. patientRegisterId: null,
  264. invoiceNo: '',
  265. invoiceOrgName: '',
  266. chargeFlag: '0',
  267. discount: 100,
  268. total: 0, //应收金额
  269. preTotal: 0, //预收金额
  270. balance: 0, //找零
  271. }, //收费主表
  272. rules: {
  273. invoiceNo: [
  274. { required: true, message: "请填写发票/收据号", trigger: "blur" },
  275. ],
  276. total: [
  277. { required: true, message: "请填写应收金额", trigger: "blur" },
  278. ],
  279. },
  280. // pickerOptions: {
  281. // shortcuts: [
  282. // {
  283. // text: "最近一周",
  284. // onClick(picker) {
  285. // const end = new Date();
  286. // const start = new Date();
  287. // start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  288. // picker.$emit("pick", [start, end]);
  289. // },
  290. // },
  291. // {
  292. // text: "最近一个月",
  293. // onClick(picker) {
  294. // const end = new Date();
  295. // const start = new Date();
  296. // start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  297. // picker.$emit("pick", [start, end]);
  298. // },
  299. // },
  300. // {
  301. // text: "最近三个月",
  302. // onClick(picker) {
  303. // const end = new Date();
  304. // const start = new Date();
  305. // start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  306. // picker.$emit("pick", [start, end]);
  307. // },
  308. // },
  309. // ],
  310. // },
  311. chargePays: [], //收支方式
  312. chargePaysInit: [], //收支方式(初始状态)
  313. asbItemsForFee: [], //待收费项目
  314. selectedData: [], //选中项目
  315. cardRegister: [{ id: '00000000-0000-0000-0000-000000000000', cardNo: '0001' }], //当前客户的会员卡
  316. cardRegisterAll: [], //所有客户的会员卡
  317. };
  318. },
  319. created() {
  320. this.dictInit();
  321. },
  322. //挂载完成
  323. mounted() {
  324. if(this.patientRegisterNo){
  325. this.Query('patientRegisterNo');
  326. }else{
  327. this.Query();
  328. }
  329. },
  330. computed: {
  331. ...mapState(["window", "dict", "patientRegister", "customerOrg"]),
  332. },
  333. methods: {
  334. ...mapActions(["getCustomerOrgGroup"]),
  335. dddw, moment,
  336. //查询人员列表数据
  337. Query(type) {
  338. let url = '', ltype = type,body = {};
  339. // {
  340. // "skipCount": 2147483647,
  341. // "sorting": "string",
  342. // "patientName": "string",
  343. // "patientNo": "string",
  344. // "patientRegisterNo": "string",
  345. // "invoiceNo": "string",
  346. // "startDate": "string",
  347. // "endDate": "string",
  348. // "maxResultCount": 0
  349. // }
  350. if(this.patientRegisterNo){
  351. this.query.patientRegisterNo = this.patientRegisterNo
  352. ltype = 'patientRegisterNo'
  353. }
  354. console.log('query', ltype, this.query,this.patientRegisterNo);
  355. if (ltype == 'patientRegisterNo') {
  356. if (!this.query.patientRegisterNo) return;
  357. body = { patientRegisterNo: this.query.patientRegisterNo };
  358. } else if (ltype == 'patientNo') {
  359. if (!this.query.patientNo) return;
  360. body = { patientNo: this.query.patientNo };
  361. } else if (ltype == 'invoiceNo' && this.query.chargeFlag != 'N') {
  362. if (!this.query.invoiceNo) return;
  363. body = { invoiceNo: this.query.invoiceNo };
  364. } else {
  365. if (this.query.startDate && this.query.endDate) {
  366. body.startDate = moment(this.query.startDate).format("yyyy-MM-DD")
  367. body.endDate = moment(this.query.endDate).format("yyyy-MM-DD")
  368. if(body.startDate > body.endDate){
  369. this.$message.warning("起始日期不能大于截止日期,数据校验不通过!")
  370. return
  371. }
  372. }
  373. }
  374. switch (this.query.chargeFlag) {
  375. case 'Y':
  376. //已收费
  377. url = '/api/app/patientregister/getpatientregisterchargelist';
  378. break;
  379. case 'B':
  380. //已退费
  381. url = '/api/app/patientregister/getpatientregisterchargebacklist';
  382. break;
  383. default:
  384. //未收费
  385. url = '/api/app/patientregister/getpatientregisternotchargedlist'
  386. break;
  387. }
  388. const loading = this.$loading({
  389. lock: true,
  390. text: 'Loading',
  391. spinner: 'el-icon-loading',
  392. background: 'rgba(0, 0, 0, 0.7)'
  393. });
  394. postapi(url, body).then(res => {
  395. console.log(url,body,res)
  396. if (res.code != - 1) {
  397. this.patientList = res.data.items;
  398. if (this.patientList.length == 1 && this.query.chargeFlag == 'N') {
  399. // this.query.patientRegisterNo = this.patientList[0].patientRegisterNo;
  400. // this.query.patientName = this.patientList[0].patientName;
  401. // this.query.patientNo = this.patientList[0].patientNo;
  402. this.rowClick(this.patientList[0])
  403. setTimeout(() => {
  404. this.$refs['patientList'].setCurrentRow(this.patientList[0])
  405. }, 200)
  406. }
  407. }
  408. loading.close();
  409. })
  410. .catch((err) => {
  411. loading.close();
  412. });
  413. },
  414. //人员列表点击
  415. rowClick(row) {
  416. this.query.patientRegisterNo = row.patientRegisterNo;
  417. this.query.patientName = row.patientName;
  418. this.query.patientNo = row.patientNo;
  419. this.chargePays = deepCopy(this.chargePaysInit);
  420. console.log(this.chargePays, this.chargePaysInit);
  421. if (this.query.chargeFlag == 'B') {
  422. this.form.chargeFlag = '1';
  423. } else {
  424. this.form.chargeFlag = '0';
  425. }
  426. if (row.chargeId) {
  427. this.form.id = row.chargeId;
  428. this.form.invoiceNo = row.invoiceNo;
  429. this.form.invoiceOrgName = row.patientName;
  430. } else {
  431. this.form.id = null;
  432. this.form.invoiceNo = '';
  433. this.form.invoiceOrgName = row.patientName;
  434. }
  435. //获取个人会员卡信息
  436. this.getCardRegister(row.idNo);
  437. switch (this.query.chargeFlag) {
  438. case 'N':
  439. this.getAsbItemsForFee(row.patientRegisterId);
  440. break;
  441. case 'Y':
  442. this.getChargePayByChargeId(row.chargeId);
  443. this.getChargeAsbByChargeid(row.chargeId);
  444. break;
  445. default:
  446. this.getChargeBackPayByChargeBackId(row.chargeBackId);
  447. this.getChargeAsbByChargeid(row.chargeId);
  448. break;
  449. }
  450. },
  451. //获取项目列表
  452. async getAsbItemsForFee(patientRegisterId) {
  453. //待收费项目列表
  454. this.asbItemsForFee = [];
  455. getapi(`/api/app/registerasbitem/getlistinpatientregisterid?PatientRegisterId=${patientRegisterId}`)
  456. .then(res => {
  457. if (res.code == 1) {
  458. this.asbItemsForFee = res.data;
  459. for (let i = this.asbItemsForFee.length - 1; i >= 0; i--) {
  460. if (this.asbItemsForFee[i].isCharge == 'Y' || this.asbItemsForFee[i].payTypeFlag == '1') {
  461. this.asbItemsForFee.splice(i, 1);
  462. continue;
  463. }
  464. this.asbItemsForFee[i].chargePriceOri = this.asbItemsForFee[i].chargePrice;
  465. this.asbItemsForFee[i].discount = Math.round(10000 * this.asbItemsForFee[i].chargePrice / this.asbItemsForFee[i].standardPrice) / 100;
  466. this.asbItemsForFee[i].standTotal = this.asbItemsForFee[i].amount * this.asbItemsForFee[i].standardPrice;
  467. this.asbItemsForFee[i].total = this.asbItemsForFee[i].amount * this.asbItemsForFee[i].chargePrice;
  468. }
  469. //勾选已收费项目
  470. this.toCharge(patientRegisterId);
  471. }
  472. });
  473. },
  474. // "chargeId": "3a0d5685-b3a0-0186-0dd4-3b3ac0d2d08c",
  475. // "asbitemId": "3a0c657d-4e73-9bab-68da-56ab2f088bb1",
  476. // "asbitemName": "身高体重",
  477. // "asbitemPrice": 17,
  478. // "chargePrice": 18,
  479. // "amount": 1,
  480. // "registerAsbitemId": "3a0c6589-9b27-68d1-32f6-51082031d11c",
  481. // "creatorName": "admin",
  482. // "lastModifierName": null,
  483. // "lastModificationTime": null,
  484. // "lastModifierId": null,
  485. // "creationTime": "2023-08-30T10:49:48.753174",
  486. // "creatorId": "3a0c4180-107c-0c89-b25b-0bd34666dcec",
  487. // "id": "3a0d5685-b3bb-8dc2-0d14-56af1ddd11f9"
  488. // 获取个人充值卡
  489. getCardRegister(idNo) {
  490. this.cardRegister = [];
  491. if(!idNo) return;
  492. let body = { cardModeId: '0', idNo };
  493. postapi(`/api/app/cardregister/getcardregisterlist`, body).then(res => {
  494. if (res.code != - 1) {
  495. this.cardRegister = res.data;
  496. }
  497. });
  498. },
  499. //获取收费单包含的组合项目
  500. getChargeAsbByChargeid(ChargeId) {
  501. this.asbItemsForFee = [];
  502. getapi(`/api/app/chargeasbitem/getchargeasbiteminchargeid?ChargeId=${ChargeId}`).then(res => {
  503. if (res.code != - 1) {
  504. res.data.forEach(e => {
  505. this.asbItemsForFee.push({
  506. asbitemName: e.asbitemName,
  507. standardPrice: e.asbitemPrice,
  508. chargePrice: e.chargePrice,
  509. chargePriceOri: e.chargePrice,
  510. amount: e.amount,
  511. discount: Math.round(10000 * e.chargePrice / e.asbitemPrice) / 100,
  512. payTypeFlag: e.payTypeFlag,
  513. checkCompleteFlag: e.checkCompleteFlag,
  514. creatorName: e.creatorName,
  515. creationTime: e.creationTime,
  516. });
  517. });
  518. this.sumTotal(this.asbItemsForFee, this.form);
  519. }
  520. });
  521. },
  522. //获取收费方式明细
  523. getChargePayByChargeId(ChargeId) {
  524. let lfind = -1;
  525. getapi(`/api/app/chargepay/getchargepayinchargeid?ChargeId=${ChargeId}`).then(res => {
  526. if (res.code != - 1) {
  527. res.data.forEach(e => {
  528. lfind = arrayExistObj(this.chargePays, 'payModeId', e.payModeId);
  529. if (lfind > - 1) {
  530. this.chargePays[lfind].chargeMoney = e.chargeMoney;
  531. this.chargePays[lfind].cardRegisterId = e.cardRegisterId;
  532. }
  533. });
  534. }
  535. });
  536. },
  537. //获取退费方式明细
  538. getChargeBackPayByChargeBackId(ChargeBackId) {
  539. let lfind = -1;
  540. getapi(`/api/app/chargebackpay/getchargebackpayinchargebackid?ChargeBackId=${ChargeBackId}`).then(res => {
  541. if (res.code != - 1) {
  542. res.data.forEach(e => {
  543. lfind = arrayExistObj(this.chargePays, 'payModeId', e.payModeId);
  544. if (lfind > - 1) {
  545. this.chargePays[lfind].chargeMoney = e.backMoeny;
  546. this.chargePays[lfind].cardRegisterId = e.cardRegisterId;
  547. }
  548. });
  549. }
  550. });
  551. },
  552. //待收费数据分析
  553. toCharge(patientRegisterId) {
  554. //默认全部选中
  555. this.selectedData = [...this.asbItemsForFee];
  556. this.$nextTick(function () {
  557. this.selectedData.forEach(row => {
  558. this.$refs['asbItemsForFeeTable'].toggleRowSelection(row)
  559. })
  560. });
  561. this.form.patientRegisterId = patientRegisterId;
  562. },
  563. //根据明细算总价与折扣
  564. sumTotal(details, head) {
  565. let total = 0, totalOri = 0;
  566. details.forEach(e => {
  567. totalOri += Math.round(e.amount * e.chargePriceOri * 100) / 100; //原始实收价格
  568. total += Math.round(e.amount * e.chargePrice * 100) / 100; //当前实收价格
  569. //console.log(total, e.chargePrice, e.amount)
  570. });
  571. total = Math.round(total * 100) / 100;
  572. totalOri = Math.round(totalOri * 100) / 100;
  573. head.total = total;
  574. head.preTotal = total;
  575. if (totalOri == 0) {
  576. head.discount = 100;
  577. } else {
  578. head.discount = Math.round(10000 * total / totalOri) / 100;
  579. }
  580. },
  581. //通过折扣计算总价与明细价格
  582. discountToDetails() {
  583. let discount = this.form.discount;
  584. let totalOri = 0, totalCompute = 0, totalPlan = 0;
  585. let lfind = -1;
  586. this.selectedData.forEach(e => {
  587. totalOri += Number(e.amount * e.chargePriceOri); //原始实收价格
  588. lfind = arrayExistObj(this.asbItemsForFee, 'id', e.id)
  589. if (lfind > -1 && e.chargePriceOri != 0) {
  590. e.chargePrice = Math.round(e.chargePriceOri * discount) / 100;
  591. e.discount = Math.round(10000 * e.chargePrice / e.standardPrice) / 100;
  592. totalCompute += Math.round(e.chargePrice * e.amount * 100) / 100;
  593. }
  594. });
  595. totalPlan = Math.round(totalOri * discount) / 100;
  596. this.form.total = totalPlan;
  597. this.form.preTotal = totalPlan;
  598. //明细和与总金额不符处理
  599. this.handleBalance(totalPlan, totalCompute);
  600. },
  601. //通过总价计算折扣与明细价格
  602. totalToDetails() {
  603. let discount = 100;
  604. let totalOri = 0, totalCompute = 0, totalPlan = Number(this.form.total);
  605. let lfind = -1;
  606. this.selectedData.forEach(e => {
  607. totalOri += Math.round(100 * e.amount * e.chargePriceOri) / 100; //原始实收价格
  608. });
  609. if (totalOri != 0) {
  610. discount = Math.round(10000 * totalPlan / totalOri) / 100;
  611. this.form.discount = discount;
  612. }
  613. //
  614. this.selectedData.forEach(e => {
  615. lfind = arrayExistObj(this.asbItemsForFee, 'id', e.id);
  616. if (lfind > -1) {
  617. e.chargePrice = Math.round(e.chargePriceOri * discount) / 100;
  618. e.discount = Math.round(10000 * e.chargePrice / e.standardPrice) / 100;
  619. totalCompute += Math.round(100 * e.chargePrice * e.amount) / 100;
  620. }
  621. });
  622. this.form.preTotal = totalPlan;
  623. //明细和与总金额不符处理
  624. this.handleBalance(totalPlan, totalCompute);
  625. },
  626. //明细合计金额与总金额不一致时,处理
  627. handleBalance(totalPlan, totalCompute) {
  628. if (totalPlan != totalCompute) {
  629. for (let i = this.selectedData.length - 1; i = 0; i--) {
  630. lfind = lfind = arrayExistObj(this.asbItemsForFee, 'id', this.selectedData[i].id);
  631. if (lfind > -1 && this.selectedData[i].amount == 1) {
  632. this.asbItemsForFee[lfind].chargePrice = this.asbItemsForFee[lfind].chargePrice + totalPlan - totalCompute;
  633. this.selectedData[i].chargePrice = this.asbItemsForFee[lfind].chargePrice;
  634. break;
  635. }
  636. }
  637. }
  638. },
  639. //输入预收金额,计算找零
  640. findBalance() {
  641. this.form.balance = this.form.preTotal - this.form.total;
  642. },
  643. //输入收费方式金额
  644. inputMoney() {
  645. let total = Number(0);
  646. this.chargePays.forEach(e => {
  647. total += Number(e.chargeMoney);
  648. });
  649. if (total > this.form.total) this.$message.warning("输入金额超过总金额");
  650. },
  651. //勾选要收费的项目
  652. handleSelectionChange(v) {
  653. this.selectedData = v;
  654. this.sumTotal(this.selectedData, this.form);
  655. },
  656. //调整明细折扣
  657. changeDiscount(row) {
  658. let total = this.form.total;
  659. let totalDetailsOri = Math.round(100 * row.amount * row.chargePrice) / 100;
  660. let totalDetailsCur = 0;
  661. row.chargePrice = Math.round(row.discount * row.standardPrice) / 100;
  662. let lfind = arrayExistObj(this.selectedData, 'id', row.id);
  663. if (lfind > -1) {
  664. totalDetailsCur = Math.round(100 * row.amount * row.chargePrice) / 100;
  665. this.form.total = total + totalDetailsCur - totalDetailsOri;
  666. }
  667. this.sumTotal(this.selectedData, this.form);
  668. },
  669. //调整明细实收价格
  670. changePrice(row) {
  671. if (row.chargePriceOri != 0) {
  672. row.discount = Math.round(10000 * row.chargePrice / row.standardPrice) / 100;
  673. }
  674. this.sumTotal(this.selectedData, this.form);
  675. },
  676. //收费
  677. charge() {
  678. let body = {};
  679. let total = 0;
  680. let msg = '';
  681. let chargePays = [];
  682. let asbitems = [];
  683. if (this.form.id) {
  684. this.$message.warning("已收费,不可重复操作!");
  685. return;
  686. }
  687. this.$refs['form'].validate((valid, fields) => {
  688. if (!valid) {
  689. msg = fields[Object.keys(fields)[0]][0].message;
  690. return;
  691. }
  692. });
  693. if (msg) {
  694. this.$message.warning(msg);
  695. return;
  696. }
  697. this.chargePays.forEach(e => {
  698. total += Number(e.chargeMoney);
  699. if (e.payModeId == '05' && e.chargeMoney) {
  700. //console.log(e.payModeId,e.chargeMoney,e.cardRegisterId);
  701. if (!e.cardRegisterId) msg = '请先择会员卡号';
  702. } else {
  703. e.cardRegisterId = null;
  704. }
  705. return e;
  706. });
  707. if (msg) {
  708. this.$message.warning(msg);
  709. return;
  710. }
  711. if (total != this.form.total) {
  712. this.$message.warning("收费方式合计金额与收费总金额不符");
  713. return;
  714. }
  715. this.chargePays.forEach(e => {
  716. if (e.chargeMoney) {
  717. chargePays.push({
  718. payModeId: e.payModeId,
  719. chargeMoney: e.chargeMoney,
  720. cardRegisterId: e.cardRegisterId,
  721. });
  722. }
  723. });
  724. this.selectedData.forEach(e => {
  725. asbitems.push({
  726. asbitemId: e.asbitemId,
  727. chargePrice: e.chargePrice,
  728. amount: e.amount,
  729. registerAsbitemId: e.id,
  730. });
  731. });
  732. body = {
  733. patientRegisterId: this.form.patientRegisterId,
  734. invoiceNo: this.form.invoiceNo,
  735. invoiceOrgName: this.form.invoiceOrgName,
  736. chargePays,
  737. asbitems,
  738. };
  739. // {
  740. // "patientRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  741. // "invoiceNo": "string",
  742. // "invoiceOrgName": "string",
  743. // "chargePays": [
  744. // {
  745. // "payModeId": "string",
  746. // "chargeMoney": 0,
  747. // "cardRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  748. // }
  749. // ],
  750. // "asbitems": [
  751. // {
  752. // "asbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  753. // "chargePrice": 0,
  754. // "amount": 0,
  755. // "registerAsbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  756. // }
  757. // ]
  758. // }
  759. //console.log('body',body);
  760. postapi('/api/app/registerasbitem/registerasbitemcharge', body).then(res => {
  761. if (res.code != -1) {
  762. this.$message.success("操作成功!");
  763. this.form.id = "操作成功!"; //防止重复提交收费
  764. this.Query();
  765. }
  766. });
  767. },
  768. //退费
  769. chargeBack() {
  770. let chargeId = this.form.id;
  771. let msg = '';
  772. let chargeBackPays = [];
  773. let total = 0;
  774. let body = {};
  775. if (!chargeId) {
  776. this.$message.warning("请选择待退费的记录!");
  777. return;
  778. }
  779. if (this.form.chargeFlag == '1') {
  780. this.$message.warning("已退费,不可重复操作!");
  781. return;
  782. }
  783. this.chargePays.forEach(e => {
  784. total += Number(e.chargeMoney);
  785. if (e.payModeId == '05' && e.chargeMoney) {
  786. if (!e.cardRegisterId) msg = '请先择会员卡号';
  787. } else {
  788. e.cardRegisterId = null;
  789. }
  790. return e;
  791. });
  792. if (msg) {
  793. this.$message.warning(msg);
  794. return;
  795. }
  796. if (total != this.form.total) {
  797. this.$message.warning("退费方式合计金额与退费总金额不符");
  798. return;
  799. }
  800. this.chargePays.forEach(e => {
  801. if (e.chargeMoney) {
  802. chargeBackPays.push({
  803. payModeId: e.payModeId,
  804. backMoeny: e.chargeMoney,
  805. cardRegisterId: e.cardRegisterId,
  806. });
  807. }
  808. });
  809. // {
  810. // "chargeId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  811. // "chargeBackPays": [
  812. // {
  813. // "payModeId": "string",
  814. // "backMoeny": 0,
  815. // "cardRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  816. // }
  817. // ]
  818. // }
  819. body = {
  820. chargeId, chargeBackPays
  821. }
  822. postapi('/api/app/registerasbitem/registerasbitemchargeback', body).then(res => {
  823. if (res.code != -1) {
  824. this.$message.success("操作成功!");
  825. this.form.chargeFlag = '1'; //防止重复提交退费
  826. this.Query();
  827. }
  828. });
  829. },
  830. //收费打印
  831. chargePrint(ReportCode, isPreview, chargeId) {
  832. if (chargeId.length < 1) {
  833. this.$message.info("人员信息尚未保存,不可执行此操作!");
  834. return;
  835. }
  836. if(!this.$peisAPI) {
  837. this.$message.info("此功能,需要在壳客户端才可运行!")
  838. return
  839. }
  840. let token = localStorage.getItem('token');
  841. let user = localStorage.getItem('user');
  842. let toOutShell = {
  843. ReportCode, token,
  844. preViewCanPrint: 'Y',
  845. Parameters: [
  846. { Name: 'printer', Value: user },
  847. { Name: 'hisLog', Value: 'pic/hisLog.jpg' },
  848. ],
  849. };
  850. if (isPreview) {
  851. postapi(`/api/app/printreport/getchargereport?ChargeId=${chargeId}`)
  852. .then((res) => {
  853. if (res.code != -1) {
  854. toOutShell.ReportTable = res.data;
  855. console.log('JSON.stringify(toOutShell)', JSON.stringify(toOutShell));
  856. return this.$peisAPI.printPre(JSON.stringify(toOutShell));
  857. }
  858. })
  859. .catch(err => {
  860. this.$message.warning(err);
  861. });
  862. } else {
  863. postapi(`/api/app/printreport/getchargereport?ChargeId=${chargeId}`)
  864. .then((res) => {
  865. if (res.code != -1) {
  866. toOutShell.ReportTable = res.data;
  867. console.log('JSON.stringify(toOutShell)', JSON.stringify(toOutShell));
  868. return this.$peisAPI.print(JSON.stringify(toOutShell));
  869. }
  870. })
  871. .catch(err => {
  872. this.$message.warning(err);
  873. });
  874. }
  875. },
  876. //数据初始化
  877. dictInit() {
  878. this.query.startDate = new Date()
  879. this.query.endDate = this.query.startDate
  880. //性别(仅档案用)
  881. getapi("/api/app/sex").then((res) => {
  882. if (res.code == 1) {
  883. this.dict.sex = res.data;
  884. }
  885. });
  886. //性别(查询)
  887. getapi("/api/app/for-sex").then((res) => {
  888. if (res.code == 1) {
  889. this.dict.forSex = res.data;
  890. }
  891. });
  892. //体检单位
  893. getapi("/api/app/customerorg/getbycodeall").then((res) => {
  894. this.patientRegister.customerOrgTreeAll = res.data;
  895. tcdate(this.patientRegister.customerOrgTreeAll)
  896. });
  897. //体检中心
  898. getapi("/api/app/organization-units/organization-unit-by-is-peis").then(
  899. (res) => {
  900. if (res.code == 1) {
  901. this.dict.organization = res.data;
  902. }
  903. }
  904. );
  905. //体检单位
  906. getapi("/api/app/customer-org/in-filter").then((res) => {
  907. if (res.code == 1) {
  908. this.dict.customerOrg = res.data.items;
  909. }
  910. });
  911. //体检类别
  912. getapi("/api/app/medical-type/in-filter").then((res) => {
  913. if (res.code == 1) {
  914. this.dict.medicalType = res.data.items;
  915. }
  916. });
  917. //人员类别
  918. getapi("/api/app/personnel-type/in-filter").then((res) => {
  919. if (res.code == 1) {
  920. this.dict.personnelType = res.data.items;
  921. }
  922. });
  923. //婚姻状况
  924. getapi("/api/app/marital-statuses").then((res) => {
  925. if (res.code == 1) {
  926. this.dict.maritalStatus = res.data.items;
  927. }
  928. });
  929. //性激素期
  930. getapi("/api/app/sex-hormone-term/in-filter").then((res) => {
  931. if (res.code == 1) {
  932. this.dict.sexHormoneTerm = res.data.items;
  933. }
  934. });
  935. //民族
  936. getapi("/api/app/nation/in-filter").then((res) => {
  937. if (res.code == 1) {
  938. this.dict.nation = res.data.items;
  939. }
  940. });
  941. //籍惯 ,出生地
  942. getapi("/api/app/birth-place/in-filter").then((res) => {
  943. if (res.code == 1) {
  944. this.dict.birthPlace = res.data.items;
  945. }
  946. });
  947. //套餐
  948. getapi("/api/app/medical-package/in-filter").then((res) => {
  949. if (res.code == 1) {
  950. this.dict.medicalPackage = res.data.items;
  951. }
  952. });
  953. //分组,所有分组,不限单位,不限次数
  954. getapi("/api/app/customer-org-group").then((res) => {
  955. if (res.code == 1) {
  956. this.dict.customerOrgGroupAll = res.data.items;
  957. }
  958. });
  959. //支付方式
  960. getapi("/api/app/pay-mode").then((res) => {
  961. if (res.code == 1) {
  962. this.dict.payMode = res.data;
  963. //未收费时
  964. this.chargePaysInit = [];
  965. this.dict.payMode.forEach(e => {
  966. this.chargePaysInit.push({ chargeId: null, payModeId: e.id, chargeMoney: 0, cardBillId: null })
  967. });
  968. this.chargePays = deepCopy(this.chargePaysInit);
  969. }
  970. });
  971. //体检类别 树结构
  972. getapi("/api/app/item-type/by-code-all").then((res) => {
  973. if (res.code == 1) {
  974. this.dict.itemTypeTree = res.data;
  975. tcdate(this.dict.itemTypeTree);
  976. }
  977. });
  978. getapi("/api/app/asbitem/in-filter?Filter").then((res) => {
  979. if (res.code == 1) {
  980. this.dict.asbItemAll = res.data.items;
  981. }
  982. });
  983. console.log("dict", this.dict);
  984. },
  985. },
  986. //监听事件()
  987. watch: {
  988. "patientRegisterNo":{
  989. immediate: true, // 立即执行
  990. // deep: true, // 深度监听复杂类型内变化
  991. handler(newVal,oldVal){
  992. console.log('watch:patientRegisterNo:',newVal,oldVal)
  993. if(newVal != oldVal){
  994. if(newVal){
  995. this.query.patientRegisterNo = newVal
  996. this.Query("patientRegisterNo")
  997. }
  998. }
  999. }
  1000. },
  1001. },
  1002. };
  1003. </script>
  1004. <style scoped>
  1005. @import '../../assets/css/global_button.css';
  1006. @import '../../assets/css/global_card.css';
  1007. @import '../../assets/css/global_dialog.css';
  1008. @import '../../assets/css/global_form.css';
  1009. @import '../../assets/css/global_input.css';
  1010. @import '../../assets/css/global_table.css';
  1011. @import '../../assets/css/global.css';
  1012. .queryDivClass {
  1013. display: block;
  1014. width: v-bind("(window.pageWidth > 600 ? (window.pageWidth - 110 - 50) / 2 : 200) + 'px'");
  1015. height: v-bind("(window.pageHeight > 600 ? (window.pageHeight - 150) : 450) + 'px'");
  1016. }
  1017. .query {
  1018. margin-left: 10px;
  1019. }
  1020. .prListDivClass {
  1021. height: v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'");
  1022. }
  1023. .btnDivClass {
  1024. display: block;
  1025. width: 100px;
  1026. margin-left: 10px;
  1027. margin-top: 180px;
  1028. }
  1029. .btnListClass {
  1030. margin-top: 10px;
  1031. }
  1032. .btnClass {
  1033. width: 100px;
  1034. }
  1035. </style>