mv: Refactor

* Move entities for organization
This commit is contained in:
2025-01-28 20:47:26 -05:00
parent ee2fce4c41
commit bcc32bf445
23 changed files with 345 additions and 87 deletions

View File

@@ -0,0 +1,202 @@
<?php
namespace App\Entity\Case;
use App\Entity\System\Location;
use App\Repository\Case\CaseItineraryRepository;
use DateTime;
use DateInterval;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
use Symfony\UX\Map\Point;
#[ORM\Entity(repositoryClass: CaseItineraryRepository::class)]
class CaseItinerary
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $date = null;
#[ORM\Column(type: Types::TIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $departure = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?Location $originLocation = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?Location $destLocation = null;
#[ORM\Column]
private ?bool $caseMileage = null;
#[ORM\Column]
private ?DateInterval $duration = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?MemberCase $memberCase = null;
#[ORM\Column(nullable: true)]
private ?float $distance = null;
#[ORM\Column(nullable: true)]
private ?array $gpsRoute = null;
public function getId(): ?Uuid
{
return $this->id;
}
public function getDeparture(): ?\DateTimeInterface
{
return $this->departure;
}
public function setDeparture(?\DateTimeInterface $departure): static
{
$this->departure = $departure;
return $this;
}
public function getOriginLocation(): ?Location
{
return $this->originLocation;
}
public function setOriginLocation(?Location $originLocation): static
{
$this->originLocation = $originLocation;
return $this;
}
public function getDestLocation(): ?Location
{
return $this->destLocation;
}
public function setDestLocation(?Location $destLocation): static
{
$this->destLocation = $destLocation;
return $this;
}
public function isCaseMileage(): ?bool
{
return $this->caseMileage;
}
public function setCaseMileage(bool $caseMileage): static
{
$this->caseMileage = $caseMileage;
return $this;
}
public function getDuration(): ?DateInterval
{
return $this->duration;
}
public function setDuration(?DateInterval $duration): static
{
//$this->calcDuration();
$this->duration = $duration;
return $this;
}
public function calcDuration()
{
//$this->duration = $this->departure - $this->arrival;
}
public function getMemberCase(): ?MemberCase
{
return $this->memberCase;
}
public function setMemberCase(?MemberCase $memberCase): static
{
$this->memberCase = $memberCase;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): static
{
$this->date = $date;
return $this;
}
public function getDistance(): ?float
{
return $this->distance;
}
public function setDistance(?float $distance): static
{
$this->distance = $distance;
return $this;
}
public function getGpsRoute(): ?array
{
return $this->gpsRoute;
}
public function setGpsRoute(?array $gpsRoute): static
{
$this->gpsRoute = $gpsRoute;
return $this;
}
public function getGPSPolyLines(): array
{
$points = [];
foreach ($this->gpsRoute as $route) {
$points[] = new Point($route['lat'], $route['lon']);
}
return $points;
}
public function originInfoWindow(): string
{
return <<<EOL
{$this->originLocation->getName()}<br/>
<a href='http://maps.google.com/?q={$this->originLocation->getLat()},{$this->originLocation->getLon()}'>{$this->originLocation->getFormattedAddress()}</a><br/>
{$this->departure->format("g:i a")}
EOL;
}
public function destinationInfoWindow(): string
{
/** @var DateTime $arrival */
$arrival = $this->departure;
$arrival->add($this->duration);
return <<<EOL
{$this->destLocation->getName()}<br/>
<a href='http://maps.google.com/?q={$this->destLocation->getLat()},{$this->destLocation->getLon()}'>{$this->destLocation->getFormattedAddress()}</a><br/>
{$arrival->format("g:i a")}
EOL;
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Entity\Case;
use App\Entity\System\Location;
use App\Repository\Case\CaseLocationRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: CaseLocationRepository::class)]
class CaseLocation
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?MemberCase $memberCase = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?Location $location = null;
public function getId(): ?int
{
return $this->id;
}
public function getMemberCase(): ?MemberCase
{
return $this->memberCase;
}
public function setMemberCase(?MemberCase $memberCase): static
{
$this->memberCase = $memberCase;
return $this;
}
public function getLocation(): ?Location
{
return $this->location;
}
public function setLocation(?Location $location): static
{
$this->location = $location;
return $this;
}
}

454
src/Entity/Case/Member.php Normal file
View File

