Examples of EDataIntegrity


Examples of framework.generic.EDataIntegrity

            entity.setDuration(details.workDuration);
            entity.setServiceDuration(details.defaultServiceDuration);
            entity.setWorkType(details.typeID == 0 ? null : findEntity(WorkType.class, details.typeID));
            entity.setCabinet(details.cabinetID == 0 ? null : findEntity(Cabinet.class, details.cabinetID));
      if (entity.getCabinet() != null && entity.getCabinet().getLpu().getId() != entity.getCollaborator().getLpu().getId()){
        throw new EDataIntegrity("Сотрудник и кабинет находятся в разных клиниках");
      }
            entity.setDescription(details.description);
           
            manager.merge(entity);
            return details.id;
        } else {
            if(!isPlanned(details.begin)) {
                checkIsNotInThePast(details.begin);
            }
           
            SheduleIndividualWork entity = new SheduleIndividualWork();

            entity.setTimeBegin(details.begin);
            entity.setDuration(details.workDuration);
            entity.setServiceDuration(details.defaultServiceDuration);
            entity.setWorkType(details.typeID == 0 ? null : findEntity(WorkType.class, details.typeID));
            entity.setCabinet(details.cabinetID == 0 ? null : findEntity(Cabinet.class, details.cabinetID));
            entity.setCollaborator(findEntity(Collaborator.class, details.collID));
      if (entity.getCabinet() != null && entity.getCabinet().getLpu().getId() != entity.getCollaborator().getLpu().getId()){
        throw new EDataIntegrity("Сотрудник и кабинет находятся в разных клиниках");
      }
            entity.setDescription(details.description);
            
            manager.persist(entity);
            manager.flush();
View Full Code Here

Examples of framework.generic.EDataIntegrity

    private Client checkNotSelf(int mother) throws ClipsServerException {
        Client m = findEntity(Client.class, mother);
    if (getId() != 0){
      Client entity = getExistentEntity();
      if (m.getId() == entity.getId()) {
        throw new EDataIntegrity("Нельзя указать в качестве родителей " +
                        "или представителя пациента его самого");
      }
    }
        return m;
    }
View Full Code Here

Examples of framework.generic.EDataIntegrity

        if (isSuperUser()) {
            return;
        }
        if (serviceRender.getDisease().getClosed() != null
                && !DateTimeUtils.belongsToCurrentDay(serviceRender.getDisease().getClosed())) {
            throw new EDataIntegrity("Запрещено изменять медицинские данные, находящиеся в закрытом заболевании");
        }
        if (entity.getId() == 0) {
            checkCommandAccessibility(COMMAND_CREATE);
        } else {
            checkCommandAccessibility(COMMAND_MODIFY);
View Full Code Here

Examples of framework.generic.EDataIntegrity

        if (isSuperUser()) {
            return;
        }
        if (serviceRender.getDisease().getClosed() != null
                && !DateTimeUtils.belongsToCurrentDay(serviceRender.getDisease().getClosed())) {
            throw new EDataIntegrity("Запрещено удалять медицинские данные, находящиеся в закрытом заболевании");
        }
        checkCommandAccessibility(COMMAND_REMOVE);
    }
View Full Code Here

Examples of framework.generic.EDataIntegrity

        Field f2[] = { new Field("direction.committee", entity) };
       
        if(getEntityCount(CommitteeMember.class, f) > 0
                || getEntityCount(CommitteeDirection.class, f) > 0
                || getEntityCount(CommitteeResolution.class, f2) > 0) {
            throw new EDataIntegrity("Сначала удалите всех членов комиссии, все решения и направления "
                    + "на МСЭК, сделанные в рамках данной комиссии");
        }
    }
View Full Code Here

