Examples of EDataIntegrity


Examples of framework.generic.EDataIntegrity

    }

    @Override
    protected void onRemove(ProfcheckupItem entity, List<AuditDoc> audit) throws ClipsServerException {
        if (entity.getResults() != null){
            throw new EDataIntegrity("Нельзя удалить профосмотр с установленным результатом");
        }
    }
View Full Code Here

Examples of framework.generic.EDataIntegrity

        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);
        }
View Full Code Here

Examples of framework.generic.EDataIntegrity

    @Override
    public int setMedSerrenResult(MedSerrenResultDetails details) throws ClipsServerException {
        MedSerrenResult entity = findEntity(MedSerrenResult.class, details.id);
        //Проверка полей - ничо менять нельзя
        if (entity.getSerren().getId() != details.serrenID) {
            throw new EDataIntegrity("Попытка подмены результатов медосмотра");
        }
        //Проверка безопасности - выставлять результаты может только оказавший услугу, либо суперюзер
        if (entity.getSerren().getFunctions() == null
                || entity.getSerren().getFunctions().getCollaborator().getId() != getCollaboratorId()) {
            throwNeedAdminSecurityException("Выставить результат может только сотрудник, оказавший услугу");
View Full Code Here

Examples of framework.generic.EDataIntegrity

        ExpenditureDefault exp = null;
       
        if(details.id != 0) {
            exp = findEntity(ExpenditureDefault.class, details.id);
            if(details.parentID != exp.getService().getId()) {
                throw new EDataIntegrity("Подмена услуги запрещена");
            }
        } else {
            exp = new ExpenditureDefault();
            exp.setService(findEntity(Service.class, details.parentID));
        }       
View Full Code Here

Examples of framework.generic.EDataIntegrity

    @Override
    public ModificationInfo addFunctions(CollaboratorFunctionsDetails cfd) throws ClipsServerException {
        Collaborator collaborator = getExistentEntity();
        if (collaborator.getId() != cfd.collaboratorID){
            throw new EDataIntegrity("Попытка добавить исполняемые обязанности другому сотруднику");
        }
        int count = getEntityCount(CollaboratorFunctions.class,
                            new Field[]{new Field("collaborator", collaborator),
                                        new Field("dvr.id", cfd.dvrID),
                                        new Field("firstMedicalAid.id", cfd.firstMedicalAidID),
                                        new Field("receptionType.id", cfd.receptionTypeID),
                                        new Field("speciality.id", cfd.specialityID),
                                        new Field("trash", false)});
        if (count > 0){
            throw new EDataIntegrity("У данного сотрудника уже есть исполняемые обязанности с указанными параметрами");
        }
        CollaboratorFunctions functions;
        if (cfd.id == 0){
             functions = new CollaboratorFunctions(collaborator,
                                    cfd.dvrID != 0 ? findEntity(Dvr.class, cfd.dvrID) : null,
                                    cfd.firstMedicalAidID != 0 ? findEntity(MedicalAidType.class, cfd.firstMedicalAidID) : null,
                                    findEntity(ReceptionType.class, cfd.receptionTypeID),
                                    findEntity(Speciality.class, cfd.specialityID),
                                    cfd.external_key);

             collaborator.addFunction(functions);
        }else{
            throw new EDataIntegrity("Данные не могут быть изменены");
        }
       
        manager.flush();
        AuditDoc<CollaboratorFunctions> auditDoc = new AuditDoc<CollaboratorFunctions>(null, getCollaborator());
        auditDoc.check(functions);
View Full Code Here

Examples of framework.generic.EDataIntegrity

    public ModificationInfo removeFunctions(CollaboratorFunctionsDetails item) throws ClipsServerException {
        int count = getEntityCount(CollaboratorFunctions.class,
                                    new Field[]{new Field("collaborator", getExistentEntity()),
                                                new Field("trash", false)});
        if (count <= 1){
            throw new EDataIntegrity("У сотрудника должна быть хотя бы одна исполняемая обязанность");
        }
        CollaboratorFunctions functions = findEntity(CollaboratorFunctions.class, item.id);
        AuditDoc<CollaboratorFunctions> auditDoc = new AuditDoc<CollaboratorFunctions>(functions, getCollaborator());
        functions.setTrash(true);
        manager.merge(functions);
View Full Code Here

Examples of framework.generic.EDataIntegrity

            throws ClipsServerException {
        FollowupDetails d = (FollowupDetails) details;
        ServiceRender serviceRender = findEntity(ServiceRender.class, d.serrenUpID);
        Diagnosis diagnosis = findEntity(Diagnosis.class, d.diagnosisUpID);
        if (diagnosis.getServiceRender().getDisease().getId() != serviceRender.getDisease().getId()){
            throw new EDataIntegrity("Услуга, по которой пациент поставлен на учёт, " +
                    "и услуга, в рамках которой поставлен диагноз, должны находиться в одном заболевании");
        }
       
        entity.setDateup(d.dateUp);
        entity.setDatedown(d.dateDown);
View Full Code Here

Examples of framework.generic.EDataIntegrity

        List<FollowupEvent> events = findEntityList(FollowupEvent.class, fields);
        for (FollowupEvent event : events) {
            AuditDoc<FollowupEvent> auditFEvent = new AuditDoc<FollowupEvent>(event, getCollaborator());
            auditDocList.add(auditFEvent);
            if (event.getDisease() != null) {
                throw new EDataIntegrity("Невозможно удалить запись о диспансерном наблюдении, в котором есть отмеченные посещения");
            }
            else {
                removeEntity(event);
                auditFEvent.check(null);
            }
View Full Code Here

Examples of framework.generic.EDataIntegrity

            AuditDoc auditDoc, List<AuditDoc> auditDocList) throws ClipsServerException{
        // TODO - Можно редактировать! Но надо додумать
//        throw new EDataIntegrity("Прямое редактирование профосмотров запрещено");
        ProfcheckupDetails d = (ProfcheckupDetails) details;
        if (d.dateFrom.after(d.dateTill)){
            throw new EDataIntegrity("Время окончания профосмотра не может быть меньше времени его начала");
        }

        entity.setDatefrom(d.dateFrom);
        entity.setDatetill(d.dateTill);
        entity.setDescription(d.description);
View Full Code Here

Examples of framework.generic.EDataIntegrity

        checkCommandAccessibility(COMMAND_MODIFY);
        Job entity = getExistentEntity();
       
        int jobId = entity.getId();
        if (details.jobId != 0 && jobId != details.jobId){
            throw new EDataIntegrity("Запрещено подменять работу опасному фактору! job(entity): "+jobId + " job(details): " +  details.jobId);
        }
        Field f[] = {
            new Field("key.job", jobId),
            new Field("key.danger", details.dangerId)
        };
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.