@@ -0,0 +1,454 @@
<?php
namespace App\Entity\Case;
use App\Enums\System\GenderType;
use App\Enums\Case\RaceType;
use App\Enums\Case\RelationshipType;
use App\Repository\Case\MemberRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: MemberRepository::class)]
#[ORM\Table(name: '`member`')]
class Member
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\ManyToOne(inversedBy: 'members')]
#[ORM\JoinColumn(nullable: false)]
private ?MemberCase $memberCase = null;
#[ORM\Column(length: 45)]
private ?string $lastName = null;
#[ORM\Column(length: 45)]
private ?string $firstName = null;
#[ORM\Column(length: 45, nullable: true)]
private ?RelationshipType $relationship = null;
#[ORM\Column(length: 45, nullable: true)]
private ?string $personalId = null;
#[ORM\Column(nullable: true, enumType: GenderType::class)]
private ?GenderType $gender = null;
#[ORM\Column(length: 45, nullable: true)]
private ?RaceType $race = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $dob = null;
#[ORM\Column(length: 45, nullable: true)]
private ?string $language = null;
#[ORM\Column(length: 45, nullable: true)]
private ?string $emergencyContact = null;
#[ORM\Column(length: 15, nullable: true)]
private ?string $phone = null;
#[ORM\Column(length: 15, nullable: true)]
private ?string $dayPhone = null;
#[ORM\Column(length: 15, nullable: true)]
private ?string $eveningPhone = null;
#[ORM\Column(length: 15, nullable: true)]
private ?string $cellPhone = null;
#[ORM\Column(length: 45, nullable: true)]
private ?string $email = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $school = null;
#[ORM\Column(length: 64, nullable: true)]
private ?string $address = null;
#[ORM\Column(length: 45, nullable: true)]
private ?string $city = null;
#[ORM\Column(length: 15, nullable: true)]
private ?string $state = null;
#[ORM\Column(length: 10, nullable: true)]
private ?string $zip = null;
#[ORM\Column(length: 45, nullable: true)]
private ?string $maritalStatus = null;
#[ORM\Column]
private ?bool $isChild = null;
#[ORM\Column]
private ?bool $isParent = null;
#[ORM\Column]
private ?bool $isAdultChild = null;
#[ORM\Column]
private ?bool $isLegalGuardian = null;
#[ORM\Column]
private ?bool $parentsLiveTogether = null;
#[ORM\Column]
private ?bool $dcsApproved = null;
public function getId(): ?Uuid
{
return $this->id;
}
public function getCaseId(): ?MemberCase
{
return $this->memberCase;
}
public function setCaseId(?MemberCase $caseId): static
{
$this->memberCase = $caseId;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): static
{
$this->lastName = $lastName;
return $this;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): static
{
$this->firstName = $firstName;
return $this;
}
public function getName(): string
{
return "{$this->firstName} {$this->lastName}";
}
public function getRelationship(): ?RelationshipType
{
return $this->relationship;
}
public function setRelationship(?RelationshipType $relationship): static
{
$this->relationship = $relationship;
return $this;
}
public function getPersonalId(): ?string
{
return $this->personalId;
}
public function setPersonalId(?string $personalId): static
{
$this->personalId = $personalId;
return $this;
}
public function getGender(): ?GenderType
{
return $this->gender;
}
public function setGender(?GenderType $gender): static
{
$this->gender = $gender;
return $this;
}
public function getRace(): ?RaceType
{
return $this->race;
}
public function setRace(?RaceType $race): static
{
$this->race = $race;
return $this;
}
public function getDob(): ?\DateTimeInterface
{
return $this->dob;
}
public function setDob(\DateTimeInterface $dob): static
{
$this->dob = $dob;
return $this;
}
public function getLanguage(): ?string
{
return $this->language;
}
public function setLanguage(?string $language): static
{
$this->language = $language;
return $this;
}
public function getEmergencyContact(): ?string
{
return $this->emergencyContact;
}
public function setEmergencyContact(?string $emergencyContact): static
{
$this->emergencyContact = $emergencyContact;
return $this;
}
public function getFormattedPhone(): ?string
{
if ($this->phone) {
return '(' . substr($this->phone, 0, 3) . ') ' . substr($this->phone, 3, 3) . '-' . substr($this->phone, 6);
} elseif ($this->dayPhone) {
return '(' . substr($this->dayPhone, 0, 3) . ') ' . substr($this->dayPhone, 3, 3) . '-' . substr($this->dayPhone, 6);
} elseif ($this->eveningPhone) {
return '(' . substr($this->eveningPhone, 0, 3) . ') ' . substr($this->eveningPhone, 3, 3) . '-' . substr($this->eveningPhone, 6);
} elseif ($this->cellPhone) {
return '(' . substr($this->cellPhone, 0, 3) . ') ' . substr($this->cellPhone, 3, 3) . '-' . substr($this->cellPhone, 6);
}
return null;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): static
{
$this->phone = $phone;
return $this;
}
public function getDayPhone(): ?string
{
return $this->dayPhone;
}
public function setDayPhone(?string $dayPhone): static
{
$this->dayPhone = $dayPhone;
return $this;
}
public function getEveningPhone(): ?string
{
return $this->eveningPhone;
}
public function setEveningPhone(?string $eveningPhone): static
{
$this->eveningPhone = $eveningPhone;
return $this;
}
public function getCellPhone(): ?string
{
return $this->cellPhone;
}
public function setCellPhone(?string $cellPhone): static
{
$this->cellPhone = $cellPhone;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): static
{
$this->email = $email;
return $this;
}
public function getSchool(): ?string
{
return $this->school;
}
public function setSchool(?string $school): static
{
$this->school = $school;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): static
{
$this->address = $address;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): static
{
$this->city = $city;
return $this;
}
public function getState(): ?string
{
return $this->state;
}
public function setState(?string $state): static
{
$this->state = $state;
return $this;
}
public function getZip(): ?string
{
return $this->zip;
}
public function setZip(?string $zip): static
{
$this->zip = $zip;
return $this;
}
public function getMaritalStatus(): ?string
{
return $this->maritalStatus;
}
public function setMaritalStatus(?string $maritalStatus): static
{
$this->maritalStatus = $maritalStatus;
return $this;
}
public function isChild(): ?bool
{
return $this->isChild;
}
public function setChild(bool $isChild): static
{
$this->isChild = $isChild;
return $this;
}
public function isParent(): ?bool
{
return $this->isParent;
}
public function setParent(bool $isParent): static
{
$this->isParent = $isParent;
return $this;
}
public function isAdultChild(): ?bool
{
return $this->isAdultChild;
}
public function setAdultChild(bool $isAdultChild): static
{
$this->isAdultChild = $isAdultChild;
return $this;
}
public function isLegalGuardian(): ?bool
{
return $this->isLegalGuardian;
}
public function setLegalGuardian(bool $isLegalGuardian): static
{
$this->isLegalGuardian = $isLegalGuardian;
return $this;
}
public function isParentsLiveTogether(): ?bool
{
return $this->parentsLiveTogether;
}
public function setParentsLiveTogether(bool $parentsLiveTogether): static
{
$this->parentsLiveTogether = $parentsLiveTogether;
return $this;
}
public function isDcsApproved(): ?bool
{
return $this->dcsApproved;
}
public function setDcsApproved(bool $dcsApproved): static
{
$this->dcsApproved = $dcsApproved;
return $this;
}
}

