Examples of CollaboratorFunctions


Examples of beans.user.collaborator.entities.CollaboratorFunctions

                                        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);
        return new ModificationInfo(functions.getId(), persistAudit(auditDoc));
    }
View Full Code Here

Examples of beans.user.collaborator.entities.CollaboratorFunctions

                                    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);
        manager.flush();
        auditDoc.check(functions);
        return new ModificationInfo(persistAudit(auditDoc));
    }
View Full Code Here

Examples of beans.user.collaborator.entities.CollaboratorFunctions

        //serviceID;       // услуга - проверка наличия в договоре (учитывая референсед)
        //functionsID      //Проверить есть ли услуга с данным типом услуги в договоре
        //делается одновременно чтоб не делать 2 запроса
        String sql;
        CollaboratorFunctions functions = null;
        ReceptionType receptionType = null;
        if (serrenDetails.referencedID == 0) {
            if (serrenDetails.functionsID == 0) {
                sql = "SELECT count(a) FROM ServicePrice a WHERE " +
                        "a.contract=:contract " +
                        "AND a.service=:service ";
            } else {
                functions = findEntity(CollaboratorFunctions.class, serrenDetails.functionsID);
                receptionType = functions.getReceptionType();
                sql = "SELECT count(a) FROM ServicePrice a WHERE " +
                        "a.contract=:contract " +
                        "AND a.service=:service " +
                        "AND (a.receptionType IS NULL OR a.receptionType=:receptionType)";
            }
View Full Code Here

Examples of beans.user.collaborator.entities.CollaboratorFunctions

        ServiceRenderDetails d = (ServiceRenderDetails) details;

        entity.setDate(d.date);

        CollaboratorFunctions cf = d.functionsID == 0 ? null : findEntity(CollaboratorFunctions.class, d.functionsID);
        //особо заебатые случаи проверки вынесены сюды
        if (!entity.isRendered()) {//услуга не оказана
            //услуга не оказана
            if (d.functionsID != 0
                    && findEntity(CollaboratorFunctions.class, d.functionsID).getCollaborator().getId() != getCollaboratorId()
                    && !hasRight(UserRightsSet.WRITE_STATISTIC_MEDICAL_DATA)) {
                throwNeedAdminSecurityException("У вас недостаточно прав, чтоб оказать услугу от имени другого пользователя");
            }
            if (d.functionsID != 0 && d.servPlaceID == 0) {
                throw new EDataIntegrity("При оказании услуги необходимо указывать место обслуживания");
            }
            if (d.functionsID != 0
                    && !DateTimeUtils.belongsToCurrentDay(d.renderDate)
                    && !hasRight(UserRightsSet.WRITE_STATISTIC_MEDICAL_DATA)) {
                throwNeedAdminSecurityException("У вас недостаточно прав, чтоб оказать услугу другой датой");
            }
            entity.setRenderedDate(d.functionsID == 0 ? null : d.renderDate);

            //Если в услуге указана специальность врача, которым должна быть оказана услуга,
            //то cf должен соответствовать
            if (entity.getSpeciality() != null) {
                if (entity.getSpeciality().getId() != cf.getSpeciality().getId()) {
                    throw new EDataIntegrity();
                }
            }
            entity.setFunctions(cf);
            if (d.functionsID != 0) {
                //при оказании услуги анализ убираем ее из расписания анализов
                Field fields[] = {
                    new Field("serviceRender", entity),
                };       
                List<Checkup> list = findEntityList(Checkup.class, fields);
                for (int i = 0; i < list.size(); i++) {
                    Checkup checkup = list.get(i);
                    checkup.setCheckupShedule(null);
                    manager.merge(checkup);
                }
            }
        }
    else {//услуга оказана
            if (d.renderDate == null && d.functionsID != 0) {//отмена оказания
                throwNeedAdminSecurityException("У вас недостаточно прав, чтоб отметить услугу как неоказанную");
                entity.setRenderedDate(null);
                entity.setFunctions(null);
            } else if (!entity.getRenderedDate().equals(d.renderDate)) {
                throwNeedAdminSecurityException("У вас недостаточно прав для смены даты оказания услуги");
                entity.setRenderedDate(d.renderDate);
            } else if (entity.getFunctions() != null && entity.getFunctions().getId() != d.functionsID) {
                throwNeedAdminSecurityException("У вас недостаточно прав для смены сотрудника, оказавшего услугу");
                entity.setFunctions(d.functionsID == 0 ? null : findEntity(CollaboratorFunctions.class, d.functionsID));
            }
        }

        if (d.uet == 0) {
            throw new ClipsServerException("Не указана условная единица трудоемкости\n" +
                    "(УЕТ = 1 для не стоматологических приемов)");
        }
        if (cf != null) {
            ReceptionType recType = cf.getReceptionType();
            String code = recType.getExtKey();
            if (!code.contains("29") && d.uet != ServiceRender.DEFAULT_UET) {
                throw new ClipsServerException("Для не стоматологического приема указан УЕТ отличный от единицы");
            }
        }
View Full Code Here

Examples of beans.user.collaborator.entities.CollaboratorFunctions

                = findEntityList(CollaboratorFunctions.class,
                                new Field[]{new Field("collaborator.id", getCollaboratorId())});
        if (list1.size() < 1){
            throwNeedAdminSecurityException("Текущий сотрудник не может оказывать услуги");
        }
        CollaboratorFunctions collFunc = list1.get(0);

        ArrayList<AuditDetails> auditDetailsList = new ArrayList<AuditDetails>();
        while (it.hasNext()) {//шуршим по всем анализам
            Checkup checkup = (Checkup) it.next();           
            AuditDoc<Checkup> auditCheckup = new AuditDoc<Checkup>(checkup, getCollaborator());
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.