コード例 #1
0
 @SuppressWarnings("unchecked")
 @Override
 public void prepareEdit() {
   stillBirthRegistration =
       (StillBirthRegistration) birthRegistrationService.getBirthRegistrationById(idTemp);
   // stillBirthRegistration =
   // (StillBirthRegistration)birthRegistrationService.merge(stillBirthRegistration);
   fatherAddressSet =
       (Set<Address>)
           stillBirthRegistration
               .getCitizen()
               .getRelatedPerson(BndConstants.FATHER.toUpperCase())
               .getAddress();
   motherAddressSet =
       (Set<Address>)
           stillBirthRegistration
               .getCitizen()
               .getRelatedPerson(BndConstants.MOTHER.toUpperCase())
               .getAddress();
   informantAddressSet.add(
       stillBirthRegistration.getInformant().getRelatedAddress(BndConstants.PRESENTADDRESS));
   citizenAddressSet = (Set<Address>) stillBirthRegistration.getCitizen().getAddress();
   oldRelations = stillBirthRegistration.getCitizen().getRelations();
   fatherAddressSet.removeAll(informantAddressSet);
   motherAddressSet.removeAll(informantAddressSet);
   getDetailsAddressTypeAndRelation();
 }
コード例 #2
0
 @Override
 protected String getPendingActions() {
   return stillBirthRegistration == null
       ? ""
       : stillBirthRegistration.getCurrentState() == null
           ? ""
           : stillBirthRegistration.getCurrentState().getNextAction();
 }
コード例 #3
0
  @Override
  @Transactional
  public String getAdditionalRule() {

    final Long userId =
        stillBirthRegistration.getCreatedBy() == null
            ? Long.valueOf(EgovThreadLocals.getUserId())
            : stillBirthRegistration.getCreatedBy().getId();
    final List<String> roleList = bndCommonService.getRoleNamesByPassingUserId(userId);
    return BndRuleBook.HOSPITALUSER.equalsIgnoreCase(
            BndRuleBook.getInstance().getHighestPrivilegedRole(roleList))
        ? BndRuleBook.HOSPITALUSER
        : "******";
  }
コード例 #4
0
 @Override
 @Transactional
 protected void saveOrUpdate() {
   buildRegistration();
   if (stillBirthRegistration.getRegistrationNo() == null
       || "".equals(stillBirthRegistration.getRegistrationNo().trim()))
     stillBirthRegistration.setRegistrationNo(
         numberGenerationService.getStillBirthRegistrationNumber(
             stillBirthRegistration, birthHospitalUserFlag));
   stillBirthRegistration.setAdditionalRule(getAdditionalRule());
   birthRegistrationService.save(stillBirthRegistration, workFlowType);
   stillBirthRegistration.setPlaceType(bndCommonService.getPlaceType(placeTypeTemp));
   LOGGER.debug("Still Birth Registration Record ::::::::::" + stillBirthRegistration);
   mode = VIEW;
 }
コード例 #5
0
 @Override
 @Transactional
 @Action(
     value = "/stillBirthRegistration-create",
     results = {@Result(name = NEW, type = "dispatcher")})
 public String create() {
   if (workFlowType != null
       && !"".equals(workFlowType)
       && BndConstants.SCRIPT_SAVE.equals(workFlowType))
     stillBirthRegistration.setStatus(
         bndCommonService.getStatusByModuleAndCode(
             BndConstants.STILLBIRTHREGISTRATION, BndConstants.CREATED));
   stillBirthRegistration.setPlaceType(bndCommonService.getPlaceType(placeTypeTemp));
   saveOrUpdate();
   mode = VIEW;
   return NEW;
 }