View File

@@ -0,0 +1,518 @@
<?php
namespace App\Entity\Case;
use App\Entity\Staff\StaffNote;
use App\Entity\System\ReferralSource;
use App\Entity\System\UserCase;
use App\Enums\Case\CaseLevel;
use App\Enums\System\County;
use App\Enums\Case\ReferralType;
use App\Repository\Case\MemberCaseRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: MemberCaseRepository::class)]
class MemberCase
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\Column(length: 15)]
private ?string $caseNumber = null;
#[ORM\Column(length: 45)]
private ?string $firstName = null;
#[ORM\Column(length: 45)]
private ?string $lastName = null;
#[ORM\Column(length: 45)]
private ?ReferralType $referralType = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?ReferralSource $referralSource = null;
#[ORM\ManyToOne]
private ?ReferralSource $referralSource2 = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $admitDate = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $closeDate = null;
#[ORM\Column(length: 15, nullable: true)]
private ?string $dcsCaseId = null;
#[ORM\Column(length: 45, nullable: true)]
private ?string $insurance = null;
#[ORM\Column(length: 45, nullable: true)]
private ?string $medicaid = null;
#[ORM\Column(length: 64, nullable: true)]
private ?string $caseEmail = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $address = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $address2 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $city = null;
#[ORM\Column(length: 10, nullable: true)]
private ?string $state = null;
#[ORM\Column(nullable: true)]
private ?int $zip = null;
#[ORM\Column(enumType: County::class)]
private ?County $county = null;
#[ORM\Column(enumType: CaseLevel::class)]
private ?CaseLevel $level = null;
/**
* @var Collection<int, UserCase>
*/
#[ORM\OneToMany(targetEntity: UserCase::class, mappedBy: 'memberCase')]
private Collection $userCases;
/**
* @var Collection<int, Referral>
*/
#[ORM\OneToMany(targetEntity: Referral::class, mappedBy: 'memberCase', orphanRemoval: true)]
private Collection $referrals;
/**
* @var Collection<int, MonthlyCaseNote>
*/
#[ORM\OneToMany(targetEntity: MonthlyCaseNote::class, mappedBy: 'memberCase')]
private Collection $monthlyCaseNotes;
/**
* @var Collection<int, Member>
*/
#[ORM\OneToMany(targetEntity: Member::class, mappedBy: 'memberCase', orphanRemoval: true)]
private Collection $members;
/**
* @var Collection<int, StaffNote>
*/
#[ORM\OneToMany(targetEntity: StaffNote::class, mappedBy: 'memberCase')]
private Collection $staffNotes;
public function __construct()
{
$this->userCases = new ArrayCollection();
$this->referrals = new ArrayCollection();
$this->monthlyCaseNotes = new ArrayCollection();
$this->members = new ArrayCollection();
$this->staffNotes = new ArrayCollection();
}
public function getId(): ?Uuid
{
return $this->id;
}
public function getCaseNumber(): ?string
{
return $this->caseNumber;
}
public function setCaseNumber(string $caseNumber): static
{
$this->caseNumber = $caseNumber;
return $this;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(string $firstName): static
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(string $lastName): static
{
$this->lastName = $lastName;
return $this;
}
public function getCaseName(): string
{
return "{$this->lastName}, {$this->firstName}";
}
public function getReferralType(): ?ReferralType
{
return $this->referralType;
}
public function setReferralType(ReferralType $referralType): static
{
$this->referralType = $referralType;
return $this;
}
public function getReferralSource(): ?ReferralSource
{
return $this->referralSource;
}
public function setReferralSource(?ReferralSource $referralSource): static
{
$this->referralSource = $referralSource;
return $this;
}
public function getReferralSource2(): ?ReferralSource
{
return $this->referralSource2;
}
public function setReferralSource2(?ReferralSource $referralSource2): static
{
$this->referralSource2 = $referralSource2;
return $this;
}
public function getAdmitDate(): ?\DateTimeInterface
{
return $this->admitDate;
}
public function setAdmitDate(?\DateTimeInterface $admitDate): static
{
$this->admitDate = $admitDate;
return $this;
}
public function getCloseDate(): ?\DateTimeInterface
{
return $this->closeDate;
}
public function setCloseDate(?\DateTimeInterface $closeDate): static
{
$this->closeDate = $closeDate;
return $this;
}
public function getDcsCaseId(): ?int
{
return $this->dcsCaseId;
}
public function setDcsCaseId(?int $dcsCaseId): static
{
$this->dcsCaseId = $dcsCaseId;
return $this;
}
public function getInsurance(): ?string
{
return $this->insurance;
}
public function setInsurance(?string $insurance): static
{
$this->insurance = $insurance;
return $this;
}
public function getMedicaid(): ?string
{
return $this->medicaid;
}
public function setMedicaid(?string $medicaid): static
{
$this->medicaid = $medicaid;
return $this;
}
public function getCaseEmail(): ?string
{
return $this->caseEmail;
}
public function setCaseEmail(?string $caseEmail): static
{
$this->caseEmail = $caseEmail;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): static
{
$this->address = $address;
return $this;
}
public function getCounty(): ?County
{
return $this->county;
}
public function setCounty(County $county): static
{
$this->county = $county;
return $this;
}
public function getLevel(): ?CaseLevel
{
return $this->level;
}
public function setLevel(CaseLevel $level): static
{
$this->level = $level;
return $this;
}
public function getAddress2(): ?string
{
return $this->address2;
}
public function setAddress2(?string $address2): static
{
$this->address2 = $address2;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): static
{
$this->city = $city;
return $this;
}
public function getState(): ?string
{
return $this->state;
}
public function setState(?string $state): static
{
$this->state = $state;
return $this;
}
public function getZip(): ?int
{
return $this->zip;
}
public function setZip(?int $zip): static
{
$this->zip = $zip;
return $this;
}
/**
* @return Collection<int, UserCase>
*/
public function getUserCases(): Collection
{
return $this->userCases;
}
public function addUserCase(UserCase $userCase): static
{
if (!$this->userCases->contains($userCase)) {
$this->userCases->add($userCase);
$userCase->setMemberCase($this);
}
return $this;
}
public function removeUserCase(UserCase $userCase): static
{
if ($this->userCases->removeElement($userCase)) {
// set the owning side to null (unless already changed)
if ($userCase->getMemberCase() === $this) {
$userCase->setMemberCase(null);
}
}
return $this;
}
/**
* @return Collection<int, Referral>
*/
public function getReferrals(): Collection
{
return $this->referrals;
}
public function addReferral(Referral $referral): static
{
if (!$this->referrals->contains($referral)) {
$this->referrals->add($referral);
$referral->setMemberCase($this);
}
return $this;
}
public function removeReferral(Referral $referral): static
{
if ($this->referrals->removeElement($referral)) {
// set the owning side to null (unless already changed)
if ($referral->getMemberCase() === $this) {
$referral->setMemberCase(null);
}
}
return $this;
}
/**
* @return Collection<int, MonthlyCaseNote>
*/
public function getMonthlyCaseNotes(): Collection
{
return $this->monthlyCaseNotes;
}
public function addMonthlyCaseNote(MonthlyCaseNote $monthlyCaseNote): static
{
if (!$this->monthlyCaseNotes->contains($monthlyCaseNote)) {
$this->monthlyCaseNotes->add($monthlyCaseNote);
$monthlyCaseNote->setMemberCase($this);
}
return $this;
}
public function removeMonthlyCaseNote(MonthlyCaseNote $monthlyCaseNote): static
{
if ($this->monthlyCaseNotes->removeElement($monthlyCaseNote)) {
// set the owning side to null (unless already changed)
if ($monthlyCaseNote->getMemberCase() === $this) {
$monthlyCaseNote->setMemberCase(null);
}
}
return $this;
}
/**
* @return Collection<int, Member>
*/
public function getMembers(): Collection
{
return $this->members;
}
public function addMember(Member $member): static
{
if (!$this->members->contains($member)) {
$this->members->add($member);
$member->setCaseId($this);
}
return $this;
}
public function removeMember(Member $member): static
{
if ($this->members->removeElement($member)) {
// set the owning side to null (unless already changed)
if ($member->getCaseId() === $this) {
$member->setCaseId(null);
}
}
return $this;
}
/**
* @return Collection<int, StaffNote>
*/
public function getStaffNotes(): Collection
{
return $this->staffNotes;
}
public function addStaffNote(StaffNote $staffNote): static
{
if (!$this->staffNotes->contains($staffNote)) {
$this->staffNotes->add($staffNote);
$staffNote->setMemberCase($this);
}
return $this;
}
public function removeStaffNote(StaffNote $staffNote): static
{
if ($this->staffNotes->removeElement($staffNote)) {
// set the owning side to null (unless already changed)
if ($staffNote->getMemberCase() === $this) {
$staffNote->setMemberCase(null);
}
}
return $this;
}
public function emptyStaffNotes(): static
{
$this->staffNotes->clear();
return $this;
}
}

