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.

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