コード例 #6
0
 private void buildCitizenAddress() {
   stillBirthRegistration.getCitizen().setName(BndConstants.STILLBIRTH);
   if (placeTypeTemp != null && BndConstants.NOTSTATED.equals(placeTypeTemp))
     stillBirthRegistration.setEventAddress(null);
   else if (placeTypeTemp != null && BndConstants.HOSPTIAL.equals(placeTypeTemp))
     stillBirthRegistration.setEventAddress(
         stillBirthRegistration.getEstablishment().getAddress());
   else stillBirthRegistration.getEventAddress().setType(eventAddressType);
   stillBirthRegistration.getMotherResidenceAddress().setType(usualAddressType);
   buildNewAddressFromOldAddress(
       motherAddressSet, stillBirthRegistration.getMotherResidenceAddress());
   stillBirthRegistration.getInformantAddress().setType(AddressType.CORRESPONDENCE);
 }
コード例 #7
0
 @SkipValidation
 @Action(
     value = "/stillBirthRegistration-newform",
     results = {@Result(name = NEW, type = "dispatcher")})
 public String newOnlineform() {
   LOGGER.debug("New Still Birth Registration Online form");
   stillBirthRegistration.setRegistrationDate(DateUtils.today());
   buildNewBirthForm(stillBirthRegistration);
   registrationMode = "online";
   return NEW;
 }
コード例 #8
0
 private void buildRegistration() {
   // stillBirthRegistration.setPlaceType(bndCommonService.getPlaceType(placeTypeTemp));
   stillBirthRegistration.setIsCitizenKnown(Boolean.FALSE);
   buildCitizenAddress();
   buildCitizenRelation(stillBirthRegistration);
   buildInfomantDetails(stillBirthRegistration);
   buildAddress(stillBirthRegistration);
   // stillBirthRegistration.setStatus(birthStatusFlag==1?bndCommonService.getStatusByModuleAndCode(BndConstants.STILLBIRTHREGISTRATION,BndConstants.APPROVED)
   // :bndCommonService.getStatusByModuleAndCode(BndConstants.STILLBIRTHREGISTRATION,BndConstants.CREATED));
   stillBirthRegistration.getCitizenBDDetails().setIsStillBirth('Y');
   stillBirthRegistration.setIsStillBirth('Y');
   stillBirthRegistration.setAdoptionDetail(null);
   LOGGER.info(
       "Mother Education-------:::"
           + stillBirthRegistration.getCitizenBDDetails().getMotherEducation());
   if (stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath() == null)
     stillBirthRegistration
         .getCitizenBDDetails()
         .setCauseOfDeath(stillBirthRegistration.getCauseOfDeathParent());
 }
コード例 #9
0
  private void buildHospitalList() {
    if (stillBirthRegistration.getEstablishment() != null
        && stillBirthRegistration.getRegistrarId().getRegUnitId() != null)
      addDropdownData(
          "hospitalList",
          bndCommonService.getHospitalByTypeAndUnit(
              stillBirthRegistration.getEstablishment().getType().getId(),
              stillBirthRegistration.getRegistrarId().getRegUnitId().getId()));
    else addDropdownData("hospitalList", Collections.EMPTY_LIST);

    if (stillBirthRegistration.getCitizenBDDetails() != null
        && stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath() != null
        && stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath().getParent() != null)
      addDropdownData(
          "diseaseList",
          bndCommonService.getCauseofDeathbyParentId(
              stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath().getParent().getId()));
    else addDropdownData("diseaseList", Collections.EMPTY_LIST);
  }