View File

@@ -0,0 +1,149 @@
<?php
namespace App\Entity\Case;
use App\Entity\Company\CompanyDocument;
use App\Entity\System\User;
use App\Repository\Case\MemberDocumentRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: MemberDocumentRepository::class)]
class MemberDocument
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?Member $client = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?User $caseWorker = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $clientSigned = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $workerSigned = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?CompanyDocument $document = null;
#[ORM\Column(nullable: true)]
private ?array $clientSignature = null;
#[ORM\Column(nullable: true)]
private ?array $workerSignature = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $docData = null;
public function getId(): ?Uuid
{
return $this->id;
}
public function getClient(): ?Member
{
return $this->client;
}
public function setClient(?Member $client): static
{
$this->client = $client;
return $this;
}
public function getCaseWorker(): ?User
{
return $this->caseWorker;
}
public function setCaseWorker(?User $caseWorker): static
{
$this->caseWorker = $caseWorker;
return $this;
}
public function getClientSigned(): ?\DateTimeInterface
{
return $this->clientSigned;
}
public function setClientSigned(?\DateTimeInterface $clientSigned): static
{
$this->clientSigned = $clientSigned;
return $this;
}
public function getWorkerSigned(): ?\DateTimeInterface
{
return $this->workerSigned;
}
public function setWorkerSigned(?\DateTimeInterface $workerSigned): static
{
$this->workerSigned = $workerSigned;
return $this;
}
public function getDocument(): ?CompanyDocument
{
return $this->document;
}
public function setDocument(?CompanyDocument $document): static
{
$this->document = $document;
return $this;
}
public function getClientSignature(): ?array
{
return $this->clientSignature;
}
public function setClientSignature(?array $clientSignature): static
{
$this->clientSignature = $clientSignature;
return $this;
}
public function getWorkerSignature(): ?array
{
return $this->workerSignature;
}
public function setWorkerSignature(?array $workerSignature): static
{
$this->workerSignature = $workerSignature;
return $this;
}
public function getDocData(): ?string
{
return $this->docData;
}
public function setDocData(?string $docData): static
{
$this->docData = $docData;
return $this;
}
}

