Package beans.doctor.emc

Examples of beans.doctor.emc.Emc


        Polis polis = findEntity(Polis.class, itemChunk.polisID);
        Integer clientID = polis.getClient().getId();
        Field[] f = {new Field("client.id", clientID)};
        Iterator it = findEntityList(Emc.class, f).iterator();
        if (emcMap.get(clientID) == null) {//проверим в кеше
            Emc emc;
            if (it.hasNext()) {
                emc = (Emc) it.next();
            } else {
                throw new EDataIntegrity("у пациента " + polis.getClient().getSurname() + " " +
                        polis.getClient().getName() + " " + polis.getClient().getPathronymic() +
View Full Code Here


        }
        return null;
    }

    private ArrayList<AuditDetails> unionEMC(Client dst, Client src) throws ClipsServerException {
        Emc emc1 = null;
        Emc emc2 = null;
        List<Emc> emcL = findEntityList(Emc.class, "client.id", src.getId());
        if (!emcL.isEmpty()) {
            emc2 = emcL.get(0);
        }
        else {
            return null;
        }
        emcL = findEntityList(Emc.class, "client.id", dst.getId());
        if (emcL.isEmpty()) {
            AuditDoc<Emc> auditEmc = new AuditDoc<Emc>(emc2, getCollaborator());
            emc2.setClient(dst);
            saveEntity(emc2);
            System.out.println("    EMC2=" + emc2.getId() + "-->cl=" + emc2.getClient().getId());
            auditEmc.check(emc2);
            ArrayList<AuditDetails> target = new ArrayList<AuditDetails>(1);
            target.add(persistAudit(auditEmc));
            return target;
        } else {
            ArrayList<AuditDetails> target = new ArrayList<AuditDetails>();
            emc1 = emcL.get(0);
            AuditDoc<Emc> auditEmc = new AuditDoc<Emc>(emc1, getCollaborator());
            System.out.println("    EMC1 id=" + emc1.getId() + "  №" + emc1.getNumber() + "  |  EMC2 id=" + emc2.getId() + "  №" + emc2.getNumber());
            if (emc1.getNumber() == null || emc1.getNumber().isEmpty()) {
                emc1.setNumber(emc2.getNumber());
            }
            if (emc1.getAnamnez() == null || emc1.getAnamnez().isEmpty()) {
                emc1.setAnamnez(emc2.getAnamnez());
            }
            saveEntity(emc1);
            auditEmc.check(emc1);
            target.add(persistAudit(auditEmc));

            List<Disease> disL = findEntityList(Disease.class, "emc.id", emc2.getId());
            for (Disease d : disL) {
                AuditDoc<Disease> auditDisease = new AuditDoc<Disease>(d, getCollaborator());
                d.setEmc(emc1);
                saveEntity(d);
                System.out.println("        d.id=" + d.getId() + " d.emc.id" + d.getEmc().getId());
View Full Code Here

    }
   
    @Override
    protected void afterUpdate(Client entity, boolean isNewEntity,
            EntityDetails details, List<AuditDoc> auditDocList) throws ClipsServerException {
        Emc emc = null;
        if (UpdaterClientBean.emcMap != null) {
            emc = UpdaterClientBean.emcMap.get(entity.getId());
        } else {
            List<Emc> list = findEntityList(Emc.class, "client", entity);
            if (list.size() != 0) {
                emc = list.get(0);
            }
        }
        AuditDoc<Emc> auditDoc;
        if (emc == null) {
            auditDoc = new AuditDoc<Emc>(null, getCollaborator());
            emc = new Emc();
            emc.setClient(entity);
        } else {
            auditDoc = new AuditDoc<Emc>(emc, getCollaborator());
        }

        ClientDetails d = (ClientDetails)details;
        if (d.numberEmc != null && !d.numberEmc.isEmpty() && !d.noCheckEmcNum) {
            int entityCount = getEntityCount(Emc.class, new Field[]{new Field("number", d.numberEmc),
                                                                    new Field("client", entity, Field.OPERATOR_NOT_EQUAL)});
            if (entityCount > 0) {
                throw new ClipsServerException("Уже существует ЭМК с данным номером");
            }
        }
        emc.setNumber(d.numberEmc);
       
        saveEntity(emc);
        if (UpdaterClientBean.emcMap != null) {
            UpdaterClientBean.emcMap.put(entity.getId(), emc);
        }
View Full Code Here

   public static Emc getEmcByClient(EntityManager manager, Client client){
    Query    qery = manager.createQuery("select a from " + Emc.class.getSimpleName() + " a where a.client.id = :clientid");
    qery.setParameter("clientid", client.getId());
    @SuppressWarnings("unchecked")
        List<Emc> list = qery.getResultList();
        Emc emc;

        if (list.size() != 0) {
            emc = list.get(0);
        } else {
            emc = new Emc();
            emc.setClient(client);
            manager.persist(emc);
            manager.flush();
      manager.refresh(emc);
        }
    return emc;
View Full Code Here

                System.out.println("End Loading EmcList");
                @SuppressWarnings("unchecked")
                List<Object[]> list = query.getResultList();
                for (Object[] line: list) {
                    Integer clientID = (Integer) line[0];
                    Emc emc = (Emc) line[1];
                    emcMap.put(clientID, emc);
                }
                System.out.println("End Mapping EmcList");
            }
            if (mapClient == null) {
View Full Code Here

TOP

Related Classes of beans.doctor.emc.Emc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.