package com.example.smart119

object MedicalInfo {
    private val prtcodeMap = mutableMapOf<String, String>() // 진료과 목록용 맵
    private val emogemdvMap = mutableMapOf<String, String>() // 의료기관 목록용 맵
    private val addressQZMap = mutableMapOf<String, String>() // QZ 분류용 맵
    private val prtGroupMap = mutableMapOf<String, MutableList<String>>() // 진료과 리스트 맵

    fun init() {
        prtcode_init()
        emogemdv_init()
        address_qz_init();
        prtGroupMap_init();
    }
    private fun prtcode_init() {
        prtcodeMap.put("가정의학과", "D022")
        prtcodeMap.put("결핵과", "D015")
        prtcodeMap.put("구강내과", "D040")
        prtcodeMap.put("구강병리과", "D042")
        prtcodeMap.put("구강악안면방사선과", "D041")
        prtcodeMap.put("구강악안면외과", "D034")
        prtcodeMap.put("구강안면외과", "D054")
        prtcodeMap.put("내과", "D001")
        prtcodeMap.put("마취통증의학과", "D017")
        prtcodeMap.put("방사선종양학과", "D031")
        prtcodeMap.put("병리과", "D032")
        prtcodeMap.put("비뇨의학과", "D014")
        prtcodeMap.put("사상체질과", "D050")
        prtcodeMap.put("산부인과", "D011")
        prtcodeMap.put("산업의학과", "D025")
        prtcodeMap.put("성형외과", "D010")
        prtcodeMap.put("소아청소년과", "D002")
        prtcodeMap.put("소아치과", "D037")
        prtcodeMap.put("신경과", "D003")
        prtcodeMap.put("신경외과", "D009")
        prtcodeMap.put("심장혈관흉부외과", "D007")
        prtcodeMap.put("안과", "D012")
        prtcodeMap.put("영상의학과", "D018")
        prtcodeMap.put("영상치의학과", "D055")
        prtcodeMap.put("예방의학과", "D029")
        prtcodeMap.put("예방치과", "D043")
        prtcodeMap.put("외과", "D006")
        prtcodeMap.put("응급의학과", "D024")
        prtcodeMap.put("이비인후과", "D013")
        prtcodeMap.put("작업환경의학과", "D053")
        prtcodeMap.put("재활의학과", "D016")
        prtcodeMap.put("정신건강의학과", "D004")
        prtcodeMap.put("정형외과", "D008")
        prtcodeMap.put("진단검사의학과", "D033")
        prtcodeMap.put("치과", "D026")
        prtcodeMap.put("치과교정과", "D036")
        prtcodeMap.put("치과보존과", "D039")
        prtcodeMap.put("치과보철과", "D035")
        prtcodeMap.put("치료방사선과", "D019")
        prtcodeMap.put("치주과", "D038")
        prtcodeMap.put("침구과", "D051")
        prtcodeMap.put("통합치의학과", "D056")
        prtcodeMap.put("피부과", "D005")
        prtcodeMap.put("한방내과", "D044")
        prtcodeMap.put("한방부인과", "D045")
        prtcodeMap.put("한방소아과", "D046")
        prtcodeMap.put("한방신경정신과", "D048")
        prtcodeMap.put("한방안이비인후피부과", "D047")
        prtcodeMap.put("한방응급과", "D052")
        prtcodeMap.put("한방재활의학과", "D049")
        prtcodeMap.put("해부병리과", "D021")
        prtcodeMap.put("핵의학과", "D023")
    }
    private fun emogemdv_init() {
        emogemdvMap.put("상급종합병원", "001")
        emogemdvMap.put("종합병원", "011")
        emogemdvMap.put("병원", "021")
        emogemdvMap.put("요양병원", "028")
        emogemdvMap.put("의원", "031")
        emogemdvMap.put("치과병원", "041")
        emogemdvMap.put("치과의원", "051")
        emogemdvMap.put("보건소", "071")
        emogemdvMap.put("보건지소", "072")
        emogemdvMap.put("보건진료소", "073")
        emogemdvMap.put("보건의료원", "075")
        emogemdvMap.put("한방병원", "092")
        emogemdvMap.put("한의원", "093")
    }
    private fun address_qz_init() { // 주소검색 시 병원 분류 코드
        addressQZMap.put("종합병원", "A")
        addressQZMap.put("병원", "B")
        addressQZMap.put("의원", "C")
        addressQZMap.put("요양병원", "D")
        addressQZMap.put("한방병원", "E")
        addressQZMap.put("한의원", "G")
        addressQZMap.put("기타", "I")
        addressQZMap.put("치과병원", "M")
        addressQZMap.put("치과의원", "N")
        addressQZMap.put("보건소", "R")
        addressQZMap.put("기타(구급차)", "W")
    }

