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


Java Drug类代码示例

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


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

示例1: update

import org.oscarehr.common.model.Drug; //导入依赖的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 prescriptId = request.getParameter("prescriptId");
      String value= request.getParameter("value");
      Drug drug = drugDao.find(Integer.valueOf(prescriptId));
      if(drug != null) {
      	drug.setHideFromCpp(Boolean.valueOf(value));
      }
      drugDao.merge(drug);
      try {
      	response.getWriter().println("ok");
      }catch(IOException e) {
      	logger.error("error",e);
      }
      return null;
  }
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:20,代码来源:RxHideCppAction.java

示例2: statusCodeCompleteTest

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
@Test
public void statusCodeCompleteTest() {
	Drug drug2 = dao.findByDemographicId(Constants.Runtime.VALID_DEMOGRAPHIC).get(0);
	drug2.setLongTerm(false);
	MedicationsModel medicationsModel2 = new MedicationsModel(drug2);

	ActStatus status = medicationsModel2.getStatusCode();
	assertNotNull(status);
	assertEquals(ActStatus.Completed, status);

	Drug drug3 = dao.findByDemographicId(Constants.Runtime.VALID_DEMOGRAPHIC).get(0);
	drug3.setArchived(true);
	MedicationsModel medicationsModel3 = new MedicationsModel(drug3);

	ActStatus status2 = medicationsModel3.getStatusCode();
	assertNotNull(status2);
	assertEquals(ActStatus.Completed, status2);
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:19,代码来源:MedicationsModelTest.java

示例3: testUpdateDrugWithValidInput

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
@Test
public void testUpdateDrugWithValidInput() {

    LoggedInInfo info = new LoggedInInfo();

    Drug d = new Drug();

    d.setDemographicId(1);
    d.setId(1);
    d.setGenericName("ASA");

    Drug result = this.updateDrug(info, d);

    assertNotNull(result);
    assertEquals(1, (int) d.getId()); //should take on id assigned by dao.addNewDrug
    assertEquals("ASA", d.getGenericName()); //should not change other fields.

    // merge() should have adjusted the this.old variable
    // to have archived status
    assertTrue(MockDrugDao.old.isArchived());
    assertEquals("represcribed", MockDrugDao.old.getArchivedReason());

}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:24,代码来源:RxManagerTest.java

示例4: setResultSpecialQuantityRepeat

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
private static void setResultSpecialQuantityRepeat(RxPrescriptionData.Prescription rx, Drug d) {
	String qStr = d.getQuantity();
	Pattern p1 = Pattern.compile("\\d+");
	Matcher m1 = p1.matcher(qStr);
	if (m1.find()) {
		String qNum = qStr.substring(m1.start(), m1.end());
		rx.setQuantity(qNum);
		//get the quantity unit
		String qUnit = qStr.replace(qNum, "").trim();
		if (qUnit != null && qUnit.length() > 0) {
			MiscUtils.getLogger().debug("changing unitName in setResultSpecialQuantityRepeat ");
			rx.setUnitName(qUnit);
		}
	}
	rx.setUnitName(d.getUnitName());

	rx.setRepeat(d.getRepeat());
	rx.setSpecial(d.getSpecial());
	rx.setSpecial(trimSpecial(rx));
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:21,代码来源:RxUtil.java

示例5: getMedicationsOrderByDate

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
/**
 * This method returns all the Drugs as a List associated with the
 * demographicId given, whether it's been archived or not, and in descending
 * order by rxDate.
 *
 * @param demographicId	Not Null
 * @param archived TRUE = not active, FALSE = active, null = all
 * @return
 */
public static List<Drug> getMedicationsOrderByDate(int demographicId, boolean archived) {
    //Gets the list of drugs
    List<Drug> drugList = getMedications(demographicId, archived);
    //Sorts the list of drugs by rxDate in descending order. 
    List<Drug> drugSortedList = new ArrayList<Drug>();
    for (int i = 0; i < drugList.size(); i++) {
        Drug toBeInserted = new Drug();
        toBeInserted.setRxDate(new Date(0));
        for (Drug aDrug : drugList) {
            if (aDrug.getRxDate().after(toBeInserted.getRxDate())) {
                toBeInserted = aDrug;
            }
        }
        drugSortedList.add(i, toBeInserted);
        drugList.remove(toBeInserted);
    }
    return drugSortedList;
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:28,代码来源:MedicationUtil.java

示例6: testPrescribeBasicMultiple

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
@Test
public void testPrescribeBasicMultiple(){

    List<Drug> drugs = new ArrayList<Drug>();
    drugs.add(MockDrugDao.getTestDrug());
    drugs.add(MockDrugDao.getTestDrug());
    drugs.add(MockDrugDao.getTestDrug());

    LoggedInInfo info = new LoggedInInfo();

    PrescriptionDrugs pd = prescribe(info, drugs, 1);

    assertNotNull(pd);
    assertEquals(pd.drugs.size(), 3);
    assertNotNull(pd.prescription);

}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:18,代码来源:RxManagerTest.java

示例7: MedicationsPopulator

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
MedicationsPopulator(PatientExport patientExport) {
	bodyConstants = Medications.getConstants();
	mapDrugs = new HashMap<Integer, ArrayList<Drug>>();
	if(patientExport.isLoaded()) {
		allDrugs = patientExport.getMedications();
	}
	Collections.reverse(allDrugs); // Order recent drugs first

	if(allDrugs != null) {
		for(Drug drug : allDrugs) {
			Integer din;
			try {
				din = Integer.parseInt(drug.getRegionalIdentifier());
			} catch (NumberFormatException e) {
				din = Constants.Runtime.INVALID_VALUE;
			}

			if(mapDrugs.containsKey(din)) {
				mapDrugs.get(din).add(drug);
			} else {
				mapDrugs.put(din, new ArrayList<Drug>(Arrays.asList(drug)));
			}
		}
	}
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:26,代码来源:MedicationsPopulator.java

示例8: testShouldAttemptToAddDrugIfDoesNotExist

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
@Test
public void testShouldAttemptToAddDrugIfDoesNotExist(){

    List<Drug> drugs = new ArrayList<Drug>();
    Drug d = MockDrugDao.getTestDrug();
    d.setId(3); //result in MockDrugDao.find() failing.
    d.setGenericName("ASA"); // allowed to add in test MockDrugDao.addNewDrug
    drugs.add(d);
    LoggedInInfo info = new LoggedInInfo();
    PrescriptionDrugs pd = prescribe(info, drugs, 1);

    assertNotNull(pd);
    assertEquals(MockDrugDao.daoAddNewDrugCalled, 1);
    assertEquals(pd.drugs.get(0).getGenericName(), "ASA");

}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:17,代码来源:RxManagerTest.java

示例9: findByDemographicIdOrderByDate

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
/**
 * @deprecated ordering should be done after in java not on the db when all items are returns, use the findByDemographicId() instead.
 * @param archived can be null for both archived and non archived entries
 */
public List<Drug> findByDemographicIdOrderByDate(Integer demographicId, Boolean archived) {
	// build sql string
	String sqlCommand = "select x from Drug x where x.demographicId=?1 " + (archived == null ? "" : "and x.archived=?2") + " order by x.rxDate desc, x.id desc";

	// set parameters
	Query query = entityManager.createQuery(sqlCommand);
	query.setParameter(1, demographicId);
	if (archived != null) {
		query.setParameter(2, archived);
	}
	// run query
	@SuppressWarnings("unchecked")
	List<Drug> results = query.getResultList();

	return (results);
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:21,代码来源:DrugDao.java

示例10: findByDemographicIdOrderByPosition

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
/**
 * deprecated ordering should be done after in java not on the db when all items are returns, use the findByDemographicId() instead.
 * 
 * undeprecated Sorting on multiple fields in the java adds complexity unless special tools are used for sorting 
 */
public List<Drug> findByDemographicIdOrderByPosition(Integer demographicId, Boolean archived) {
	// build sql string
	String sqlCommand = "select x from Drug x where x.demographicId=?1 " + (archived == null ? "" : "and x.archived=?2") + " order by x.position desc, x.rxDate desc, x.id desc";

	// set parameters
	Query query = entityManager.createQuery(sqlCommand);
	query.setParameter(1, demographicId);
	if (archived != null) {
		query.setParameter(2, archived);
	}
	// run query
	@SuppressWarnings("unchecked")
	List<Drug> results = query.getResultList();

	return (results);
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:22,代码来源:DrugDao.java

示例11: findByDemographicIdSimilarDrugOrderByDate

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
public List<Drug> findByDemographicIdSimilarDrugOrderByDate(Integer demographicId, String regionalIdentifier, String customName) {
	// build sql string
	String sqlCommand = "select x from Drug x where x.demographicId=?1 and x." + (regionalIdentifier != null ? "regionalIdentifier" : "customName") + "=?2 order by x.rxDate desc, x.id desc";

	// set parameters
	Query query = entityManager.createQuery(sqlCommand);
	query.setParameter(1, demographicId);
	if (regionalIdentifier != null) {
		query.setParameter(2, regionalIdentifier);
	} else {
		query.setParameter(2, customName);
	}
	// run query
	@SuppressWarnings("unchecked")
	List<Drug> results = query.getResultList();

	return (results);
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:19,代码来源:DrugDao.java

示例12: populateDrug

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
private void populateDrug(VisitData visitData, Drug drug) {
	Medication medication = visitData.addNewMedication();

	if(drug.getBrandName() != null && !drug.getBrandName().isEmpty()) {
		medication.setMedicationName(drug.getBrandName());
	}
	
	if(medication.getMedicationName()==null || medication.getMedicationName().isEmpty()) {
		medication.setMedicationName(drug.getCustomName());
	}
	
	if(medication.getMedicationName()==null || medication.getMedicationName().isEmpty()) {
		medication.setMedicationName(drug.getGenericName());
	}
	
	if(medication.getMedicationName()==null || medication.getMedicationName().isEmpty()) {
		logger.warn("Could not find name for this drug! " + drug.getId());
	}
	
	if(drug.getRegionalIdentifier() != null && !drug.getRegionalIdentifier().isEmpty()) {
		try {
			medication.setMedicationDIN(drug.getRegionalIdentifier());
		} catch(NumberFormatException e) {
			logger.warn("regional identifier is not a number (id="+drug.getId()+")");
		}
	}
	
	if(drug.getRefillQuantity() != null) {
		medication.setMedicationNumberofRefills(drug.getRefillQuantity()+"");
	}
	/*
	medication.setMedicationDosage(arg0);
	medication.setMedicationDrugStrength(arg0);
	
	medication.setMedicationFrequency(arg0);
	*/
	medication.setMedicationStartDate(new XmlCalendar(dateFormatter.format(drug.getRxDate())));
	
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:40,代码来源:BORNWbCsdXmlGenerator.java

示例13: getPrescriptions

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
public List<Drug> getPrescriptions(String demographic_no, boolean all) {
	DrugDao drugDao = (DrugDao) SpringUtils.getBean("drugDao");

	if (all) {
		return (drugDao.findByDemographicIdOrderByPosition(new Integer(demographic_no), null));
	}
	return (drugDao.getUniquePrescriptions(demographic_no));
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:9,代码来源:CaseManagementManager.java

示例14: beforeClass

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
	dao = SpringUtils.getBean(DrugDao.class);
	drug = dao.findByDemographicId(Constants.Runtime.VALID_DEMOGRAPHIC).get(0);
	medicationsModel = new MedicationsModel(drug);

	nullDrug = new Drug();
	nullMedicationsModel = new MedicationsModel(nullDrug);
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:10,代码来源:MedicationsModelTest.java

示例15: getCustomPrescriptions

import org.oscarehr.common.model.Drug; //导入依赖的package包/类
/**
 * Only be used to get methadone or suboxone for custom rx modules 
 * @param demographciId
 * @param rxName
 * @return
 */
public List<Drug> getCustomPrescriptions(int demographciId, String rxName) {
	if (rxName == null || (!rxName.toLowerCase().contains("methadone") && !rxName.toLowerCase().contains("suboxone") 
			&& !rxName.toLowerCase().contains("buprenorphine"))) {
		return null;
	}
	DrugDao drugDao = (DrugDao) SpringUtils.getBean("drugDao");
	return drugDao.findCustomByDemographicIdOrderByPosition(demographciId, rxName);
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:15,代码来源:CaseManagementManager.java


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