ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 장기요양 급여제공계획서 list 자동화 프로그램
    전공/자동화 프로그램 2020. 9. 15. 23:41

    사회복지사 실습을 나가서 배운게 코딩이라 코딩하고 왔당 ㅎㅎ

     

    원래 미션은 인쇄 문서를 보고 한글 문서로 그대로 타이핑하는 일인데 

    어르신 마다 제공되어야 하는 서비스가 다르고(예를 들어 김어르신은 양치질하기, 박어르신은 병원 다녀오기 등)

    시간, 횟수까지 모두 달라서 @.@

    단순히 타이핑 하는 작업임에도 불구하고 횟수 제대로 썼나 여러번 확인해야하고 예전 문서를 갖다쓰기도 힘들었다 ㅠㅠ 

     

    그래서 건강보험공단에서 엑셀 파일 다운 받고 

    여기 프로그램에 파일 넣으면 형식에 맞게 출력되는 프로그램 만들었당 ㅎㅎ 

     

    기존 업무가 20분 정도 걸렸다면 이걸로 하면 1초도 안되서 정리 끝남ㅎㅎ (물론 output이 엑셀 파일로 나와서 다시 한글에 붙여넣어야함. 붙여넣는 시간까지 하면 그래도 1분?)

     

    사회복지사 선생님들 업무가 현장업무와  행정업무  모두 하셔야하는데 

    이 프로그램으로 삶의 질이 향상되셨으면 좋겠당//

    감사 감사!!

     

    import sys,os
    from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout, QLabel, QProgressBar, QMessageBox
    from PyQt5 import QtCore
    from PyQt5.QtGui import QIcon
    from PyQt5.QtCore import QBasicTimer
    from PyQt5.QtCore import QCoreApplication
    
    import openpyxl
    import pandas as pd
    import time
    
    def listprog(path):
        wb = openpyxl.load_workbook(path)
        # ws = wb['장기요양 급여제공계획서 통보 LIST']
        ws = wb.active
    
        endRow = ws.max_row
        endCol = ws.max_column
    
        df = pd.DataFrame(columns=['세부','주기','시간'])    
        tmpstr=""
        for j in range(2, endRow):
            if ws.cell(j, 4).value == "1":
                tmpstr = tmpstr + ws.cell(j, 5).value + ", "
    
                str_sebu = ws.cell(j, 6).value
                if str(ws.cell(j, 9).value).isdigit() == True: 
                    str_often = ws.cell(j, 8).value + " " + str(ws.cell(j, 9).value) + "회"
                else: 
                    str_often = ws.cell(j, 8).value
                str_min = ws.cell(j, 10).value
    
                df = df.append(pd.DataFrame([[str_sebu, str_often, str_min]], columns=['세부','주기','시간']), ignore_index=True)
        #         df = df.append(pd.DataFrame([[j,str_sebu, str_often, str_min]], columns=['idx', '세부','주기','시간']), ignore_index=True)
        
        df = df.append(pd.DataFrame([[tmpstr[:len(tmpstr)-2]]], columns=['세부']), ignore_index=True)    
        df.to_excel('result_'+time.strftime('%m%d', time.localtime(time.time()))+'_'+time.strftime('%H%M', time.localtime(time.time()))+'.xlsx')    
    
    # for row in ws.rows:
    #     if row[3].value == "1":
    #         tmpstr = tmpstr + row[5].value + ", "
    
    class MyApp(QWidget):
    
        def __init__(self):
            super().__init__()
            self.setAcceptDrops(True)
            self.initUI()
    
        def initUI(self):        
            # label 
            label = QLabel('장기요양 급여제공계획서 통보 LIST 파일을 올려주세요', self)
            label.setAlignment(QtCore.Qt.AlignCenter)
            font = label.font()
            font.setPointSize(13)
            label.setFont(font)        
            layout = QVBoxLayout()
            layout.addWidget(label)
            self.setLayout(layout)
            # Title
            self.setWindowTitle('업무수행일지 - 자동화 프로그램')
            self.setWindowIcon(QIcon('quokka.ico'))
            
            self.setGeometry(300, 300, 300, 200)
            self.show()
                
        def dragEnterEvent(self, event):
    #         print("dragEnter")
            if event.mimeData().hasUrls():
                event.accept()
            else:
                event.ignore()
     
        def dragMoveEvent(self, event):
            if event.mimeData().hasUrls:
    #             print("dragMove")
                event.accept()
            else:
                event.ignore()
    
        def dropEvent(self, event):
    #             print("Drop")        
            for url in event.mimeData().urls():
                path = url.toLocalFile()
                if os.path.isfile(path):
                    print(path)
                    listprog(path)
                    reply = QMessageBox.about(self, 'Message', '완료')
                    if reply == None:
                        self.close()
    
        
    if __name__ == '__main__':
        app = QApplication(sys.argv)
        ex = MyApp()
        sys.exit(app.exec_())
    

     

     

    댓글