View File

@@ -0,0 +1,115 @@
<?php
namespace App\Entity\Case;
use App\Repository\Case\MonthlyCaseNoteRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: MonthlyCaseNoteRepository::class)]
class MonthlyCaseNote
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $reason = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $familyStrength = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $recAndProgress = null;
#[ORM\ManyToOne(inversedBy: 'monthlyCaseNotes')]
#[ORM\JoinColumn(nullable: false)]
private ?MemberCase $memberCase = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $date = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $nextVisit = null;
public function getId(): ?Uuid
{
return $this->id;
}
public function getReason(): ?string
{
return $this->reason;
}
public function setReason(?string $reason): static
{
$this->reason = $reason;
return $this;
}
public function getFamilyStrength(): ?string
{
return $this->familyStrength;
}
public function setFamilyStrength(?string $familyStrength): static
{
$this->familyStrength = $familyStrength;
return $this;
}
public function getRecAndProgress(): ?string
{
return $this->recAndProgress;
}
public function setRecAndProgress(?string $recAndProgress): static
{
$this->recAndProgress = $recAndProgress;
return $this;
}
public function getMemberCase(): ?MemberCase
{
return $this->memberCase;
}
public function setMemberCase(?MemberCase $memberCase): static
{
$this->memberCase = $memberCase;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): static
{
$this->date = $date;
return $this;
}
public function getNextVisit(): ?\DateTimeInterface
{
return $this->nextVisit;
}
public function setNextVisit(\DateTimeInterface $nextVisit): static
{
$this->nextVisit = $nextVisit;
return $this;
}
}

