|  | @@ -1004,16 +1004,17 @@ public interface ChargeFeeVoMapper {
 | 
	
		
			
				|  |  |              " (select dd.name from yp_zd_dict cc, yp_zd_drug_kind dd where cc.drug_kind = dd.code and cc.code = a.charge_item_code and cc.serial = a.serial)),  " +
 | 
	
		
			
				|  |  |              " je=round(a.quantity * a.unit_price * isnull(a.drug_win,1),2),  " +
 | 
	
		
			
				|  |  |              " c.charge_date,  " +
 | 
	
		
			
				|  |  | -            " c.dcount_date,   " +
 | 
	
		
			
				|  |  | +            " dcount_date=c.charge_dcount_date,   " +
 | 
	
		
			
				|  |  |              "      quty = a.quantity, " +
 | 
	
		
			
				|  |  |              "      price = a.unit_price, " +
 | 
	
		
			
				|  |  |              " e.parent_code " +
 | 
	
		
			
				|  |  |              "  from   ${firstTableName} a ," +
 | 
	
		
			
				|  |  | -            "  (select distinct patient_id,times,receipt_no, serial_no,receipt_sn,charge_date,dcount_date from ${secondTableName}) c," +
 | 
	
		
			
				|  |  | +            "  (select distinct patient_id,times,receipt_no, serial_no,receipt_sn,charge_date,charge_dcount_date from ${secondTableName}) c," +
 | 
	
		
			
				|  |  |              "  zd_charge_item d," +
 | 
	
		
			
				|  |  |              "  zy_zd_audit_item  e " +
 | 
	
		
			
				|  |  |              "   where " +
 | 
	
		
			
				|  |  | -            "    a.patient_id = c.patient_id " +
 | 
	
		
			
				|  |  | +            " a.pay_mark <![CDATA[<>]]> 9  " +
 | 
	
		
			
				|  |  | +            "   and a.patient_id = c.patient_id " +
 | 
	
		
			
				|  |  |              " and  a.times = c.times " +
 | 
	
		
			
				|  |  |              "   and a.receipt_no = c.receipt_no " +
 | 
	
		
			
				|  |  |              "  and  a.serial_no = c.serial_no  " +
 | 
	
	
		
			
				|  | @@ -1022,7 +1023,7 @@ public interface ChargeFeeVoMapper {
 | 
	
		
			
				|  |  |              "  when 'BILL10' then 'BILL01' when 'BILL11' then 'BILL28' when 'BILL12' then 'BILL02' else a.charge_bill_code end *=d.code " +
 | 
	
		
			
				|  |  |              "  and         isnull(d.audit_code,e.code)=e.code) mzsr  where mzsr.je <![CDATA[<>]]> 0 " +
 | 
	
		
			
				|  |  |              "  and  case '1' when #{caseType} then mzsr.charge_date else  mzsr.dcount_date end <![CDATA[>=]]>#{beginDate,jdbcType=TIMESTAMP} " +
 | 
	
		
			
				|  |  | -            "  and  case '1' when #{caseType} then mzsr.charge_date else  mzsr.dcount_date end <![CDATA[<=]]>#{endDate,jdbcType=TIMESTAMP} " +
 | 
	
		
			
				|  |  | +            "  and  case '1' when #{caseType} then mzsr.charge_date else  mzsr.dcount_date end <![CDATA[<]]>#{endDate,jdbcType=TIMESTAMP} " +
 | 
	
		
			
				|  |  |              "<when test='patientIds!=null'>" +
 | 
	
		
			
				|  |  |              " and mzsr.patient_id in" +
 | 
	
		
			
				|  |  |              "<foreach item='item' index='index' collection='patientIds' open='(' separator=',' close=')'>" +
 | 
	
	
		
			
				|  | @@ -1050,4 +1051,13 @@ public interface ChargeFeeVoMapper {
 | 
	
		
			
				|  |  |              + "</script>"})
 | 
	
		
			
				|  |  |      List<Mzmxsr> selectThmzmxsr(ThmzmxsrParamsVo thmzmxsrParamsVo);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 统计选定日期内费用总额 用于判断是否需要插入收费明细
 | 
	
		
			
				|  |  | +     * @param thmzmxsrParamsVo
 | 
	
		
			
				|  |  | +     * @return
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Select("select patient_id,SUM(total_charge)  from mz_receipt_serial where charge_dcount_date >=#{beginDate,jdbcType=TIMESTAMP} and  charge_dcount_date <#{endDate,jdbcType=TIMESTAMP}  GROUP BY patient_id order by patient_id desc ")
 | 
	
		
			
				|  |  | +    List<Map<String,Object>> selectSumAmount(ThmzmxsrParamsVo thmzmxsrParamsVo);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |