LIJU hai 2 meses
pai
achega
5d87b41b61

+ 24 - 15
src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java

@@ -637,38 +637,47 @@ public class MzPharmacyController {
             mzChargeDetail.setReceiptNo(Math.abs(mzChargeDetail.getReceiptNo()));//防止退药处方,需将发票号转为正数
             List<MzSendMedicineVo> cfxxList = mzPharmacyService.getFyclPrescriptionDetail(mzChargeDetail);
             if (cfxxList.size() > 0) {
+                // 获取公共信息
                 MzVisitTable visit = mzVisitTableService.queryByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes());
                 String icdText = StringUtils.isBlank(visit.getIcdText())?"":visit.getIcdText();
                 MzBlRecord mzBlRecord = mzBlRecordService.queryMzBlRecordByPatientIdAndTimes(mzChargeDetail.getPatientId(), mzChargeDetail.getTimes());
                 if(null != mzBlRecord && StringUtils.isNotBlank(mzBlRecord.getTentativeDiagnosis())){
                     icdText += (StringUtils.isBlank(icdText)?"":",")+mzBlRecord.getTentativeDiagnosis();
                 }
-                cfxxList.get(0).setIcdText(icdText);
                 String warnDeptName = zdUnitCodeService.queryDeptNameByIdInCache(cfxxList.get(0).getWarnDept());
-                cfxxList.get(0).setWarnDeptName(warnDeptName);
                 Employee employee = employeeService.queryByUserCode(cfxxList.get(0).getDoctorCode());
-                cfxxList.get(0).setEmployeeName(employee.getEmployeeName());
+                String employeeName = employee.getEmployeeName();
                 
                 // 获取患者信息,添加医保接口需要的三个参数
+                MzPatientMi patientInfo = null;
+                String psnCertType = "01"; // 默认身份证
+                String certno = ""; // 默认空字符串
+                String psnName = cfxxList.get(0).getName(); // 默认使用收费明细中的姓名
+                
                 if (StringUtils.isNotBlank(cfxxList.get(0).getPatientId())) {
-                    MzPatientMi patientInfo = mzPatientMiService.queryByPatientId(cfxxList.get(0).getPatientId());
+                    patientInfo = mzPatientMiService.queryByPatientId(cfxxList.get(0).getPatientId());
                     if (patientInfo != null) {
                         // 设置患者证件类型(默认身份证)
-                        cfxxList.get(0).setPsnCertType(patientInfo.getCertificateType() != null ? 
-                            patientInfo.getCertificateType() : "01");
+                        psnCertType = patientInfo.getCertificateType() != null ? 
+                            patientInfo.getCertificateType() : "01";
                         // 设置患者证件号码(身份证号)
-                        cfxxList.get(0).setCertno(patientInfo.getSocialNo() != null ? 
-                            patientInfo.getSocialNo() : "");
+                        certno = patientInfo.getSocialNo() != null ? 
+                            patientInfo.getSocialNo() : "";
                         // 设置患者姓名
-                        cfxxList.get(0).setPsnName(patientInfo.getName() != null ? 
-                            patientInfo.getName() : cfxxList.get(0).getName());
-                    } else {
-                        // 如果查询不到患者信息,使用默认值
-                        cfxxList.get(0).setPsnCertType("01"); // 默认身份证
-                        cfxxList.get(0).setCertno(""); // 空字符串
-                        cfxxList.get(0).setPsnName(cfxxList.get(0).getName()); // 使用收费明细中的姓名
+                        psnName = patientInfo.getName() != null ? 
+                            patientInfo.getName() : cfxxList.get(0).getName();
                     }
                 }
+                
+                // 为所有记录设置公共信息
+                for (MzSendMedicineVo item : cfxxList) {
+                    item.setIcdText(icdText);
+                    item.setWarnDeptName(warnDeptName);
+                    item.setEmployeeName(employeeName);
+                    item.setPsnCertType(psnCertType);
+                    item.setCertno(certno);
+                    item.setPsnName(psnName);
+                }
 
                 // 查询门诊病人处方过敏史
                 List<PatientAllergenInfo> patientAllergenInfoList = patientAllergenInfoService.queryPatientAllergenInfoByPatNo(cfxxList.get(0).getPatientId());

+ 2 - 2
src/main/resources/static/js/mz/west_pharmacy_send.js

@@ -3264,7 +3264,7 @@ function addTracCodgToCell(tracCodg, $element) {
 function callYbSaleGoodsItem(realNo, orderNo, receiptNo, times, patientId, name, pharPracCertNo) {
     // 获取处方明细数据
     let tableData = $("#tb_table_right").bootstrapTable('getData');
-    
+    console.log("callYbSaleGoodsItem11111111111111111111111",tableData)
     if (!tableData || tableData.length === 0) {
         console.log('没有处方明细数据,跳过医保接口调用');
         return;
@@ -3349,7 +3349,7 @@ function callYbSaleGoodsItem(realNo, orderNo, receiptNo, times, patientId, name,
             rxFlag: "1",//医院默认都是处方药
             
             // 拆零标志(0-否;1-是)
-            trdnFlag: item.clFlag || '0',
+            trdnFlag: (item.serial === '99') ? '0' : '1',
             
             // 患者相关参数(医保接口需要)
             // 人员证件类型