当前位置: 首页>>代码示例>>Java>>正文


Java Drug.isExpired方法代码示例

本文整理汇总了Java中org.oscarehr.common.model.Drug.isExpired方法的典型用法代码示例。如果您正苦于以下问题:Java Drug.isExpired方法的具体用法?Java Drug.isExpired怎么用?Java Drug.isExpired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.oscarehr.common.model.Drug的用法示例。


在下文中一共展示了Drug.isExpired方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMeds

import org.oscarehr.common.model.Drug; //导入方法依赖的package包/类
public ActionForward getMeds(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)  throws IOException {
	Integer demographicNo = Integer.parseInt(request.getParameter("demographicNo"));
	DrugDao drugDao = SpringUtils.getBean(DrugDao.class);
	List<Drug> drugs = drugDao.findByDemographicId(demographicNo, false);
	StringBuilder output = new StringBuilder();
	for(Drug drug:drugs) {
		if(drug.isArchived() || drug.isDeleted() || drug.isDiscontinued() || drug.isExpired()) {
			continue;
		}
		if(drug.getBrandName() != null && drug.getBrandName().length()>0) {
			if(output.length()>0)
				output.append(",");
			output.append(drug.getBrandName());
		}
		else if(drug.getCustomName() != null && drug.getCustomName().length()>0) {
			if(output.length()>0)
				output.append(",");
			output.append(drug.getCustomName());
		} else {
			if(output.length()>0)
				output.append(",");
			output.append(drug.getSpecial());
		}
	}
	
	JSONObject json = JSONObject.fromObject(new LabelValueBean("meds",output.toString().trim()));
	response.getWriter().println(json);
	return null;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:30,代码来源:PregnancyAction.java

示例2: compare

import org.oscarehr.common.model.Drug; //导入方法依赖的package包/类
public int compare(Drug a,Drug b) {
	
	long now = System.currentTimeMillis();
       long month = 1000L * 60L * 60L * 24L * 30L;
       
       
	//current
	if (!a.isExpired() && !a.isArchived()) {
		if(!b.isExpired() && b.getEndDate()!=null && (b.getEndDate().getTime() - now <= month)) {
			return -1;
		}
		if(b.isExpired() || b.isArchived() || b.isDiscontinued()) {
			return -1;
		}
	}
	
	//current but will expire
	if (!a.isExpired() && a.getEndDate()!=null && (a.getEndDate().getTime() - now <= month)) { 
           if(b.isExpired() || b.isDiscontinued()) {
           	return -1;
           }
       }
	
	//expired
	if(a.isExpired() && b.isDiscontinued()) {
		return -1;
	}
	
	//discontinued
	
	
	if(a.isDiscontinued() && !b.isDiscontinued()) {
		return 1;
	}
	
	if(a.isExpired()) {
		if(!b.isExpired() && b.getEndDate()!=null && (b.getEndDate().getTime() - now <= month)) {
			return 1;
		}
		if(!b.isExpired() && !b.isArchived()) {
			return 1;
		}			
	}
	
	if(!a.isExpired() && a.getEndDate()!=null && (a.getEndDate().getTime() - now <= month)) {
		if(!b.isExpired() && !b.isArchived()) {
			return 1;
		}
	}				
	
	//all other are the same	
	return 0;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:54,代码来源:ShowAllSorter.java


注:本文中的org.oscarehr.common.model.Drug.isExpired方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。