|  | @@ -52,60 +52,79 @@ public interface TransferInOfExpensesDao {
 | 
	
		
			
				|  |  |       * @param serialNo  机制号
 | 
	
		
			
				|  |  |       * @return 返回多个
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    @Select("select " +
 | 
	
		
			
				|  |  | -            "       patient_name =rtrim(a.name), " +
 | 
	
		
			
				|  |  | -            "       item_name = c.name, " +
 | 
	
		
			
				|  |  | -            "       a.quantity  , " +
 | 
	
		
			
				|  |  | +    @Select("select patient_name   =rtrim(a.name), " +
 | 
	
		
			
				|  |  | +            "       item_name      = c.name, " +
 | 
	
		
			
				|  |  | +            "       a.quantity, " +
 | 
	
		
			
				|  |  |              "       self_flag=c.self_flag, " +
 | 
	
		
			
				|  |  | -            "       separate_flag = c.separate_flag, " +
 | 
	
		
			
				|  |  | -            "       suppress_flag = c.suppress_flag, " +
 | 
	
		
			
				|  |  | -            "       charge_code = case a.bill_item_code when '010' then 'BILL01' when '011' then 'BILL28' when '012' then 'BILL02' ELSE  a.charge_item_code end, " +
 | 
	
		
			
				|  |  | +            "       separate_flag  = c.separate_flag, " +
 | 
	
		
			
				|  |  | +            "       suppress_flag  = c.suppress_flag, " +
 | 
	
		
			
				|  |  | +            "       charge_code    = case a.bill_item_code " +
 | 
	
		
			
				|  |  | +            "                            when '010' then 'BILL01' " +
 | 
	
		
			
				|  |  | +            "                            when '011' then 'BILL28' " +
 | 
	
		
			
				|  |  | +            "                            when '012' then 'BILL02' " +
 | 
	
		
			
				|  |  | +            "                            ELSE a.charge_item_code " +
 | 
	
		
			
				|  |  | +            "           end, " +
 | 
	
		
			
				|  |  |              "       charge_code_mx = a.charge_item_code, " +
 | 
	
		
			
				|  |  | -            "       serial = a.serial, " +
 | 
	
		
			
				|  |  | -            "       group_no = a.group_no, " +
 | 
	
		
			
				|  |  | -            "        a.unit_price, " +
 | 
	
		
			
				|  |  | +            "       serial         = a.serial, " +
 | 
	
		
			
				|  |  | +            "       group_no       = a.group_no, " +
 | 
	
		
			
				|  |  | +            "       a.unit_price, " +
 | 
	
		
			
				|  |  |              "       check_flag='0', " +
 | 
	
		
			
				|  |  | -            "       warn_dept =a.warn_dept, " +
 | 
	
		
			
				|  |  | -            "       doctor_code = a.doctor_code, " +
 | 
	
		
			
				|  |  | +            "       warn_dept      =a.warn_dept, " +
 | 
	
		
			
				|  |  | +            "       doctor_code    = a.doctor_code, " +
 | 
	
		
			
				|  |  |              "       bill_item_code = rtrim(a.bill_item_code), " +
 | 
	
		
			
				|  |  | -            "       exec_dept = a.exec_dept," +
 | 
	
		
			
				|  |  | +            "       exec_dept      = a.exec_dept, " +
 | 
	
		
			
				|  |  |              "       a.drug_win " +
 | 
	
		
			
				|  |  | -            "from ${mzTableName} a,${tableName} b,zd_charge_item c " +
 | 
	
		
			
				|  |  | -            "where a.patient_id = b.patient_id and " +
 | 
	
		
			
				|  |  | -            "        a.times = b.times and " +
 | 
	
		
			
				|  |  | -            "        a.receipt_no = b.receipt_no and " +
 | 
	
		
			
				|  |  | -            "        a.serial_no= b.serial_no and " +
 | 
	
		
			
				|  |  | -            "        b.receipt_sn=#{serialNo} and " +
 | 
	
		
			
				|  |  | -            "        a.charge_item_code=c.code and " +
 | 
	
		
			
				|  |  | -            "        isnull(a.group_no,'00')='00' " +
 | 
	
		
			
				|  |  | -            "union all " +
 | 
	
		
			
				|  |  | -            "select patient_name =rtrim(a.name), " +
 | 
	
		
			
				|  |  | -            "       item_name = (select name from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial),/*c.drugname,*/ " +
 | 
	
		
			
				|  |  | +            "from ${mzTableName} a, " +
 | 
	
		
			
				|  |  | +            "     (select distinct patient_id, times, receipt_no, serial_no from ${tableName} where receipt_sn = #{serialNo}) b, " +
 | 
	
		
			
				|  |  | +            "     zd_charge_item c " +
 | 
	
		
			
				|  |  | +            "where a.patient_id = b.patient_id " +
 | 
	
		
			
				|  |  | +            "  and a.times = b.times " +
 | 
	
		
			
				|  |  | +            "  and a.receipt_no = b.receipt_no " +
 | 
	
		
			
				|  |  | +            "  and a.serial_no = b.serial_no " +
 | 
	
		
			
				|  |  | +            "  and a.charge_item_code = c.code " +
 | 
	
		
			
				|  |  | +            "  and isnull(a.group_no, '00') = '00' " +
 | 
	
		
			
				|  |  | +            "union " +
 | 
	
		
			
				|  |  | +            "    all " +
 | 
	
		
			
				|  |  | +            "select patient_name   =rtrim(a.name), " +
 | 
	
		
			
				|  |  | +            "       item_name      = (select name " +
 | 
	
		
			
				|  |  | +            "                         from yp_zd_dict " +
 | 
	
		
			
				|  |  | +            "                         where yp_zd_dict.code = c.charge_code " +
 | 
	
		
			
				|  |  | +            "                           and yp_zd_dict.serial = c.serial), " +
 | 
	
		
			
				|  |  |              "       a.quantity, " +
 | 
	
		
			
				|  |  |              "       self_flag=a.self_flag, " +
 | 
	
		
			
				|  |  | -            "       separate_flag =  (select separate_flag from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial), " +
 | 
	
		
			
				|  |  | -            "       suppress_flag =  (select suprice_flag from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial), " +
 | 
	
		
			
				|  |  | -            "       charge_code = case a.bill_item_code when '010' then 'BILL01' when '011' then 'BILL28' when '012' then 'BILL02' ELSE  a.charge_item_code end, " +
 | 
	
		
			
				|  |  | +            "       separate_flag  = (select separate_flag " +
 | 
	
		
			
				|  |  | +            "                         from yp_zd_dict " +
 | 
	
		
			
				|  |  | +            "                         where yp_zd_dict.code = c.charge_code " +
 | 
	
		
			
				|  |  | +            "                           and yp_zd_dict.serial = c.serial), " +
 | 
	
		
			
				|  |  | +            "       suppress_flag  = (select suprice_flag " +
 | 
	
		
			
				|  |  | +            "                         from yp_zd_dict " +
 | 
	
		
			
				|  |  | +            "                         where yp_zd_dict.code = c.charge_code " +
 | 
	
		
			
				|  |  | +            "                           and yp_zd_dict.serial = c.serial), " +
 | 
	
		
			
				|  |  | +            "       charge_code    = case a.bill_item_code " +
 | 
	
		
			
				|  |  | +            "                            when '010' then 'BILL01' " +
 | 
	
		
			
				|  |  | +            "                            when '011' then 'BILL28' " +
 | 
	
		
			
				|  |  | +            "                            when '012' then 'BILL02' " +
 | 
	
		
			
				|  |  | +            "                            ELSE a.charge_item_code " +
 | 
	
		
			
				|  |  | +            "           end, " +
 | 
	
		
			
				|  |  |              "       charge_code_mx = a.charge_item_code, " +
 | 
	
		
			
				|  |  | -            "       serial = a.serial, " +
 | 
	
		
			
				|  |  | -            "       group_no = a.group_no, " +
 | 
	
		
			
				|  |  | +            "       serial         = a.serial, " +
 | 
	
		
			
				|  |  | +            "       group_no       = a.group_no, " +
 | 
	
		
			
				|  |  |              "       a.unit_price, " +
 | 
	
		
			
				|  |  |              "       check_flag='0', " +
 | 
	
		
			
				|  |  | -            "       warn_dept =a.warn_dept, " +
 | 
	
		
			
				|  |  | -            "       doctor_code = a.doctor_code, " +
 | 
	
		
			
				|  |  | +            "       warn_dept      =a.warn_dept, " +
 | 
	
		
			
				|  |  | +            "       doctor_code    = a.doctor_code, " +
 | 
	
		
			
				|  |  |              "       bill_item_code = rtrim(a.bill_item_code), " +
 | 
	
		
			
				|  |  | -            "       exec_dept = a.exec_dept," +
 | 
	
		
			
				|  |  | +            "       exec_dept      = a.exec_dept, " +
 | 
	
		
			
				|  |  |              "       a.drug_win " +
 | 
	
		
			
				|  |  | -            "from ${mzTableName} a,${tableName} b,yp_base_yf c  " +
 | 
	
		
			
				|  |  | -            "where a.patient_id = b.patient_id and " +
 | 
	
		
			
				|  |  | -            "        a.times = b.times and " +
 | 
	
		
			
				|  |  | -            "        a.receipt_no = b.receipt_no and " +
 | 
	
		
			
				|  |  | -            "        a.serial_no= b.serial_no and " +
 | 
	
		
			
				|  |  | -            "        b.receipt_sn=#{serialNo} and " +
 | 
	
		
			
				|  |  | -            "        a.charge_item_code=c.charge_code and " +
 | 
	
		
			
				|  |  | -            "        a.serial = c.serial and " +
 | 
	
		
			
				|  |  | -            "        a.group_no = c.group_no and " +
 | 
	
		
			
				|  |  | -            "        isnull(a.group_no,'00')<>'00'")
 | 
	
		
			
				|  |  | +            "from ${mzTableName} a, " +
 | 
	
		
			
				|  |  | +            "     (select distinct patient_id, times, receipt_no, serial_no from ${tableName} where receipt_sn = #{serialNo}) b, " +
 | 
	
		
			
				|  |  | +            "     yp_base_yf c " +
 | 
	
		
			
				|  |  | +            "where a.patient_id = b.patient_id " +
 | 
	
		
			
				|  |  | +            "  and a.times = b.times " +
 | 
	
		
			
				|  |  | +            "  and a.receipt_no = b.receipt_no " +
 | 
	
		
			
				|  |  | +            "  and a.serial_no = b.serial_no " +
 | 
	
		
			
				|  |  | +            "  and a.charge_item_code = c.charge_code " +
 | 
	
		
			
				|  |  | +            "  and a.serial = c.serial")
 | 
	
		
			
				|  |  |      List<MzChargeDetail> getSerialNo(@Param("mzTableName") String mzTableName,
 | 
	
		
			
				|  |  |                                       @Param("tableName") String tableName,
 | 
	
		
			
				|  |  |                                       @Param("serialNo") Integer serialNo);
 |