193
src/Entity/Case/Note.php Normal file
View File

@@ -0,0 +1,193 @@
<?php
namespace App\Entity\Case;
use App\Enums\Case\NoteLocation;
use App\Enums\Case\NoteMethod;
use App\Enums\Case\NoteStatus;
use App\Repository\Case\NoteRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\MappedSuperclass;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[MappedSuperclass(NoteRepository::class)]
class Note
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $date = null;
#[ORM\ManyToOne(inversedBy: 'notes')]
#[ORM\JoinColumn(nullable: false)]
private ?Referral $referral = null;
#[ORM\Column(type: Types::TIME_MUTABLE)]
private ?\DateTimeInterface $startTime = null;
#[ORM\Column(type: Types::TIME_MUTABLE)]
private ?\DateTimeInterface $endTime = null;
#[ORM\Column(enumType: NoteStatus::class)]
private ?NoteStatus $status = null;
#[ORM\Column(enumType: NoteLocation::class)]
private ?NoteLocation $location = null;
#[ORM\Column(enumType: NoteMethod::class)]
private ?NoteMethod $method = null;
private ?array $members = null;
public function __construct()
{
$this->members = [];
}
public function getId(): ?UUid
{
return $this->id;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): static
{
$this->date = $date;
return $this;
}
public function getReferral(): ?Referral
{
return $this->referral;
}
public function setReferral(?Referral $referral): static
{
$this->referral = $referral;
return $this;
}
public function getStartTime(): ?\DateTimeInterface
{
return $this->startTime;
}
public function setStartTime(\DateTimeInterface $startTime): static
{
$this->startTime = $startTime;
return $this;
}
public function getEndTime(): ?\DateTimeInterface
{
return $this->endTime;
}
public function setEndTime(\DateTimeInterface $endTime): static
{
$this->endTime = $endTime;
return $this;
}
public function getStatus(): ?NoteStatus
{
return $this->status;
}
public function setStatus(NoteStatus $status): static
{
$this->status = $status;
return $this;
}
public function getLocation(): ?NoteLocation
{
return $this->location;
}
public function setLocation(NoteLocation $location): static
{
$this->location = $location;
return $this;
}
public function getMethod(): ?NoteMethod
{
return $this->method;
}
public function setMethod(NoteMethod $method): static
{
$this->method = $method;
return $this;
}
public function getMembers(): ?array
{
return $this->members;
}
public function setMembers(?array $members): static
{
$this->members = $members;
return $this;
}
public function addMember(Member $member): static
{
$this->members[] = $member;
return $this;
}
/**
* Method to calculate the number of minutes used for a visit rounded to the nearest 15 min increment
*
* @param int $precision
* The number of minutes to round the time to defaulted to 15
*
* @return int
* The number of minutes calculated
*/
public function calcTimeUsed(int $precision = 15): int
{
// get the number of seconds between the two times
$timestamp = $this->endTime->getTimestamp() - $this->startTime->getTimestamp();
// find out how many increments of precision there are between these two increments
$increments = ($timestamp / 60) / $precision;
// if the number of increments is a float that means there is a difference
if (is_float($increments)) {
// calculate the modulo
$mod = ($timestamp / 60) % $precision;
// if the modulo is higher than half the precision increment increase the increments by 1
if ($mod >= ($precision / 2)) {
$increments++;
}
// convert the increments to an integer
$increments = (int) $increments;
}
// return the number of increments times the precision to the partials
return $increments * $precision;
}
}

View File

