diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-17 11:15:54 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-17 11:15:54 +0700 |
commit | c5d36593cc14bfdfb7b8f06d680ad6fc2eb6dde0 (patch) | |
tree | 485fc8a1c7ac8e7a9dd8fc8ed5308dba185fb6ca /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala | |
parent | f3b809659969ee29ab7f0a62ec1cff25a3e263dc (diff) | |
parent | a0599ae4d12acafb934b40f52d4a771709b3e583 (diff) | |
download | rest-query-c5d36593cc14bfdfb7b8f06d680ad6fc2eb6dde0.tar.gz rest-query-c5d36593cc14bfdfb7b8f06d680ad6fc2eb6dde0.tar.bz2 rest-query-c5d36593cc14bfdfb7b8f06d680ad6fc2eb6dde0.zip |
Merge pull request #47 from drivergroup/PDSUI-2318v0.8.8
PDSUI-2318 Created custom swagger format for TM
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala deleted file mode 100644 index 0ff0c3b..0000000 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordGen.scala +++ /dev/null @@ -1,131 +0,0 @@ -package xyz.driver.pdsuidomain.fakes.entities.rep - -import xyz.driver.pdsuidomain.entities._ -import xyz.driver.core.generators -import xyz.driver.core.generators._ -import xyz.driver.pdsuicommon.domain.{LongId, TextJson, User} -import xyz.driver.pdsuidomain.fakes.entities.common._ - -object MedicalRecordGen { - private val maxItemsInCollectionNumber: Int = 50 - - private val pageMaxNumber: Int = 1000 - - private val medicalRecordMetas: Set[() => MedicalRecord.Meta] = { - Set( - () => nextMedicalRecordMetaReorder(), - () => nextMedicalRecordMetaDuplicate(), - () => nextMedicalRecordMetaRotation() - ) - } - - def nextMedicalRecordMetas(count: Int): List[MedicalRecord.Meta] = - List.fill(count)(nextMedicalRecordMeta()) - - def nextMedicalRecordMetasJson(): TextJson[List[MedicalRecord.Meta]] = - TextJson(nextMedicalRecordMetas(nextInt(maxItemsInCollectionNumber, minValue = 0))) - - private def nextDocument(): Document = - DocumentGen.nextDocument() - - private def nextDocuments(count: Int): List[Document] = - List.fill(count)(nextDocument()) - - def nextDocuments(recordId: LongId[MedicalRecord]): TextJson[List[Document]] = { - val documents = nextDocuments( - nextInt(maxItemsInCollectionNumber, minValue = 0) - ) - - TextJson(documents.map(_.copy(recordId = recordId))) - } - - def nextMedicalRecordStatus(): MedicalRecord.Status = - MedicalRecord.Status.New - - def nextMedicalRecordHistoryState(): MedicalRecordHistory.State = - generators.oneOf[MedicalRecordHistory.State](MedicalRecordHistory.State.All) - - def nextMedicalRecordHistoryAction(): MedicalRecordHistory.Action = - generators.oneOf[MedicalRecordHistory.Action](MedicalRecordHistory.Action.All) - - def nextMedicalRecordMetaReorder(): MedicalRecord.Meta.Reorder = { - val itemsNumber = maxItemsInCollectionNumber - val items = scala.util.Random.shuffle(Seq.tabulate(itemsNumber)(identity)) - - MedicalRecord.Meta.Reorder(items) - } - - def nextMedicalRecordMetaDuplicate(): MedicalRecord.Meta.Duplicate = { - val startPageGen = - nextInt(pageMaxNumber, minValue = 0) - val endPageGen = - nextInt(pageMaxNumber, startPageGen) - - MedicalRecord.Meta.Duplicate( - startPage = startPageGen.toDouble, - endPage = endPageGen.toDouble, - startOriginalPage = startPageGen.toDouble, - endOriginalPage = nextOption(endPageGen.toDouble) - ) - } - - def nextMedicalRecordMetaRotation(): MedicalRecord.Meta.Rotation = { - val items = Array.tabulate(maxItemsInCollectionNumber)(index => nextString() -> index).toMap - - MedicalRecord.Meta.Rotation(items = items) - } - - def nextMedicalRecordMeta(): MedicalRecord.Meta = { - generators.oneOf(medicalRecordMetas)() - } - - def nextMedicalRecord(): MedicalRecord = { - MedicalRecord( - id = nextLongId[MedicalRecord], - status = nextMedicalRecordStatus(), - previousStatus = None, - assignee = nextOption(nextStringId), - previousAssignee = nextOption(nextStringId), - lastActiveUserId = nextOption(nextStringId), - patientId = nextUuidId, - requestId = RecordRequestId(generators.nextUuid()), - disease = generators.nextString(), - caseId = nextOption(CaseId(generators.nextString())), - physician = nextOption(generators.nextString()), - meta = nextOption(nextMedicalRecordMetasJson()), - lastUpdate = nextLocalDateTime, - totalPages = nextInt(10) - ) - } - - def nextMedicalRecordHistory(): MedicalRecordHistory = { - MedicalRecordHistory( - id = nextLongId[MedicalRecordHistory], - executor = nextStringId[User], - recordId = nextLongId[MedicalRecord], - state = nextMedicalRecordHistoryState(), - action = nextMedicalRecordHistoryAction(), - created = nextLocalDateTime - ) - } - - def nextMedicalRecordIssue(): MedicalRecordIssue = { - val pages = nextStartAndEndPages - - MedicalRecordIssue( - id = nextLongId[MedicalRecordIssue], - userId = nextStringId[User], - recordId = nextLongId[MedicalRecord], - startPage = pages._1, - endPage = pages._2, - lastUpdate = nextLocalDateTime, - isDraft = nextBoolean(), - text = nextString(), - archiveRequired = nextBoolean() - ) - } - - def nextProviderType(): ProviderType = - generators.oneOf(ProviderType.All: _*) - -} |