|  | @@ -184,7 +184,7 @@ public class BswServerImpl implements BswServer {
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      public ResultInfo mzBlueInvoice(MzInvoiceInfo mzInvoiceInfo) {
 | 
	
		
			
				|  |  |          String url = getUrl() + "public/ebill/invoicehisissue";
 | 
	
		
			
				|  |  | -        JSMzInvoiceInfo jsMzInvoiceInfo = new JSMzInvoiceInfo().transformFromMzInvoiceInfo(mzInvoiceInfo);
 | 
	
		
			
				|  |  | +        JSMzInvoiceInfo jsMzInvoiceInfo = new JSMzInvoiceInfo().transformFromMzInvoiceInfo(mzInvoiceInfo,"02");
 | 
	
		
			
				|  |  |          String paramJson = JsonUtil.object2Json(jsMzInvoiceInfo);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          log.info("url:{}", url);
 | 
	
	
		
			
				|  | @@ -861,8 +861,8 @@ public class BswServerImpl implements BswServer {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              requestId = mzDzfpUploadList.get(0).getRequestId();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        String blueInvoiceNo = "";
 | 
	
		
			
				|  |  | -        String blueIssueDate = "";
 | 
	
		
			
				|  |  | +        String relatedInvoiceNumber = "";
 | 
	
		
			
				|  |  | +        String relatedInvoiceCode = "";
 | 
	
		
			
				|  |  |          if (uploadParam.getTypeFlag() == 4) {
 | 
	
		
			
				|  |  |              MzDzfpUpload mzDzfpUpload = BeanUtil.copyProperties(uploadParam, MzDzfpUpload.class);
 | 
	
		
			
				|  |  |              mzDzfpUpload.setTypeFlag(3);
 | 
	
	
		
			
				|  | @@ -870,32 +870,32 @@ public class BswServerImpl implements BswServer {
 | 
	
		
			
				|  |  |              if (CollUtil.isEmpty(list) || StrUtil.isBlank(list.get(0).getFpNo())) {
 | 
	
		
			
				|  |  |                  throw new BizException("没有住院蓝字发票,无法上传红字发票");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            blueInvoiceNo = list.get(0).getFpNo();
 | 
	
		
			
				|  |  | -            blueIssueDate = list.get(0).getBlueIssueDate();
 | 
	
		
			
				|  |  | +            relatedInvoiceNumber = list.get(0).getFpNo();
 | 
	
		
			
				|  |  | +            relatedInvoiceCode = list.get(0).getOpCode();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          requestId = Convert.toStr(requestId, OptimalLimitDigitGenerator.generate().toString());
 | 
	
		
			
				|  |  |          MzInvoiceInfo mzInvoiceInfo = createZyInvoiceInfo(uploadParam, requestId);
 | 
	
		
			
				|  |  |          //先插入记录
 | 
	
		
			
				|  |  |          mzDzfpUploadMapper.delete(getQueryWrapper(uploadParam));
 | 
	
		
			
				|  |  |          uploadParam.setRequestId(requestId);
 | 
	
		
			
				|  |  | -//        uploadParam.setReceiptNo(requestId);
 | 
	
		
			
				|  |  | +        uploadParam.setSerialNo(uploadParam.getSerialNo());
 | 
	
		
			
				|  |  |          mzDzfpUploadMapper.insert(uploadParam);
 | 
	
		
			
				|  |  |          ResultInfo resultInfo;
 | 
	
		
			
				|  |  |          if (uploadParam.getTypeFlag() == 3) {
 | 
	
		
			
				|  |  |              resultInfo = zyBlueInvoice(mzInvoiceInfo);
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              //作废
 | 
	
		
			
				|  |  | -            mzInvoiceInfo.setBlueInvoiceNo(blueInvoiceNo);
 | 
	
		
			
				|  |  | -            mzInvoiceInfo.setBlueIssueDate(blueIssueDate);
 | 
	
		
			
				|  |  | +            mzInvoiceInfo.setRelatedInvoiceNumber(relatedInvoiceNumber);
 | 
	
		
			
				|  |  | +            mzInvoiceInfo.setRelatedInvoiceCode(relatedInvoiceCode);
 | 
	
		
			
				|  |  |              mzInvoiceInfo.setRedOffsetCode("01");
 | 
	
		
			
				|  |  |              resultInfo = zyRedInvoice(mzInvoiceInfo);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if (!ResultInfo.SUCCESS_CODE.equals(resultInfo.getCode())) {
 | 
	
		
			
				|  |  | +        if (!ResultInfo.SUCCESS_CODE.equals(resultInfo.getData().get("result"))) {
 | 
	
		
			
				|  |  |              return R.error(resultInfo.getMessage());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        MzReceiptSerial mzReceiptSerial = new MzReceiptSerial(uploadParam.getPatientId(), uploadParam.getTimes());
 | 
	
		
			
				|  |  | +        MzReceiptSerial mzReceiptSerial = new MzReceiptSerial(uploadParam.getPatientId(), uploadParam.getTimes(),Integer.parseInt(uploadParam.getSerialNo()));
 | 
	
		
			
				|  |  |          mzReceiptSerial.setReceiptNo(uploadParam.getReceiptNo());
 | 
	
		
			
				|  |  | -        mzReceiptSerial.setOperatorId(StrUtil.isNotBlank(uploadParam.getOpId()) ? uploadParam.getOpId() : TokenUtil.getUser().getUserIdCode());
 | 
	
		
			
				|  |  | +//        mzReceiptSerial.setOperatorId(StrUtil.isNotBlank(uploadParam.getOpId()) ? uploadParam.getOpId() : TokenUtil.getUser().getUserIdCode());
 | 
	
		
			
				|  |  |          return saveMzDzfpUpload(mzReceiptSerial, mzInvoiceInfo, resultInfo, uploadParam.getTypeFlag());
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -949,7 +949,7 @@ public class BswServerImpl implements BswServer {
 | 
	
		
			
				|  |  |                  .outpatientNo(aPatientMi.getOutpatientNo())
 | 
	
		
			
				|  |  |                  .deptName(zdUnitCode.getName())
 | 
	
		
			
				|  |  |                  .deptCode(uploadParam.getPatientId())
 | 
	
		
			
				|  |  | -                .sex(aPatientMi.getSex())
 | 
	
		
			
				|  |  | +                .sex(GenderEnum.getGenderByCode(Integer.parseInt(aPatientMi.getSex())).name)
 | 
	
		
			
				|  |  |                  .age(aPatientMi.getAge().toString())
 | 
	
		
			
				|  |  |                  .patientName(employee.getEmployeeName())
 | 
	
		
			
				|  |  |                  .patientIdTypeCode(gePatientIdTypeCode(aPatientMi.getPsnCertType()))
 | 
	
	
		
			
				|  | @@ -1074,6 +1074,7 @@ public class BswServerImpl implements BswServer {
 | 
	
		
			
				|  |  |                              .serialNo(Convert.toInt(billItem.getCode()))
 | 
	
		
			
				|  |  |                              .itemTypeName(billItem.getName())
 | 
	
		
			
				|  |  |                              .itemName(billItem.getName())
 | 
	
		
			
				|  |  | +                            .itemCode(billItem.getCode())
 | 
	
		
			
				|  |  |                              .amount(typeFlag == 4 ? fee.negate() : fee)
 | 
	
		
			
				|  |  |                              .taxRate(BigDecimal.ZERO)
 | 
	
		
			
				|  |  |                              .taxAmount(BigDecimal.ZERO)
 | 
	
	
		
			
				|  | @@ -1109,7 +1110,7 @@ public class BswServerImpl implements BswServer {
 | 
	
		
			
				|  |  |  //        String paramJson = JsonUtil.object2Json(mzInvoiceInfo);
 | 
	
		
			
				|  |  |  //        return requestInvoice(paramJson, url, "开具住院蓝字发票");
 | 
	
		
			
				|  |  |          String url = getUrl() + "public/ebill/invoicehisissue";
 | 
	
		
			
				|  |  | -        JSMzInvoiceInfo jsMzInvoiceInfo = new JSMzInvoiceInfo().transformFromMzInvoiceInfo(mzInvoiceInfo);
 | 
	
		
			
				|  |  | +        JSMzInvoiceInfo jsMzInvoiceInfo = new JSMzInvoiceInfo().transformFromMzInvoiceInfo(mzInvoiceInfo,"01");
 | 
	
		
			
				|  |  |          String paramJson = JsonUtil.object2Json(jsMzInvoiceInfo);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          log.info("url:{}", url);
 | 
	
	
		
			
				|  | @@ -1125,9 +1126,17 @@ public class BswServerImpl implements BswServer {
 | 
	
		
			
				|  |  |       * @return: cn.hnthyy.thmz.entity.mzdzfp.ResultInfo
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      public ResultInfo zyRedInvoice(MzInvoiceInfo mzInvoiceInfo) {
 | 
	
		
			
				|  |  | -        String url = getUrl() + "bsw-server/evasp/api/nscs/hospital/redInvoice";
 | 
	
		
			
				|  |  | +//        String url = getUrl() + "bsw-server/evasp/api/nscs/hospital/redInvoice";
 | 
	
		
			
				|  |  | +//        String paramJson = JsonUtil.object2Json(mzInvoiceInfo);
 | 
	
		
			
				|  |  | +//        return requestInvoice(paramJson, url, "开具住院红字发票");
 | 
	
		
			
				|  |  | +        String url = getUrl() + "public/ebill/invoicehiswriteoff";
 | 
	
		
			
				|  |  |          String paramJson = JsonUtil.object2Json(mzInvoiceInfo);
 | 
	
		
			
				|  |  | -        return requestInvoice(paramJson, url, "开具住院红字发票");
 | 
	
		
			
				|  |  | +        JSRedMzInvoiceInfo jsRedMzInvoiceInfo = new JSRedMzInvoiceInfo().transformFromMzInvoiceInfo(mzInvoiceInfo,"01");
 | 
	
		
			
				|  |  | +        String paramJson1 = JsonUtil.object2Json(jsRedMzInvoiceInfo);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        log.info("url:{}", url);
 | 
	
		
			
				|  |  | +        log.info("请求前参数:{}", paramJson);
 | 
	
		
			
				|  |  | +        return requestInvoice(paramJson1, url, "开具住院红字发票");
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -1141,7 +1150,7 @@ public class BswServerImpl implements BswServer {
 | 
	
		
			
				|  |  |  //        String url = getUrl() + "bsw-server/evasp/api/nscs/outpatient/redInvoice";
 | 
	
		
			
				|  |  |          String url = getUrl() + "public/ebill/invoicehiswriteoff";
 | 
	
		
			
				|  |  |          String paramJson = JsonUtil.object2Json(mzInvoiceInfo);
 | 
	
		
			
				|  |  | -        JSRedMzInvoiceInfo jsRedMzInvoiceInfo = new JSRedMzInvoiceInfo().transformFromMzInvoiceInfo(mzInvoiceInfo);
 | 
	
		
			
				|  |  | +        JSRedMzInvoiceInfo jsRedMzInvoiceInfo = new JSRedMzInvoiceInfo().transformFromMzInvoiceInfo(mzInvoiceInfo,"01");
 | 
	
		
			
				|  |  |          String paramJson1 = JsonUtil.object2Json(jsRedMzInvoiceInfo);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          log.info("url:{}", url);
 |