@@ -0,0 +1,155 @@
<?php
namespace App\Entity\Case;
use App\Enums\Case\DischargeReason;
use App\Enums\Case\ReferralServiceType;
use App\Repository\Case\ReferralRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: ReferralRepository::class)]
class Referral
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\ManyToOne(inversedBy: 'referrals')]
#[ORM\JoinColumn(nullable: false)]
private ?MemberCase $memberCase = null;
#[ORM\Column(length: 20)]
private ?string $referralId = null;
#[ORM\Column(enumType: ReferralServiceType::class)]
private ?ReferralServiceType $serviceCode = null;
#[ORM\Column]
private ?int $hours = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $endDate = null;
#[ORM\Column(nullable: true, enumType: DischargeReason::class)]
private ?DischargeReason $dischargeReason = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dischargeDate = null;
/**
* @var float $hoursUsed
*/
private float $hoursUsed = 0.0;
/**
* Constructor
*/
public function __construct()
{
$this->hoursUsed = 0.0;
}
public function getId(): ?Uuid
{
return $this->id;
}
public function getMemberCase(): ?MemberCase
{
return $this->memberCase;
}
public function setMemberCase(?MemberCase $memberCase): static
{
$this->memberCase = $memberCase;
return $this;
}
public function getReferralId(): ?string
{
return $this->referralId;
}
public function setReferralId(string $referralId): static
{
$this->referralId = $referralId;
return $this;
}
public function getServiceCode(): ?ReferralServiceType
{
return $this->serviceCode;
}
public function setServiceCode(ReferralServiceType $serviceCode): static
{
$this->serviceCode = $serviceCode;
return $this;
}
public function getHours(): ?int
{
return $this->hours;
}
public function setHours(int $hours): static
{
$this->hours = $hours;
return $this;
}
public function getEndDate(): ?\DateTimeInterface
{
return $this->endDate;
}
public function setEndDate(\DateTimeInterface $endDate): static
{
$this->endDate = $endDate;
return $this;
}
public function getDischargeReason(): ?DischargeReason
{
return $this->dischargeReason;
}
public function setDischargeReason(?DischargeReason $dischargeReason): static
{
$this->dischargeReason = $dischargeReason;
return $this;
}
public function getDischargeDate(): ?\DateTimeInterface
{
return $this->dischargeDate;
}
public function setDischargeDate(?\DateTimeInterface $dischargeDate): static
{
$this->dischargeDate = $dischargeDate;
return $this;
}
public function getHoursRemaining(): float
{
return $this->hours - $this->hoursUsed;
}
public function getHoursUsed(): float
{
return $this->hoursUsed;
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Entity\Case;
use App\Enums\Case\ReferralServiceType;
use App\Repository\Case\StandardNoteRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
#[ORM\Entity(repositoryClass: StandardNoteRepository::class)]
class StandardNote extends Note implements JsonSerializable
{
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $note = null;
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): static
{
$this->note = $note;
return $this;
}
public function jsonSerialize(): array
{
$members = [];
foreach ($this->getMembers() as $member) {
/** @var Member $member */
$members[] = $member->getName();
}
return [
'id' => $this->getId()->toString(),
'date' => $this->getDate()->format('M j, Y'),
'startTime' => $this->getStartTime()->format('g:i a'),
'endTime' => $this->getEndTime()->format('g:i a'),
'serviceCode' => $this->getReferral()->getServiceCode()->value,
'noteType' => ($this->getReferral()->getServiceCode() == ReferralServiceType::VS_THBB ? 'visit' : 'standard'),
'status' => $this->getStatus()->value,
'location' => $this->getLocation()->value,
'method' => ucwords(str_replace('_', ' ', strtolower($this->getMethod()->name))),
'members' => implode(', ', $members),
'duration' => $this->calcTimeUsed(),
];
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Entity\Case;
use App\Repository\Case\StandardNoteMemberRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: StandardNoteMemberRepository::class)]
class StandardNoteMember
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?StandardNote $note = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?Member $person = null;
public function getId(): ?Uuid
{
return $this->id;
}
public function getStandardNote(): ?StandardNote
{
return $this->note;
}
public function setStandardNote(?StandardNote $note): static
{
$this->note = $note;
return $this;
}
public function getPerson(): ?Member
{
return $this->person;
}
public function setPerson(?Member $person): static
{
$this->person = $person;
return $this;
}
}

View File

