|  | @@ -12,6 +12,7 @@ import thyyxxk.webserver.entity.ResultVo;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.yibao.dismiss.*;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.yibao.patient.Overview;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.yibao.patient.Patient;
 | 
	
		
			
				|  |  | +import thyyxxk.webserver.service.externalhttp.SiInjurySystem;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.service.externalhttp.SiZySrvc;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.utils.*;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -25,11 +26,13 @@ import java.util.*;
 | 
	
		
			
				|  |  |  public class DismissService {
 | 
	
		
			
				|  |  |      private final DismissDao dao;
 | 
	
		
			
				|  |  |      private final SiZySrvc zySrvc;
 | 
	
		
			
				|  |  | +    private final SiInjurySystem injury;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | -    public DismissService(DismissDao dao, SiZySrvc zySrvc) {
 | 
	
		
			
				|  |  | +    public DismissService(DismissDao dao, SiZySrvc zySrvc, SiInjurySystem injury) {
 | 
	
		
			
				|  |  |          this.dao = dao;
 | 
	
		
			
				|  |  |          this.zySrvc = zySrvc;
 | 
	
		
			
				|  |  | +        this.injury = injury;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public ResultVo<Object> dismiss(Patient param) {
 | 
	
	
		
			
				|  | @@ -208,6 +211,16 @@ public class DismissService {
 | 
	
		
			
				|  |  |                  exception.setMessage(feeCheck.getMessage());
 | 
	
		
			
				|  |  |                  throw new BizException(exception);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            String injurySerialNo = dao.selectInjurySerialNo(patNo, times, ledgerSn);
 | 
	
		
			
				|  |  | +            if (StringUtil.notBlank(injurySerialNo)) {
 | 
	
		
			
				|  |  | +                ResultVo<String> feeCheck = injury.preCalculateCost(param);
 | 
	
		
			
				|  |  | +                if (feeCheck.getCode() != ExceptionEnum.SUCCESS.getCode()) {
 | 
	
		
			
				|  |  | +                    ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
 | 
	
		
			
				|  |  | +                    exception.setMessage(feeCheck.getMessage());
 | 
	
		
			
				|  |  | +                    throw new BizException(exception);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return ResultVoUtil.success();
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -217,8 +230,9 @@ public class DismissService {
 | 
	
		
			
				|  |  |          updateHicNo(settleFee.getInpatientNo());
 | 
	
		
			
				|  |  |          settleFee.setLedgerSn(dao.getLedgerSn(settleFee.getInpatientNo(), settleFee.getAdmissTimes()));
 | 
	
		
			
				|  |  |          String mdtrtId = dao.selectMdtrtId(settleFee.getInpatientNo(), settleFee.getAdmissTimes(), settleFee.getLedgerSn());
 | 
	
		
			
				|  |  | +        String injurySerialNo = dao.selectInjurySerialNo(settleFee.getInpatientNo(), settleFee.getAdmissTimes(), settleFee.getLedgerSn());
 | 
	
		
			
				|  |  |          // 医保病人进行医保结算
 | 
	
		
			
				|  |  | -        if (StringUtil.notBlank(mdtrtId)) {
 | 
	
		
			
				|  |  | +        if (StringUtil.notBlank(mdtrtId) || StringUtil.notBlank(injurySerialNo)) {
 | 
	
		
			
				|  |  |              int write;
 | 
	
		
			
				|  |  |              dao.deleteZyLedgerFileYb(settleFee.getInpatientNo(), settleFee.getAdmissTimes(), settleFee.getLedgerSn());
 | 
	
		
			
				|  |  |              String cashPay = settleFee.getXjzf();
 | 
	
	
		
			
				|  | @@ -311,6 +325,13 @@ public class DismissService {
 | 
	
		
			
				|  |  |          if (StringUtil.isBlank(restype)) {
 | 
	
		
			
				|  |  |              restype = "01";
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        if (restype.equals("01")) {
 | 
	
		
			
				|  |  | +            String injurySerialNo = dao.selectInjurySerialNo(patNo, times, ledgerSn);
 | 
	
		
			
				|  |  | +            if (StringUtil.notBlank(injurySerialNo)) {
 | 
	
		
			
				|  |  | +                restype = "al";
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          String deposit = dao.selectDepositSumamt(patNo, times, ledgerSn);
 | 
	
		
			
				|  |  |          if (StringUtil.isBlank(deposit)) {
 | 
	
		
			
				|  |  |              deposit = "0";
 |