コード例 #10
0
  private void beforeViewAndModify() {
    stillBirthRegistration =
        (StillBirthRegistration) birthRegistrationService.getBirthRegistrationById(idTemp);
    stillBirthRegistration.setFather(
        stillBirthRegistration.getCitizen().getRelatedPerson(BndConstants.FATHER.toUpperCase()));
    stillBirthRegistration.setMother(
        stillBirthRegistration.getCitizen().getRelatedPerson(BndConstants.MOTHER.toUpperCase()));

    if (stillBirthRegistration.getInformant() != null) {
      final CRelation relation =
          stillBirthRegistration.getCitizen().getRelation(stillBirthRegistration.getInformant());
      if (relation != null) informantFlag = relation.getDesc();
      informantCitizen = stillBirthRegistration.getInformant();
      stillBirthRegistration.setInformantAddress(
          stillBirthRegistration.getInformant().getRelatedAddress(BndConstants.PRESENTADDRESS));
    }
    stillBirthRegistration.setMotherResidenceAddress(
        stillBirthRegistration.getMother().getRelatedAddress(BndConstants.USUALADDRESS));
    placeTypeTemp = stillBirthRegistration.getPlaceType().getDesc();

    if (stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath() != null)
      if (stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath().getParent() != null) {
        stillBirthRegistration.setCauseOfDeathParent(
            stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath().getParent());
        addDropdownData(
            "diseaseList",
            bndCommonService.getCauseofDeathbyParentId(
                stillBirthRegistration
                    .getCitizenBDDetails()
                    .getCauseOfDeath()
                    .getParent()
                    .getId()));
      } else
        stillBirthRegistration.setCauseOfDeathParent(
            stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath());
  }
コード例 #11
0
  @Override
  public void validate() {

    if (stillBirthRegistration.getDateOfEvent() != null
        && stillBirthRegistration.getDateOfEvent().after(DateUtils.today()))
      addActionError(getMessage("dateOfEvent.today.validate"));

    if (stillBirthRegistration.getRegistrationDate() != null
        && stillBirthRegistration.getDateOfEvent() != null
        && stillBirthRegistration
            .getDateOfEvent()
            .after(stillBirthRegistration.getRegistrationDate()))
      addActionError(getMessage("dateOfEvent.registration.validate"));

    if (placeTypeTemp != null
        && !EMPTY.equals(placeTypeTemp)
        && BndConstants.HOSPTIAL.equalsIgnoreCase(placeTypeTemp)
        && stillBirthRegistration.getEstablishment() == null)
      addActionError(getMessage("hospitalname.required"));
    // For Offline mode validating registration number....
    if (OFFLINE.equals(mode)
        && stillBirthRegistration.getRegistrationNo() != null
        && !EMPTY.equals(stillBirthRegistration.getRegistrationNo().trim()))
      if (stillBirthRegistration.getRegistrationUnit() != null
          && birthRegistrationService.checkUniqueRegistrationNumber(
              stillBirthRegistration.getRegistrationUnit().getId(),
              stillBirthRegistration.getId(),
              stillBirthRegistration.getRegistrationNo(),
              BndConstants.REGISTRATIONDATE.equalsIgnoreCase(numberGenKey)
                  ? stillBirthRegistration.getRegistrationDate()
                  : stillBirthRegistration.getDateOfEvent(),
              BndConstants.STILLBIRTHNUM)) addActionError(getMessage("registration.number.exists"));
      else if (BndUtils.isNum(stillBirthRegistration.getRegistrationNo().trim())) {
        final int eventYear =
            BndConstants.REGISTRATIONDATE.equalsIgnoreCase(numberGenKey)
                ? BndDateUtils.getCurrentYear(stillBirthRegistration.getRegistrationDate())
                : BndDateUtils.getCurrentYear(stillBirthRegistration.getDateOfEvent());
        final RegKeys regNumRange =
            regKeyService.getRegKeyByRegUnitAndDate(
                stillBirthRegistration.getRegistrationUnit(),
                eventYear,
                numberGenerationService.buildObjectType(
                    stillBirthRegistration, eventYear, BndConstants.STILLBIRTHNUM));
        if (regNumRange != null) {
          final Integer regNumber = Integer.valueOf(stillBirthRegistration.getRegistrationNo());
          if (regNumber >= regNumRange.getMinValue())
            addActionError(
                getMessage("regNumber.minvalue.validate")
                    .concat(" ")
                    .concat(regNumRange.getMinValue().toString()));
        }
      }
  }
