本文整理汇总了Java中org.oscarehr.common.dao.DrugDao.merge方法的典型用法代码示例。如果您正苦于以下问题:Java DrugDao.merge方法的具体用法?Java DrugDao.merge怎么用?Java DrugDao.merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.oscarehr.common.dao.DrugDao
的用法示例。
在下文中一共展示了DrugDao.merge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Delete
import org.oscarehr.common.dao.DrugDao; //导入方法依赖的package包/类
public void Delete() {
try {
DrugDao drugDao = (DrugDao) SpringUtils.getBean("drugDao");
Drug drug = drugDao.find(getDrugId());
if (drug != null) {
drug.setArchived(true);
drugDao.merge(drug);
}
} catch (Exception e) {
logger.error("unexpected error", e);
}
}
示例2: Delete
import org.oscarehr.common.dao.DrugDao; //导入方法依赖的package包/类
public void Delete() {
try {
DrugDao drugDao=(DrugDao) SpringUtils.getBean("drugDao");
Drug drug=drugDao.find(getDrugId());
if (drug!=null)
{
drug.setArchived(true);
drugDao.merge(drug);
}
} catch (Exception e) {
logger.error("unexpected error", e);
}
}
示例3: update
import org.oscarehr.common.dao.DrugDao; //导入方法依赖的package包/类
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
if (!securityInfoManager.hasPrivilege(LoggedInInfo.getLoggedInInfoFromSession(request), "_rx", "u", null)) {
throw new RuntimeException("missing required security object (_rx)");
}
String demographicNo = request.getParameter("demographicNo");
int drugId = Integer.parseInt(request.getParameter("drugId"));
int swapDrugId = Integer.parseInt(request.getParameter("swapDrugId"));
CaseManagementManager caseManagementManager = (CaseManagementManager) SpringUtils.getBean("caseManagementManager");
List<Drug> drugs = caseManagementManager.getPrescriptions(demographicNo, true);
DrugDao drugDao = (DrugDao) SpringUtils.getBean("drugDao");
Drug myDrug = null;
Drug swapDrug = null;
for (Drug drug : drugs) {
if (drug.getId().intValue() == drugId) {
myDrug = drug;
}
if (drug.getId().intValue() == swapDrugId) {
swapDrug = drug;
}
}
if (myDrug == null || swapDrug == null) {
MiscUtils.getLogger().warn("Couldn't find the drugs to swap!");
} else {
int myPosition = myDrug.getPosition();
int swapPosition = swapDrug.getPosition();
myDrug.setPosition(swapPosition);
swapDrug.setPosition(myPosition);
drugDao.merge(myDrug);
drugDao.merge(swapDrug);
}
try {
response.getWriter().println("ok");
} catch (IOException e) {
logger.error("error", e);
}
return null;
}
示例4: update
import org.oscarehr.common.dao.DrugDao; //导入方法依赖的package包/类
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
String demographicNo = request.getParameter("demographicNo");
int drugId = Integer.parseInt(request.getParameter("drugId"));
int swapDrugId = Integer.parseInt(request.getParameter("swapDrugId"));
String direction = request.getParameter("direction");
CaseManagementManager caseManagementManager = (CaseManagementManager) SpringUtils.getBean("caseManagementManager");
List<Drug> drugs = caseManagementManager.getPrescriptions(demographicNo, true);
DrugDao drugDao = (DrugDao)SpringUtils.getBean("drugDao");
Drug myDrug = null;
Drug swapDrug = null;
for(Drug drug:drugs) {
if(drug.getId().intValue() == drugId) {
myDrug = drug;
}
if(drug.getId().intValue() == swapDrugId) {
swapDrug = drug;
}
}
if(myDrug == null || swapDrug == null) {
MiscUtils.getLogger().warn("Couldn't find the drugs to swap!");
} else {
int myPosition = myDrug.getPosition();
int swapPosition = swapDrug.getPosition();
myDrug.setPosition(swapPosition);
swapDrug.setPosition(myPosition);
drugDao.merge(myDrug);
drugDao.merge(swapDrug);
}
try {
response.getWriter().println("ok");
}catch(IOException e) {
logger.error("error",e);
}
return null;
}