    private fun prtGroupMap_init() {
        prtGroupMap.put(
            "🚨 응급 및 외상 치료",
            mutableListOf("응급의학과", "외과", "신경외과", "심장혈관흉부외과")
        )

        prtGroupMap.put(
            "🏥 내과 및 심장 관련",
            mutableListOf("내과", "심장내과", "결핵과", "예방의학과", "산업의학과", "작업환경의학과")
        )

        prtGroupMap.put(
            "🦴 골절 및 재활",
            mutableListOf("정형외과", "재활의학과", "한방재활의학과")
        )

        prtGroupMap.put(
            "💊 마취 및 통증 관리",
            mutableListOf("마취통증의학과")
        )

        prtGroupMap.put(
            "👶 소아 및 여성 건강",
            mutableListOf("소아청소년과", "산부인과", "한방소아과", "한방부인과")
        )

        prtGroupMap.put(
            "🦷 치과 계열",
            mutableListOf(
                "치과", "구강내과", "구강병리과", "구강악안면방사선과", "구강악안면외과",
                "소아치과", "치과교정과", "치과보존과", "치과보철과", "치주과",
                "영상치의학과", "예방치과", "통합치의학과"
            )
        )

        prtGroupMap.put(
            "🧠 신경 및 정신 건강",
            mutableListOf("신경과", "정신건강의학과", "한방신경정신과")
        )

        prtGroupMap.put(
            "👂 이비인후과 및 안과",
            mutableListOf("이비인후과", "안과", "한방안이비인후피부과")
        )

        prtGroupMap.put(
            "📡 방사선 및 영상의학",
            mutableListOf("영상의학과", "치료방사선과", "방사선종양학과", "핵의학과")
        )

        prtGroupMap.put(
            "🩺 병리 및 진단의학",
            mutableListOf("병리과", "해부병리과", "진단검사의학과")
        )

        prtGroupMap.put(
            "🩸 비뇨 및 피부과",
            mutableListOf("비뇨의학과", "피부과")
        )

        prtGroupMap.put(
            "🌿 한방 계열",
            mutableListOf(
                "한방내과", "한방부인과", "한방소아과", "한방신경정신과", "한방안이비인후피부과",
                "한방응급과", "한방재활의학과", "침구과", "사상체질과"
            )
        )
    }

    fun get_prt_code(prtName:String):String? {
        return prtcodeMap.get(prtName)
    }
    fun get_emogemdv_code(emogemdvName:String):String? {
        return emogemdvMap.get(emogemdvName)
    }
    fun get_addressQZ_code(qzName:String):String? {
        return addressQZMap.get(qzName)
    }

    fun get_prt_list():MutableList<String> {
        var returnList:MutableList<String> = mutableListOf()
        prtcodeMap.forEach { key, value ->
            returnList.add(key)
        }
        return returnList
    }
    fun get_emogemdv_list():MutableList<String> {
        var returnList:MutableList<String> = mutableListOf()
        emogemdvMap.forEach { key, value ->
            returnList.add(key)
        }
        return returnList
    }
    fun get_addressQZ_list():MutableList<String> {
        var returnList:MutableList<String> = mutableListOf()
        addressQZMap.forEach { key, value ->
            returnList.add(key)
        }
        return returnList
    }

    fun get_prt_group_map():MutableMap<String, MutableList<String>> {
        return prtGroupMap;
    }

    /* //region 사용 예
    val prtCode = MedicalInfo.get_prt_code("신경외과")
    val emoCode = MedicalInfo.get_emogemdv_code("병원")
    println("신경외과:${prtCode}, 병원:${emoCode}")

    val getPRTList = MedicalInfo.get_prt_list()
    getPRTList.forEach { prtName ->
        println(prtName)
    }
    println("aaaaaaaaaaaaaaaa")
    val getEMOList = MedicalInfo.get_emogemdv_list()
    getEMOList.forEach { emoName ->
        println(emoName)
    }
    */ // endregion
}
