Package beans.contract.entity

Examples of beans.contract.entity.Contract


                + "AND ((a.end IS NULL) OR (a.end > :current))");
        q.setParameter("ctype", Contract.TYPE_OMI);
        q.setParameter("current", GregorianCalendar.getInstance().getTime());
        List list = q.getResultList();

        Contract contract;
        if (list.size() == 0) {
            throw new ClipsServerException("Не найдено ни одного действующего договора ОМС");
        } else if (list.size() > 1) {
            throw new ClipsServerException("Найдено " + list.size() + " полисов в действующем договоре ОМС");
        } else {
View Full Code Here


        if (contractList.size() == 0) {
            return true;
        }
        String s = "";
        for (int i = 0; i < contractList.size(); i++) {
            Contract contract = (Contract) contractList.get(i);
            if (contract.isWorking()) {
                s += contract.getIndex() + "\n";
            }
        }
        if (!s.isEmpty()) {
            throw new EDataIntegrity("Данная услуга отсутствует в следующих договорах :\n" + s);
        }
View Full Code Here

            q.setParameter("current", GregorianCalendar.getInstance().getTime());
        List list = q.getResultList();
        List<ContractDetails> res = new ArrayList<ContractDetails>();
        Iterator i = list.iterator();
        while(i.hasNext()) {
            Contract j = (Contract) i.next();
            res.add(j.getDetails(this));
        }
        return res;
    }
View Full Code Here

            q.setParameter("current", GregorianCalendar.getInstance().getTime());
        List list = q.getResultList();
        List<ContractDetails> res = new ArrayList<ContractDetails>();
        Iterator i = list.iterator();
        while(i.hasNext()) {
            Contract j = (Contract) i.next();
            res.add(j.getDetails(this));
        }
        return res;
    }
View Full Code Here

       
        Disease disease = findEntity(Disease.class, chunk.diseaseID);
        //Создаем полис если его нет
        Pair<Polis, AuditDetails> pair = getPolis(chunk.polisDetails);
        Polis polis = pair.first;
        Contract contract = polis.getContract();
        if (pair.second != null) {
            auditDetList.add(pair.second);
        }
        Collaborator collaborator = findEntity(Collaborator.class, getCollaboratorId());
        if (contract.getLpu() != null && contract.getLpu().getId() != collaborator.getLpu().getId()) {
            throw new EDataIntegrity("Указанный контракт не заключен с данной клиникой");
        }

        for (int i = 0; i < chunk.serviceList.size(); i++) {
           
View Full Code Here

        if (packetServiceTemplateID != 0) {
            PacketTemplate packetTemplate = findEntity(PacketTemplate.class, packetServiceTemplateID);
            List<ContractPacket> contractPachetList = findEntityList(ContractPacket.class, "packetServiceTemplate", packetTemplate);
            contractSet = new HashSet<Contract>();
            for (int i = 0; i < contractPachetList.size(); i++) {
                Contract contract = (contractPachetList.get(i)).getContract();
                contractSet.add(contract);
            }
        }
        Collaborator collab = findEntity(Collaborator.class, getCollaboratorId());
        Lpu lpu = collab.getLpu();

        //Поиск действующих полисов для пациента
        Client client = findEntity(Client.class, clientID);
        String sql = "SELECT a FROM Polis a" + " WHERE a.client=:client" +
                " AND (a.fromDate <= :current OR a.fromDate IS NULL)" +
                " AND (a.tillDate >= :current OR a.tillDate IS NULL)" +
                " AND (a.trash = false)" +
                " AND (a.contract.begin<=:current)" +
                " AND (a.contract.end>=:current OR a.contract.end IS NULL) " +
                " AND ((a.contract.lpu is null) or (a.contract.lpu = :lpu))";
        Query query = manager.createQuery(sql);
        query.setParameter("client", client);
        query.setParameter("current", new Date());
        query.setParameter("lpu", lpu);
        //Найденные действующие полиса для пациента, которые находятся в контракте
        List<Polis> existPolisList = query.getResultList();

        String sql1 = "SELECT c FROM Contract c WHERE" +
                " c.begin<=:current" +
                " AND (c.end>=:current OR c.end IS NULL)" +
                " AND c.openForAll = true";
        Query query1 = manager.createQuery(sql1);
        query1.setParameter("current", new Date());
        /**Список контрактов, открытых для всех*/
        List<Contract> cList = query1.getResultList();
        //Виртуальные полиса, которые можно создать
        ArrayList<Polis> virtualPolisList = new ArrayList<Polis>(cList.size());
        for (Contract contract : cList) {
            Polis polis = new Polis();
            polis.setClient(client);
            polis.setContract(contract);
            virtualPolisList.add(polis);
        }

        List<ServiceContractPriceChunk> chunkList = new ArrayList<ServiceContractPriceChunk>();
        //Складываем виртуальные и существующие полиса в один массив
        for (int i = 0; i < virtualPolisList.size(); i++) {
            Polis virtPolis = virtualPolisList.get(i);
            boolean founded = false;
            for (Polis existPolis : existPolisList) {
                if (existPolis.getContract().getId() == virtPolis.getContract().getId()) {
                    founded = true;
                    break;
                }
            }
            if (!founded) {
                existPolisList.add(virtPolis);
            }
        }

        for (Polis polis : existPolisList) {
            ServiceContractPriceChunk chunk = new ServiceContractPriceChunk();

            Contract contract = polis.getContract();
            if (contractSet != null && !contractSet.contains(contract)) {
                //Если данный договор не содержит данного пакета услуг
                continue;
            }
            chunk.polisDetails = polis.getDetails((RightChecker) this);
            ContractDetails contractDetails = contract.getDetails((RightChecker) this);
            chunk.enterpriseID = contractDetails.enterpriseID;
            chunk.index = contractDetails.index;
            chunk.contractType = Contract.TYPES_ARRAY[contractDetails.type].str;

            if (services.size() > 0) {
View Full Code Here

    }

    @Override
    public SerrenMod createNewSerren(ServiceRenderDetails serrenDetails) throws ClipsServerException {
        AuditDoc<ServiceRender> auditDoc = new AuditDoc<ServiceRender>(null, getCollaborator());
        Contract contract = findEntity(Polis.class, serrenDetails.polisID).getContract();
        Collaborator collaborator = findEntity(Collaborator.class, getCollaboratorId());
        if (contract.getLpu() != null && contract.getLpu().getId() != collaborator.getLpu().getId()) {
            throw new EDataIntegrity("Указанный контракт не заключен с данной клиникой");
        }
        ServiceRender serren = new ServiceRender();
        //date;           //дата назначения услуги - если нет права создавать другим числом то только сегодняшняя дата
        if (DateTimeUtils.belongsToCurrentDay(serrenDetails.date)
View Full Code Here

TOP

Related Classes of beans.contract.entity.Contract

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.