-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from Semoban/medicalCRUD
feat: 진료기록 정보 화면 관련 기능 구현 완료, 진료기록 생성 화면 null 체크까지 진행중
- Loading branch information
Showing
36 changed files
with
1,613 additions
and
214 deletions.
There are no files selected for viewing
21 changes: 0 additions & 21 deletions
21
app/src/main/java/com/project/meongcare/MedicalRecordAddFragment.kt
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
app/src/main/java/com/project/meongcare/OnPictureChangedListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.project.meongcare | ||
|
||
import android.net.Uri | ||
|
||
interface OnPictureChangedListener { | ||
fun onPictureChanged(uri: Uri) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...va/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemCheckListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...va/com/project/meongcare/medicalrecord/model/data/local/MedicalRecordItemClickListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ain/java/com/project/meongcare/medicalrecord/model/data/local/OnPictureChangedListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.project.meongcare.medicalRecord.model.data.local | ||
|
||
import android.net.Uri | ||
|
||
interface OnPictureChangedListener { | ||
fun onPictureChanged(uri: Uri) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ain/java/com/project/meongcare/medicalrecord/model/data/repository/MedicalRecordModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecord.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.project.meongcare.medicalRecord.model.entities | ||
|
||
data class MedicalRecordDto( | ||
val dogId: Long, | ||
val dateTime: String, | ||
val hospitalName: String, | ||
val doctorName: String, | ||
val note: String, | ||
) |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.project.meongcare.medicalRecord.model.entities | ||
|
||
data class MedicalRecordGet( | ||
val medicalRecordId: Long, | ||
val dateTime: String, | ||
val hospitalName: String, | ||
val doctorName: String, | ||
val note: String, | ||
val imageUrl: String, | ||
) |
2 changes: 1 addition & 1 deletion
2
.../main/java/com/project/meongcare/medicalrecord/model/entities/MedicalRecordGetResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/project/meongcare/medicalrecord/model/entities/RequestMedicalRecord.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.project.meongcare.medicalRecord.model.entities | ||
|
||
import okhttp3.MultipartBody | ||
import okhttp3.RequestBody | ||
|
||
data class RequestMedicalRecord( | ||
val dto: RequestBody, | ||
val file: MultipartBody.Part, | ||
) |
2 changes: 1 addition & 1 deletion
2
app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordDateUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
app/src/main/java/com/project/meongcare/medicalrecord/model/utils/MedicalRecordUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.project.meongcare.medicalRecord.model.utils | ||
|
||
import android.content.Context | ||
import android.net.Uri | ||
import android.view.View | ||
import android.view.inputmethod.InputMethodManager | ||
import com.google.gson.Gson | ||
import com.project.meongcare.medicalRecord.model.entities.MedicalRecordDto | ||
import okhttp3.MediaType.Companion.toMediaTypeOrNull | ||
import okhttp3.MultipartBody | ||
import okhttp3.RequestBody | ||
import okhttp3.RequestBody.Companion.asRequestBody | ||
import okhttp3.RequestBody.Companion.toRequestBody | ||
import java.io.File | ||
import java.time.LocalDateTime | ||
import java.time.format.DateTimeFormatter | ||
import java.util.Locale | ||
|
||
class MedicalRecordUtils { | ||
companion object { | ||
fun convertMDateToSimpleDate(localMili: String): String { | ||
val inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss") | ||
val dateTime = LocalDateTime.parse(localMili, inputFormatter) | ||
|
||
val outputFormatter = DateTimeFormatter.ofPattern("yyyy년 M월 d일", Locale.getDefault()) | ||
return dateTime.format(outputFormatter) | ||
} | ||
|
||
fun convertMDateToSimpleTime(localMili: String): String { | ||
val inputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss") | ||
val dateTime = LocalDateTime.parse(localMili, inputFormatter) | ||
|
||
val outputFormatter = DateTimeFormatter.ofPattern("a hh:mm", Locale.getDefault()) | ||
return dateTime.format(outputFormatter) | ||
} | ||
|
||
fun convertMedicalRecordDto(medicalRecordDto: MedicalRecordDto): RequestBody { | ||
val json = Gson().toJson(medicalRecordDto) | ||
return json.toRequestBody("application/json; charset=utf-8".toMediaTypeOrNull()) | ||
} | ||
|
||
fun convertPictureToFile( | ||
context: Context, | ||
uri: Uri, | ||
): MultipartBody.Part { | ||
if (uri.toString().isEmpty()) { | ||
val emptyFile = "".toRequestBody("multipart/form-data".toMediaTypeOrNull()) | ||
return MultipartBody.Part.createFormData("file", "", emptyFile) | ||
} | ||
|
||
val inputStream = context.contentResolver.openInputStream(uri) | ||
val file = File(context.cacheDir, "tempFile") | ||
inputStream.use { input -> | ||
file.outputStream().use { output -> | ||
input?.copyTo(output) | ||
} | ||
} | ||
val requestFile = file.asRequestBody("multipart/form-data".toMediaTypeOrNull()) | ||
|
||
return MultipartBody.Part.createFormData("file", file.name, requestFile) | ||
} | ||
|
||
fun hideKeyboard(view: View) { | ||
val inputMethodManager = | ||
view.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | ||
inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) | ||
} | ||
} | ||
} |
Oops, something went wrong.