|
|
@@ -3312,7 +3312,7 @@ function callYbSaleGoodsItem(realNo, orderNo, receiptNo, times, patientId, name,
|
|
|
* @param name 病人姓名
|
|
|
*/
|
|
|
function callYbReturnGoodsItem(realNo, orderNo, receiptNo, times, patientId, name) {
|
|
|
- // 获取退药明细数据 - 使用全局变量中保存的退药数据
|
|
|
+ // 获取退药明细数据 - 直接使用退药表格数据
|
|
|
let tableData = window.currentRefundData || $table.bootstrapTable('getData');
|
|
|
|
|
|
if (!tableData || tableData.length === 0) {
|
|
|
@@ -3394,46 +3394,17 @@ function callYbReturnGoodsItem(realNo, orderNo, receiptNo, times, patientId, nam
|
|
|
drugtracinfo: []
|
|
|
};
|
|
|
|
|
|
- // 处理追溯码(从退药匹配表格获取)
|
|
|
- let tyTable = $('#ty_table_detail').bootstrapTable("getData");
|
|
|
- if (tyTable && tyTable.length > 0) {
|
|
|
- // 查找对应的追溯码
|
|
|
- for (let j = 0; j < tyTable.length; j++) {
|
|
|
- let tyItem = tyTable[j];
|
|
|
-
|
|
|
- // 调试日志
|
|
|
- console.log('追溯码匹配检查:', {
|
|
|
- 'tyItem.chargeItemCode': tyItem.chargeItemCode,
|
|
|
- 'item.charge_item_code': item.charge_item_code,
|
|
|
- 'tyItem.serial': tyItem.serial,
|
|
|
- 'item.serial': item.serial,
|
|
|
- 'tyItem.itemNo': tyItem.itemNo,
|
|
|
- 'item.item_no': item.item_no,
|
|
|
- 'tyItem.drugTracCodg': tyItem.drugTracCodg
|
|
|
+ // 直接从退药表格获取追溯码(与发药接口保持一致)
|
|
|
+ if (item.drugTracCodg && item.drugTracCodg.trim() !== '') {
|
|
|
+ let tracCodes = item.drugTracCodg.split('<br>').filter(code => code.trim() !== '');
|
|
|
+ for (let j = 0; j < tracCodes.length; j++) {
|
|
|
+ ybData.drugtracinfo.push({
|
|
|
+ drugTracCodg: tracCodes[j].trim()
|
|
|
});
|
|
|
-
|
|
|
- // 匹配条件:收费项目编码、流水号、项目序号
|
|
|
- if (tyItem.chargeItemCode === item.charge_item_code &&
|
|
|
- tyItem.serial === item.serial &&
|
|
|
- tyItem.itemNo === item.item_no) {
|
|
|
-
|
|
|
- console.log('追溯码匹配成功:', tyItem.drugTracCodg);
|
|
|
-
|
|
|
- if (tyItem.drugTracCodg && tyItem.drugTracCodg.trim() !== '') {
|
|
|
- // 提取追溯码(去除HTML标签)
|
|
|
- let tracCode = tyItem.drugTracCodg.replace(/<[^>]*>/g, '').trim();
|
|
|
- if (tracCode) {
|
|
|
- ybData.drugtracinfo.push({
|
|
|
- drugTracCodg: tracCode
|
|
|
- });
|
|
|
- console.log('添加追溯码到医保参数:', tracCode);
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
}
|
|
|
+ console.log('从退药表格获取追溯码:', tracCodes);
|
|
|
} else {
|
|
|
- console.log('退药匹配表格为空,无法获取追溯码');
|
|
|
+ console.log('退药表格中没有追溯码信息');
|
|
|
}
|
|
|
|
|
|
// 如果没有追溯码,添加空数组(保持数据结构一致)
|