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.

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