コード例 #12
0
 @Override
 @Transactional
 @ValidationErrorPage(NEW)
 @Action(
     value = "/stillBirthRegistration-edit",
     results = {@Result(name = NEW, type = "dispatcher")})
 public String edit() {
   if (getMode().equals(LOCK)) {
     birthRegistrationService.buildAdoptionDetial(stillBirthRegistration);
     buildRegistration();
     stillBirthRegistration.setPlaceType(bndCommonService.getPlaceType(placeTypeTemp));
     stillBirthRegistration.setStatus(
         bndCommonService.getStatusByModuleAndCode(
             BndConstants.STILLBIRTHREGISTRATION, BndConstants.LOCK));
     final EgwSatuschange change = new EgwSatuschange();
     change.setFromstatus(
         bndCommonService
             .getStatusByModuleAndCode(BndConstants.STILLBIRTHREGISTRATION, BndConstants.APPROVED)
             .getId());
     change.setTostatus(
         bndCommonService
             .getStatusByModuleAndCode(BndConstants.STILLBIRTHREGISTRATION, BndConstants.LOCK)
             .getId());
     change.setModuleid(stillBirthRegistration.getId().intValue());
     change.setModuletype(BndConstants.STILLBIRTHREGISTRATIONMODULE);
     // change.setCreatedby(EgovThreadLocals.getUserId());
     // TODO egifix-hibernateutil
     // HibernateUtil.getCurrentSession().persist(change);
     entityManager.persist(change);
     birthRegistrationService.save(stillBirthRegistration, workFlowType);
   } else if (getMode().equals(UNLOCK)) {
     birthRegistrationService.buildAdoptionDetial(stillBirthRegistration);
     buildRegistration();
     stillBirthRegistration.setPlaceType(bndCommonService.getPlaceType(placeTypeTemp));
     stillBirthRegistration.setStatus(
         bndCommonService.getStatusByModuleAndCode(
             BndConstants.STILLBIRTHREGISTRATION, BndConstants.APPROVED));
     final EgwSatuschange change = new EgwSatuschange();
     change.setFromstatus(
         bndCommonService
             .getStatusByModuleAndCode(BndConstants.STILLBIRTHREGISTRATION, BndConstants.LOCK)
             .getId());
     change.setTostatus(
         bndCommonService
             .getStatusByModuleAndCode(BndConstants.STILLBIRTHREGISTRATION, BndConstants.APPROVED)
             .getId());
     change.setModuleid(stillBirthRegistration.getId().intValue());
     change.setModuletype(BndConstants.STILLBIRTHREGISTRATIONMODULE);
     //             change.setCreatedby(EgovThreadLocals.getUserId());
     // TODO egifix-hibernateutil
     // HibernateUtil.getCurrentSession().persist(change);
     entityManager.persist(change);
     birthRegistrationService.save(stillBirthRegistration, workFlowType);
   } else {
     saveOrUpdate();
     if (BndConstants.APPROVED.equalsIgnoreCase(stillBirthRegistration.getStatus().getCode())
         && stillBirthRegistration
             .getRegistrationNo()
             .contains(BndConstants.HOSPITALSTILLBIRTHSUFFIX))
       numberGenerationService.reGenerateStillBirthRegistrationNumber(stillBirthRegistration);
     if (remarksHistory != null && !"".equals(remarksHistory))
       bndCommonService.saveHistory(
           stillBirthRegistration, BndConstants.STILLBIRTHREGISTRATION, remarksHistory);
   }
   mode = VIEW;
   return NEW;
 }
コード例 #13
0
 private void buildPrepareNewForm() {
   stillBirthRegistration.setRegistrarId(bndCommonService.getRegistrarByLoggedInUser());
   if (stillBirthRegistration.getRegistrarId() != null)
     stillBirthRegistration.setRegistrationUnit(
         stillBirthRegistration.getRegistrarId().getRegUnitId());
 }