@@ -0,0 +1,196 @@
<?php
namespace App\Entity\Case;
use App\Enums\Case\ReferralServiceType;
use App\Enums\Case\VisitQualityLevel;
use App\Repository\Case\VisitNoteRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
#[ORM\Entity(repositoryClass: VisitNoteRepository::class)]
class VisitNote extends Note implements JsonSerializable
{
#[ORM\Column(type: Types::TEXT)]
private ?string $narrative = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $strengths = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $issues = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $recommendation = null;
#[ORM\Column(enumType: VisitQualityLevel::class)]
private ?VisitQualityLevel $parentalRole = null;
#[ORM\Column(enumType: VisitQualityLevel::class)]
private ?VisitQualityLevel $childDevelopment = null;
#[ORM\Column(enumType: VisitQualityLevel::class)]
private ?VisitQualityLevel $appropriateResponse = null;
#[ORM\Column(enumType: VisitQualityLevel::class)]
private ?VisitQualityLevel $childAheadOfSelf = null;
#[ORM\Column(enumType: VisitQualityLevel::class)]
private ?VisitQualityLevel $showsEmpathy = null;
#[ORM\Column(enumType: VisitQualityLevel::class)]
private ?VisitQualityLevel $childFocused = null;
public function getNarrative(): ?string
{
return $this->narrative;
}
public function setNarrative(string $narrative): static
{
$this->narrative = $narrative;
return $this;
}
public function getStrengths(): ?string
{
return $this->strengths;
}
public function setStrengths(string $strengths): static
{
$this->strengths = $strengths;
return $this;
}
public function getIssues(): ?string
{
return $this->issues;
}
public function setIssues(string $issues): static
{
$this->issues = $issues;
return $this;
}
public function getRecommendation(): ?string
{
return $this->recommendation;
}
public function setRecommendation(string $recommendation): static
{
$this->recommendation = $recommendation;
return $this;
}
public function getParentalRole(): ?VisitQualityLevel
{
return $this->parentalRole;
}
public function setParentalRole(VisitQualityLevel $parentalRole): static
{
$this->parentalRole = $parentalRole;
return $this;
}
public function getChildDevelopment(): ?VisitQualityLevel
{
return $this->childDevelopment;
}
public function setChildDevelopment(VisitQualityLevel $childDevelopment): static
{
$this->childDevelopment = $childDevelopment;
return $this;
}
public function getAppropriateResponse(): ?VisitQualityLevel
{
return $this->appropriateResponse;
}
public function setAppropriateResponse(VisitQualityLevel $appropriateResponse): static
{
$this->appropriateResponse = $appropriateResponse;
return $this;
}
public function getChildAheadOfSelf(): ?VisitQualityLevel
{
return $this->childAheadOfSelf;
}
public function setChildAheadOfSelf(VisitQualityLevel $childAheadOfSelf): static
{
$this->childAheadOfSelf = $childAheadOfSelf;
return $this;
}
public function getShowsEmpathy(): ?VisitQualityLevel
{
return $this->showsEmpathy;
}
public function setShowsEmpathy(VisitQualityLevel $showsEmpathy): static
{
$this->showsEmpathy = $showsEmpathy;
return $this;
}
public function getChildFocused(): ?VisitQualityLevel
{
return $this->childFocused;
}
public function setChildFocused(VisitQualityLevel $childFocused): static
{
$this->childFocused = $childFocused;
return $this;
}
public function jsonSerialize(): array
{
$members = [];
foreach ($this->getMembers() as $member) {
/** @var Member $member */
$members[] = $member->getName();
}
return [
'id' => $this->getId()->toString(),
'date' => $this->getDate()->format('M j, Y'),
'startTime' => $this->getStartTime()->format('g:i a'),
'endTime' => $this->getEndTime()->format('g:i a'),
'serviceCode' => $this->getReferral()->getServiceCode()->value,
'noteType' => ($this->getReferral()->getServiceCode() == ReferralServiceType::VS_THBB ? 'visit' : 'standard'),
'status' => $this->getStatus()->value,
'location' => $this->getLocation()->value,
'method' => ucwords(str_replace('_', ' ', strtolower($this->getMethod()->name))),
'narrative' => $this->getNarrative(),
'strengths' => $this->getStrengths(),
'issues' => $this->getIssues(),
'recommendation' => $this->getRecommendation(),
'parentalRole' => $this->getParentalRole(),
'childDevelopment' => $this->getChildDevelopment(),
'appropriateResponse' => $this->getAppropriateResponse(),
'childAheadOfSelf' => $this->getChildAheadOfSelf(),
'showsEmpathy' => $this->getShowsEmpathy(),
'childFocused' => $this->getChildFocused(),
'members' => implode(', ', $members),
'duration' => $this->calcTimeUsed(),
];
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Entity\Case;
use App\Repository\Case\VisitNoteMembersRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Types\UuidType;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity(repositoryClass: VisitNoteMembersRepository::class)]
class VisitNoteMembers
{
#[ORM\Id]
#[ORM\Column(type: UuidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private ?Uuid $id = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?VisitNote $note = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?Member $person = null;
public function getId(): ?int
{
return $this->id;
}
public function getVisitNote(): ?VisitNote
{
return $this->note;
}
public function setVisitNote(?VisitNote $note): static
{
$this->note = $note;
return $this;
}
public function getPerson(): ?Member
{
return $this->person;
}
public function setPerson(?Member $person): static
{
$this->person = $person;
return $this;
}
}