|
|
@@ -309,6 +309,9 @@ function sendMedicineProcessing(realNo, orderNo, receiptNo, times, patientId, na
|
|
|
return;
|
|
|
}
|
|
|
if (res.code == 0) {
|
|
|
+ // 发药成功后,调用医保接口
|
|
|
+ callYbSaleGoodsItem(realNo, orderNo, receiptNo, times, patientId, name);
|
|
|
+
|
|
|
successMesage(res);
|
|
|
$('#cfxxModal').modal('hide');
|
|
|
$("#patientId").val('');
|
|
|
@@ -3050,4 +3053,119 @@ function addTracCodgToCell(tracCodg, $element) {
|
|
|
}
|
|
|
|
|
|
console.log('addTracCodgToCell 结束,最终单元格内容:', $element.html());
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 调用医保商品销售接口
|
|
|
+ * @param realNo 流水号
|
|
|
+ * @param orderNo 处方号
|
|
|
+ * @param receiptNo 发票分票号
|
|
|
+ * @param times 次数
|
|
|
+ * @param patientId 病人ID
|
|
|
+ * @param name 病人姓名
|
|
|
+ */
|
|
|
+function callYbSaleGoodsItem(realNo, orderNo, receiptNo, times, patientId, name) {
|
|
|
+ // 获取处方明细数据
|
|
|
+ let tableData = $("#tb_table_right").bootstrapTable('getData');
|
|
|
+
|
|
|
+ if (!tableData || tableData.length === 0) {
|
|
|
+ console.log('没有处方明细数据,跳过医保接口调用');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取当前用户信息(药师信息)
|
|
|
+ let currentUserName = localStorage.getItem('userName') || '';
|
|
|
+ let currentUserId = localStorage.getItem('userID') || '';
|
|
|
+
|
|
|
+ // 获取当前时间
|
|
|
+ let currentTime = new Date();
|
|
|
+ let selRetnTime = currentTime.getFullYear() + '-' +
|
|
|
+ String(currentTime.getMonth() + 1).padStart(2, '0') + '-' +
|
|
|
+ String(currentTime.getDate()).padStart(2, '0') + ' ' +
|
|
|
+ String(currentTime.getHours()).padStart(2, '0') + ':' +
|
|
|
+ String(currentTime.getMinutes()).padStart(2, '0') + ':' +
|
|
|
+ String(currentTime.getSeconds()).padStart(2, '0');
|
|
|
+
|
|
|
+ // 为每个药品调用一次医保接口
|
|
|
+ for (let i = 0; i < tableData.length; i++) {
|
|
|
+ let item = tableData[i];
|
|
|
+
|
|
|
+ // 参数验证
|
|
|
+ let doctorName = $("#employeeNameLabel").val() || '';
|
|
|
+ if (!doctorName) {
|
|
|
+ console.warn('开方医师姓名为空,使用默认值');
|
|
|
+ doctorName = '未知医师';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!currentUserName) {
|
|
|
+ console.warn('药师姓名为空,使用默认值');
|
|
|
+ currentUserName = '未知药师';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 构建医保接口参数(只传递必需参数)
|
|
|
+ let ybData = {
|
|
|
+ // 医疗目录编码(医保编码)
|
|
|
+ medListCodg: item.nationalCode || 'NMLC999',
|
|
|
+
|
|
|
+ // 开方医师姓名
|
|
|
+ prscDrName: doctorName,
|
|
|
+
|
|
|
+ // 药师姓名
|
|
|
+ pharName: currentUserName,
|
|
|
+
|
|
|
+ // 药师执业资格证号(暂时为空,需要从用户信息中获取)
|
|
|
+ pharPracCertNo: '',
|
|
|
+
|
|
|
+ // 销售/退货经办人姓名
|
|
|
+ selRetnOpterName: currentUserName,
|
|
|
+
|
|
|
+ // 就诊结算类型(1-医保结算 2-自费结算)
|
|
|
+ mdtrtSetlType: '1',
|
|
|
+
|
|
|
+ // 处方药标志
|
|
|
+ rxFlag: '1',
|
|
|
+
|
|
|
+ // 拆零标志(0-否;1-是)
|
|
|
+ trdnFlag: '0',
|
|
|
+
|
|
|
+ // 追溯码信息
|
|
|
+ drugtracinfo: []
|
|
|
+ };
|
|
|
+
|
|
|
+ // 处理追溯码
|
|
|
+ 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()
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log('调用医保接口,药品:', item.drugname, '参数:', ybData);
|
|
|
+
|
|
|
+ // 调用医保接口
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: '/Yb/saleGoodsItem',
|
|
|
+ contentType: "application/json;charset=UTF-8",
|
|
|
+ dataType: "json",
|
|
|
+ headers: {
|
|
|
+ 'Accept': 'application/json',
|
|
|
+ 'Authorization': 'Bearer ' + localStorage.getItem("token")
|
|
|
+ },
|
|
|
+ data: JSON.stringify(ybData),
|
|
|
+ success: function (res) {
|
|
|
+ console.log('医保接口调用成功:', res);
|
|
|
+ if (res.code !== 0) {
|
|
|
+ console.error('医保接口调用失败:', res.message);
|
|
|
+ // 医保接口失败不影响发药流程,只记录日志
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (xhr, status, error) {
|
|
|
+ console.error('医保接口调用失败:', error);
|
|
|
+ // 医保接口失败不影响发药流程,只记录日志
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|