Package beans.profcheckup.entity

Examples of beans.profcheckup.entity.ProfcheckupItem


     * @return договор
     */
    @Override
    public PolisDetails getPolis() throws ClipsServerException {
        checkCommandAccessibility(COMMAND_READ_CONTRACT_MEMBER);
        ProfcheckupItem entity = getExistentEntity();
        return entity.getPolis().getDetails((RightChecker) this);
    }
View Full Code Here


   
   
    @Override
    public ModificationInfo remove() throws ClipsServerException {
        ProfcheckupItem entity = getExistentEntity();//Не трогать! Финт ушами!
        super.remove();//первую и вторую строки местами не менять иначе хер удалишь!
//        DiseaseBeanRemote sbr = (DiseaseBeanRemote)
//                getBean(DiseaseBeanRemote.class.getName());
        Iterator it = findEntityList(ProfcheckupItem.class, "disease", entity.getDisease()).iterator();

        //другие итемы ссылающиеся на заболевание
        int overItemsCount = 0;

        //услуги других итемов
        Set<Integer> notDelete = new HashSet<Integer>();
        Set<Integer> overDangers = new HashSet<Integer>();


        while (it.hasNext()) {
            ProfcheckupItem pi = (ProfcheckupItem)it.next();
            if (pi.getId() != entity.getId()){
                overItemsCount++;
                overDangers.add(pi.getDanger().getId());
            }
        }

        if (overDangers != null && !overDangers.isEmpty()){
            Iterator list = findEntityList(DangerService.class, new Field[]{new Field("danger.id", overDangers, Field.OPERATOR_IN)}).iterator();
View Full Code Here

    @Override
    public TransportData createItem(ProfcheckupItemChunk itemChunk) throws ClipsServerException {
        /**кеш эмк ид клиента - эмк*/
        Map<Integer, Emc> emcMap = new HashMap<Integer, Emc>();
        //создадим и заполним итемы
        ProfcheckupItem pchItem = new ProfcheckupItem();//сюда приходят только новые итемы
        Disease disease = null;
        Field[] fs = new Field[]{
            new Field("polis.id", itemChunk.polisID),
            new Field("profcheckup.id", itemChunk.profcheckupId)       
        };
        List list = findEntityList(ProfcheckupItem.class, fs);
        if (list != null && !list.isEmpty()) {//если в профчекапе уже есть итемы
            disease = ((ProfcheckupItem) list.get(0)).getDisease();
            //Вполне возможно наличие в заболевании услуг, нет необходимости их назначать заново
            //поэтому выбросим их из списка необходимых услуг
            //и хер с ней оказана она или нет
            Field[] f = new Field[]{new Field("disease", disease)};
            Iterator iterator = findEntityList(ServiceRender.class, f).iterator();
            while (iterator.hasNext()) {
                ServiceRender sr = (ServiceRender)iterator.next();
                Iterator<ServiceCheckupChunk> servIter = itemChunk.serviceList.iterator();
                while (servIter.hasNext()) {
                    ServiceCheckupChunk chunk = servIter.next();
                    if (chunk.serviceID == sr.getService().getId()){
                        servIter.remove();//выкидываем услугу
                    }
                }
            }
        } else {
//            pchItem = new ProfcheckupItem();
            disease = new Disease();//сделаем заболевание
            Date current = new Date();
            disease.setCreated(current);//дата по первому созданию
            disease.setDateReg(current);
        }

        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() +
                        " нет медицинской карты");
            }
            emcMap.put(clientID, emc);
        }
        disease.setEmc(emcMap.get(clientID));
        disease.setCollaborator(findEntity(Collaborator.class, getCollaboratorId()));
        if (disease.getId() == 0) {
            manager.persist(disease);//теперь есть заболевание, мона его юзать(или нет?)
        } else {
            disease = manager.merge(disease);
        }
        manager.flush();
        manager.refresh(disease);

        //заполним профчекапитем
        pchItem.setPolis(polis);
        pchItem.setPassed(false);
        pchItem.setDanger(findEntity(Danger.class, itemChunk.dangerId));
        pchItem.setProfcheckup(findEntity(Profcheckup.class, itemChunk.profcheckupId));
        pchItem.setDisease(disease);
        manager.persist(pchItem);//теперь есть профчекапитем, мона его юзать
        manager.flush();
        manager.refresh(pchItem);
        //Пометим список услуг что они с дангерами
        for (int i = 0; i < itemChunk.serviceList.size(); i++) {
            ServiceCheckupChunk scc = itemChunk.serviceList.get(i);
            scc.dangerID = itemChunk.dangerId;
        }
        //создадим услугу
        NewServicesChunk chunk = new NewServicesChunk(disease.getId(),
                                                0,
                                                polis.getDetails(this),
                                                0,
                                                itemChunk.serviceList,
                                                new HashMap<Integer, Integer>());
        csbl.setSession(getSessionId());
        List<AuditDetails> auditDetailsList = csbl.createNewServices(chunk).getAudit();
        for (AuditDetails ad : auditDetailsList) {
            if (!ad.entityClass.equals(ServiceRender.class.getSimpleName())) {
                continue;
            }
            ServiceRender render = findEntity(ServiceRender.class, ad.getEntityId);
            if (render.getService().getCheckupType() == null){
                MedSerrenResult result = new MedSerrenResult();
                result.setSerren(render);
                manager.persist(result);
            }
        }
        return new TransportData(pchItem.getDetails(this), auditDetailsList);
    }
