| 
					
				 | 
			
			
				@ -3539,7 +3539,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\ttmi.drug_code,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\ttmi.org_code \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tHAVING\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\tsum( tmi.qty ) < sum( tmi.rated_inventory ) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\tsum( tmi.qty ) <= sum( tmi.rated_inventory ) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t) AS a \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tEXISTS (\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3554,7 +3554,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\tAND a.ratedInventory <= b.upper \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\tAND (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\t\t( b.match_unit = '件' AND a.qty < b.match_value ) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\t\tOR ( b.match_unit = '%' AND a.qty < b.match_value * a.ratedInventory ) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\t\tOR ( b.match_unit = '%' AND a.qty < b.match_value * a.ratedInventory ) OR (a.qty = 0)\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t\t) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\t)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            sql = "SELECT\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3643,7 +3643,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\ttmi.drug_code,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\ttmi.org_code \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tHAVING\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tsum( tmi.qty ) < sum( tmi.rated_inventory ) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tsum( tmi.qty ) <= sum( tmi.rated_inventory ) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t) AS a \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tEXISTS (\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3658,7 +3658,7 @@ public class MedicinedeviceService  extends BaseJpaService<Mediicinedevice, Medi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND a.ratedInventory <= b.upper \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\tAND (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\t( b.match_unit = '件' AND a.qty < b.match_value ) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\tOR ( b.match_unit = '%' AND a.qty < b.match_value * a.ratedInventory ) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t\tOR ( b.match_unit = '%' AND a.qty < b.match_value * a.ratedInventory ) OR (a.qty = 0) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t\t) \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String countSql = "select count(1) from (SELECT\n" + 
			 |