|  | @@ -8,9 +8,9 @@ import thyyxxk.webserver.config.exception.BizException;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.config.exception.ExceptionEnum;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.dao_his.yibao.DismissDao;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.pojo.ResultVo;
 | 
	
		
			
				|  |  | -import thyyxxk.webserver.pojo.dictionary.CodeNamePojo;
 | 
	
		
			
				|  |  | -import thyyxxk.webserver.pojo.yibao.dismiss.ActOrderPojo;
 | 
	
		
			
				|  |  | -import thyyxxk.webserver.pojo.yibao.dismiss.DismissOrderGroupPojo;
 | 
	
		
			
				|  |  | +import thyyxxk.webserver.pojo.dictionary.PureCodeName;
 | 
	
		
			
				|  |  | +import thyyxxk.webserver.pojo.yibao.dismiss.ActOrderDetail;
 | 
	
		
			
				|  |  | +import thyyxxk.webserver.pojo.yibao.dismiss.ActOrderGroup;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.pojo.yibao.dismiss.ReceiptFeePojo;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.pojo.yibao.dismiss.YbSettleFeePojo;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.pojo.yibao.patient.PatientPojo;
 | 
	
	
		
			
				|  | @@ -26,15 +26,13 @@ import java.util.List;
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class DismissService {
 | 
	
		
			
				|  |  |      private final DismissDao dao;
 | 
	
		
			
				|  |  | -    private final YibaoHttpService http;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | -    public DismissService(DismissDao dao, YibaoHttpService http) {
 | 
	
		
			
				|  |  | +    public DismissService(DismissDao dao) {
 | 
	
		
			
				|  |  |          this.dao = dao;
 | 
	
		
			
				|  |  | -        this.http = http;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public ResultVo<List<DismissOrderGroupPojo>> getActOrders(String inpatientNo, Integer admissTimes) {
 | 
	
		
			
				|  |  | +    public ResultVo<List<ActOrderGroup>> getActOrders(String inpatientNo, Integer admissTimes) {
 | 
	
		
			
				|  |  |          final Integer ledgerSn = dao.getLedgerSn(inpatientNo, admissTimes);
 | 
	
		
			
				|  |  |          if (ledgerSn < 1) {
 | 
	
		
			
				|  |  |              return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "获取帐页数失败。");
 | 
	
	
		
			
				|  | @@ -46,21 +44,20 @@ public class DismissService {
 | 
	
		
			
				|  |  |          if (dao.getOrderList(inpatientNo, admissTimes) < 0) {
 | 
	
		
			
				|  |  |              return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "查询医嘱失败。");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        List<ActOrderPojo> allOrders = dao.getActOrderDetail();
 | 
	
		
			
				|  |  | +        List<ActOrderDetail> allOrders = dao.getActOrderDetail();
 | 
	
		
			
				|  |  |          if (allOrders == null) {
 | 
	
		
			
				|  |  |              return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "查询医嘱失败。");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return analyzeActOrders(allOrders);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private ResultVo<List<DismissOrderGroupPojo>> analyzeActOrders(List<ActOrderPojo> allOrders) {
 | 
	
		
			
				|  |  | -        HashMap<String, DismissOrderGroupPojo> temp = new HashMap<>();
 | 
	
		
			
				|  |  | -        for (ActOrderPojo item : allOrders) {
 | 
	
		
			
				|  |  | +    private ResultVo<List<ActOrderGroup>> analyzeActOrders(List<ActOrderDetail> allOrders) {
 | 
	
		
			
				|  |  | +        HashMap<String, ActOrderGroup> temp = new HashMap<>();
 | 
	
		
			
				|  |  | +        for (ActOrderDetail item : allOrders) {
 | 
	
		
			
				|  |  |              String actOrderNo = item.getActOrderNo();
 | 
	
		
			
				|  |  |              String fee = item.getChargeFee();
 | 
	
		
			
				|  |  | -            String status = item.getChargeStatus();
 | 
	
		
			
				|  |  |              if (!temp.containsKey(actOrderNo)) {
 | 
	
		
			
				|  |  | -                DismissOrderGroupPojo aModel = new DismissOrderGroupPojo(actOrderNo, fee, status, item.getCxFlag());
 | 
	
		
			
				|  |  | +                ActOrderGroup aModel = new ActOrderGroup(actOrderNo, fee, item.getChargeStatus(), item.getCxFlag());
 | 
	
		
			
				|  |  |                  if (aModel.getList() == null) {
 | 
	
		
			
				|  |  |                      aModel.setList(new ArrayList<>());
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -71,14 +68,14 @@ public class DismissService {
 | 
	
		
			
				|  |  |                  temp.get(actOrderNo).getList().add(item);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        List<DismissOrderGroupPojo> list = new ArrayList<>();
 | 
	
		
			
				|  |  | -        for (HashMap.Entry<String, DismissOrderGroupPojo> modelEntry : temp.entrySet()) {
 | 
	
		
			
				|  |  | +        List<ActOrderGroup> list = new ArrayList<>();
 | 
	
		
			
				|  |  | +        for (HashMap.Entry<String, ActOrderGroup> modelEntry : temp.entrySet()) {
 | 
	
		
			
				|  |  |              list.add(modelEntry.getValue());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return ResultVoUtil.success(list);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public ResultVo<List<CodeNamePojo>> calculateForDismiss(PatientPojo param) {
 | 
	
		
			
				|  |  | +    public ResultVo<List<PureCodeName>> calculateForDismiss(PatientPojo param) {
 | 
	
		
			
				|  |  |          final String inpatientNo = param.getInpatientNo();
 | 
	
		
			
				|  |  |          final Integer admissTimes = param.getAdmissTimes();
 | 
	
		
			
				|  |  |          if (param.getDismissFlag() == 1) {
 | 
	
	
		
			
				|  | @@ -158,9 +155,10 @@ public class DismissService {
 | 
	
		
			
				|  |  |              throw new BizException(exception);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        List<CodeNamePojo> feeNegativeList = dao.feeOrderNegative(inpatientNo, admissTimes);
 | 
	
		
			
				|  |  | +        List<PureCodeName> feeNegativeList = dao.feeOrderNegative(inpatientNo, admissTimes);
 | 
	
		
			
				|  |  |          if (feeNegativeList.size() > 0) {
 | 
	
		
			
				|  |  | -            return ResultVoUtil.fail(ExceptionEnum.EXIST_NEGATIVE_FEES, "此患者费用清单存在负数。", feeNegativeList);
 | 
	
		
			
				|  |  | +            return ResultVoUtil.fail(ExceptionEnum.EXIST_NEGATIVE_FEES, "此患者费用清单存在负数。",
 | 
	
		
			
				|  |  | +                    feeNegativeList);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          dao.deleteTemporaryTable(inpatientNo, admissTimes);
 | 
	
		
			
				|  |  |          final Integer transFlag = param.getDismissFlag() == 1 ? 0 : 2;
 | 
	
	
		
			
				|  | @@ -188,7 +186,7 @@ public class DismissService {
 | 
	
		
			
				|  |  |          if (param.getDismissFlag() == 2 && !param.getResponceType().trim().equals("01")) {
 | 
	
		
			
				|  |  |              param.setStaffId(TokenUtil.getTokenUserId());
 | 
	
		
			
				|  |  |              String hisTotalCharge = dao.getTotalCharge(inpatientNo, admissTimes, lastZjdzDatetime, actOrderDisDate);
 | 
	
		
			
				|  |  | -            ResultVo<Object> resultVo = http.httpPost("preCalculateCost", param, param.getResponceType());
 | 
	
		
			
				|  |  | +            ResultVo<Object> resultVo = YibaoHttpService.httpPost("preCalculateCost", param, param.getResponceType());
 | 
	
		
			
				|  |  |              log.info("preCalculateCost: {}", resultVo);
 | 
	
		
			
				|  |  |              if (resultVo.getCode() != 200 && resultVo.getCode() != 2002) {
 | 
	
		
			
				|  |  |                  ExceptionEnum exception = ExceptionEnum.LOGICAL_ERROR;
 | 
	
	
		
			
				|  | @@ -263,7 +261,7 @@ public class DismissService {
 | 
	
		
			
				|  |  |      private int writeReceiptTable(YbSettleFeePojo indata) {
 | 
	
		
			
				|  |  |          if (dao.beforeWriteReceiptTable(indata.getInpatientNo(), indata.getAdmissTimes(),
 | 
	
		
			
				|  |  |                  indata.getLedgerSn()) < 1) return -1;
 | 
	
		
			
				|  |  | -        final int receiptSn = dao.getReceiptSn(indata.getInpatientNo(), indata.getAdmissTimes(),
 | 
	
		
			
				|  |  | +        final int infantFlag = dao.selectInfantFlag(indata.getInpatientNo(), indata.getAdmissTimes(),
 | 
	
		
			
				|  |  |                  indata.getLedgerSn()); // =0 无婴儿,>0 有婴儿
 | 
	
		
			
				|  |  |          final Date dismissDate = getDismissDate(indata.getFlag(), indata.getInpatientNo(), indata.getAdmissTimes(),
 | 
	
		
			
				|  |  |                  indata.getZjdzDatetime());
 | 
	
	
		
			
				|  | @@ -287,7 +285,7 @@ public class DismissService {
 | 
	
		
			
				|  |  |                  fees.get(23).getChargePercent(), fees.get(24).getChargePercent(), fees.get(25).getChargePercent(),
 | 
	
		
			
				|  |  |                  fees.get(26).getChargePercent(), fees.get(27).getChargePercent()) < 1)
 | 
	
		
			
				|  |  |              return -1;
 | 
	
		
			
				|  |  | -        if (receiptSn > 0) {
 | 
	
		
			
				|  |  | +        if (infantFlag > 0) {
 | 
	
		
			
				|  |  |              totalCharge = getTotalCharge(fees, true);
 | 
	
		
			
				|  |  |              return dao.writeReceiptTable(indata.getInpatientNo(), indata.getAdmissTimes(), indata.getLedgerSn(), 4,
 | 
	
		
			
				|  |  |                      admissDate, dismissDate, indata.getWardCode(), indata.getDeptCode(), dismissDate, "04",
 |