View Full Code Here

        Query query = manager.createQuery(sql);
//        query.setParameter("pcid", pd.id);
        query.setParameter("diseaseID", diseaseDetails.id);
        Iterator iterator = query.getResultList().iterator();
        while (iterator.hasNext()) {
            ProfcheckupItem pi = (ProfcheckupItem) iterator.next();
            res.add(pi.getDetails(this));
        }
        return res;
    }
View Full Code Here

        ProfcheckupItemBeanRemote pibr = getBean(ProfcheckupItemBean.class);
//        ProfcheckupItemBeanRemote pibr = getBean(ProfcheckupItemBeanRemote.class, getSessionId());
        List contracts = findEntityList(ProfcheckupItem.class, "profcheckup", entity);
        Iterator i = contracts.iterator();
        while(i.hasNext()) {
            ProfcheckupItem j = (ProfcheckupItem) i.next();
            pibr.initByID(j.getId(), getSessionId());
            pibr.remove();
        }
//        throw new EDataIntegrity("Прямое редактирование профосмотров запрещено");
    }
View Full Code Here

       
        List contracts = findEntityList(ProfcheckupItem.class, "profcheckup", entity);
        List<ProfcheckupItemDetails> res = new ArrayList<ProfcheckupItemDetails>();
        Iterator i = contracts.iterator();
        while(i.hasNext()) {
            ProfcheckupItem j = (ProfcheckupItem) i.next();
            res.add(j.getDetails((RightChecker) this));
        }
        return res; 
    }
View Full Code Here

                            serviceRender.setPolis(main);
                            saveEntity(serviceRender);
                        }
                        List<ProfcheckupItem> profCheckupList = findEntityList(ProfcheckupItem.class, "polis.id", polisID);
                        for (int i = 0; i < profCheckupList.size(); i++) {
                            ProfcheckupItem profcheckupItem = profCheckupList.get(i);
                            profcheckupItem.setPolis(main);
                            saveEntity(profcheckupItem);
                        }
                        Address address = polis.getAddress();
                        if (address != null) {
                            removeEntity(address);
View Full Code Here

    private void replaceProfcheckupResults(DirectoryEntity entityWhat, DirectoryEntity entityWith) {
        //ProfcheckupItem
        List entityList = findEntityList(ProfcheckupItem.class, "results", entityWhat);
        for (int i = 0; i < entityList.size(); i++) {
            ProfcheckupItem profcheckupItem = (ProfcheckupItem) entityList.get(i);
            profcheckupItem.setResults((ProfChekupResult) entityWith);
            manager.merge(profcheckupItem);
        }
        removeEntity(entityWhat);
        manager.flush();
    }
View Full Code Here

TOP

Related Classes of beans.profcheckup.entity.ProfcheckupItem

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.