Examples of framework.generic.EDataIntegrity

            saveEntity(packetService);
            MedexamType medexamType = packetTemplate.getMedexamType();
            if (medexamType != null) {
                //не просто пакет, а медосмотр
                if (chunk.diseaseID != 0) {
                    throw new EDataIntegrity("Для медосмотра необходимо создать новое заболевание");
                }
                //создаем заболевание и медосмотр
                disease = new Disease();
                List<Emc> emcList = findEntityList(Emc.class, "client", polis.getClient());
                if (emcList.size() != 1) {
                    throw new EDataIntegrity("У пациента " + emcList.size() + " ЕМК");
                }
                disease.setEmc(emcList.get(0));
                Date current = new Date();
                disease.setCreated(current);
                disease.setDateReg(current);
                disease.setCollaborator(collaborator);
                manager.persist(disease);
                manager.flush();
                manager.refresh(disease);
                chunk.diseaseID = disease.getId();

                medexam = new Medexam();
                medexam.setDisease(disease);
                medexam.setMedexamType(medexamType);
                manager.persist(medexam);
            }
        }
        uniqMap = new HashMap<Integer, Set<Integer>>();
        for (int i = 0; i < chunk.serviceList.size(); i++) {
            ServiceCheckupChunk serviceCheckupChunk = chunk.serviceList.get(i);

            //Всё, собираем детали
            ServiceRenderDetails serrenDetails = new ServiceRenderDetails();
            Integer effectiveDiscount = chunk.forceDiscountMap.get(serviceCheckupChunk.serviceID);
            if (effectiveDiscount == null) {
                effectiveDiscount = cardDiscounts.get(serviceCheckupChunk.serviceID);
            }
            if (effectiveDiscount == null) {
                effectiveDiscount = new Integer(0);
            }

            /**
             * Костыль
             * По опасному фактору сюда приходят несколько чанков, в которых проставлен
             * ID одной и той же услуги (конкретно - посещение Профилактическое первичное амбулаторное),
             * для которой в таблице DangerService существует несколько записей с разными специальностями врачей
             * Проще говоря это услуги одного типа, а обслужить должны несколько специалистов
             * т.к в чанке нет информации о специальности приходится хитрым образом обеспечивать для
             * каждой услуги уникальную специальность
             */

            //Если по опасному фактору - то присутствует специальность врача
            int specID = 0;
            if (serviceCheckupChunk.dangerID != 0) {
                Field f[] = {
                    new Field("danger.id", serviceCheckupChunk.dangerID),
                    new Field("service.id", serviceCheckupChunk.serviceID),
                };
                List<DangerService> list = findEntityList(DangerService.class, f);
                if (list.size() == 0) {
                    throw new EDataIntegrity("В приказе 90 для вредного фактора не найдена услуга");
                } else if (list.size() == 1) {
                    Speciality spec = list.get(0).getSpeciality();
                    specID = spec == null ? 0 : spec.getId();
                } else {
                    specID = findUniqSpec(serviceCheckupChunk.serviceID, list);
View Full Code Here

Examples of framework.generic.EDataIntegrity

        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++) {
           
            ServiceCheckupChunk serviceCheckupChunk = chunk.serviceList.get(i);
            Service s = findEntity(Service.class, serviceCheckupChunk.serviceID);
            ServiceRender referedSerren = findEntity(ServiceRender.class, referedSerrenID);

            AuditDoc<ServiceRender> auditSerren = new AuditDoc<ServiceRender>(null, getCollaborator());
            ServiceRender entity = new ServiceRender();
            entity.setService(s);
            entity.setDate(new Date());
            entity.setDisease(disease);
            entity.setDirector(collaborator);
            entity.setPolis(polis);
            entity.setReferenced(referedSerren);
            entity.setUet(ServiceRender.DEFAULT_UET);
            if (entity.getPolis().getClient().getId() != disease.getEmc().getClient().getId()) {
                throw new EDataIntegrity("Ошибка в коде назначения услуги - полис не соответствует ЭМК");
            }
           
            manager.persist(entity);

            if (serviceCheckupChunk.xml != null) {
View Full Code Here

Examples of framework.generic.EDataIntegrity

    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)
                || hasRight(UserRightsSet.WRITE_STATISTIC_MEDICAL_DATA)) {
            serren.setDate(serrenDetails.date);
        } else {
            throw new ESecurity(SecurityChecker.getClientHasNoRightMsg(UserRightsSet.WRITE_STATISTIC_MEDICAL_DATA.id));
        }

        //renderDate;     //дата оказания - нулл
        if (serrenDetails.renderDate != null) {
            throw new ClipsServerException("Нельзя создавать оказанную услугу");
        } else {
            serren.setRenderedDate(null);
        }

        //discount;        //Скидка в процентах - пофиг, проверка не здесь
        serren.setDiscount(serrenDetails.discount);

        //cancelled;   //флаг отменена - false
        if (serrenDetails.cancelled == true) {
            throw new ClipsServerException("Нельзя создавать отмененную услугу");
        } else {
            serren.setCancelled(serrenDetails.cancelled);
        }

        //repeat;          //повторы услуги - 0
        if (serrenDetails.repeat != 0) {
            throw new ClipsServerException("Нельзя создавать услугу, оказанную повторно");
        } else {
            serren.setRepeat(serrenDetails.repeat);
        }

        //polisID;         // - != 0
        Polis polis;
        if (serrenDetails.polisID == 0) {
            throw new ClipsServerException("Нельзя создавать услугу без указания полиса");
        } else {
            polis = findEntity(Polis.class, serrenDetails.polisID);
            serren.setPolis(polis);
        }

        //collaboratorID;  // - 0
        if (serrenDetails.functionsID != 0) {
            throw new ClipsServerException("Нельзя создавать оказанную услугу");
        } else {
            serren.setFunctions(null);
        }

        //directorID;      // - если нет права создавать от другого имени, то только текущий сотрудник
        if (getCollaboratorId() == serrenDetails.directorID
                || hasRight(UserRightsSet.WRITE_STATISTIC_MEDICAL_DATA)) {
            Collaborator director = findEntity(Collaborator.class, serrenDetails.directorID);
            serren.setDirector(director);
        } else {
            throw new ESecurity(SecurityChecker.getClientHasNoRightMsg(UserRightsSet.WRITE_STATISTIC_MEDICAL_DATA.id));
        }

        //packetServiceID; // - пофиг
        if (serrenDetails.packetServiceID == 0) {
            serren.setPacketService(null);
        } else {
            serren.setPacketService(findEntity(PacketService.class, serrenDetails.packetServiceID));
        }

        //diseaseID;       // - пока пофиг TODO проверка соответствия пациента по полису и ЭМК
        if (serrenDetails.diseaseID == 0) {
            serren.setDisease(null);
        } else {
            Disease disease = findEntity(Disease.class, serrenDetails.diseaseID);
            if (serren.getPolis().getClient().getId() != disease.getEmc().getClient().getId()) {
                throw new EDataIntegrity("Ошибка в коде назначения услуги - полис не соответствует ЕМК");
            }
            serren.setDisease(disease);
        }

        //cardID;          // - пока пофиг TODO проверка соответствия пациента по карте и ЭМК
View Full Code Here

Examples of framework.generic.EDataIntegrity

            if (!set.contains(specID)) {
                set.add(specID);
                return specID;
            }
        }
        throw new EDataIntegrity("Внутреняя ошибка в реализации профосмотров");
    }
View Full Code Here

Examples of framework.generic.EDataIntegrity

    }

    @Override
    protected void onRemove(DloDrugSection entity) throws ClipsServerException {
        //чтоб не удалялся. а кидался в трэш
        throw new EDataIntegrity();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.