Переглянути джерело

환부이미지 전송 api 수정

서용하 6 роки тому
батько
коміт
670e5a1735

+ 1 - 1
MCPlus/Adapter/PhotoCollectionViewAdapter.swift

@@ -54,7 +54,7 @@ extension PhotoCollectionViewAdapter:UICollectionViewDataSource, UICollectionVie
             return cell
         }
         if list[key]?[indexPath.row].isSended == true{
-            cell.album.borderWidth = 1.0
+            cell.album.borderWidth = 3.0
         }else{
             cell.album.borderWidth = 0
         }

+ 5 - 9
MCPlus/Base.lproj/Main.storyboard

@@ -316,14 +316,7 @@
                                         <subviews>
                                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mtS-Sd-L2M">
                                                 <rect key="frame" x="0.0" y="54" width="89.666666666666671" height="36.333333333333343"/>
-                                                <attributedString key="attributedText">
-                                                    <fragment content="내용내용">
-                                                        <attributes>
-                                                            <font key="NSFont" size="15" name="NanumSquareR"/>
-                                                            <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" lineSpacing="3" tighteningFactorForTruncation="0.0"/>
-                                                        </attributes>
-                                                    </fragment>
-                                                </attributedString>
+                                                <attributedString key="attributedText"/>
                                                 <nil key="highlightedColor"/>
                                             </label>
                                         </subviews>
@@ -505,11 +498,14 @@
                         <outlet property="ageGenderLabel" destination="KLU-Vc-9DU" id="9qX-zA-yzR"/>
                         <outlet property="albumButton" destination="944-gk-cQs" id="Zy7-fP-rZ2"/>
                         <outlet property="closeButton" destination="Vnl-oE-eK1" id="nNQ-Om-7nv"/>
+                        <outlet property="deptNmLabel" destination="fKT-hb-N98" id="aZJ-2G-Cuf"/>
+                        <outlet property="doctorNmLabel" destination="1NT-Lz-aBT" id="4Rd-Bd-Q0s"/>
                         <outlet property="finishButton" destination="Wva-cH-tSz" id="8nH-zd-8rW"/>
                         <outlet property="patientIdLabel" destination="4un-kx-8PH" id="g6I-qh-Jwn"/>
                         <outlet property="patientNmLabel" destination="ZS3-lT-QK3" id="SOC-12-WBf"/>
                         <outlet property="previewView" destination="Dat-yv-K6v" id="q4F-iZ-auN"/>
                         <outlet property="takePhoto" destination="yhJ-JG-Awk" id="LEA-ot-2na"/>
+                        <outlet property="treatClsKrLabel" destination="Ecd-Ow-N4X" id="3jc-ZF-Bv1"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="ks9-gJ-jw3" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -1380,7 +1376,7 @@
                                 <rect key="frame" x="0.0" y="44" width="375" height="48"/>
                                 <subviews>
                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="스캔" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tzg-sE-Hgh">
-                                        <rect key="frame" x="171" y="12.999999999999998" width="33" height="22.333333333333329"/>
+                                        <rect key="frame" x="170.33333333333334" y="13.666666666666664" width="34.666666666666657" height="21"/>
                                         <fontDescription key="fontDescription" name="NanumSquareB" family="NanumSquare" pointSize="19"/>
                                         <nil key="textColor"/>
                                         <nil key="highlightedColor"/>

+ 14 - 11
MCPlus/Model/User.swift

@@ -9,15 +9,18 @@
 import Foundation
 
 class User: CustomStringConvertible, Codable {
-    var hospitalCD:String?
-    var patientId:String?
-    var userId:String?
-    var patientNm:String?
-    var age:String?
-    var gender:String?
-    var deptCd:String?
-    var deptNm:String?
-    var doctorId:String?
-    var doctorNm:String?
-    var treatCls:String?
+    var hospitalCD:String? // 병원코드
+    var patientId:String?  //환자번호
+    var userId:String? //로그인유저아이디
+    var patientNm:String? //환자이름
+    var age:String? //환자나이
+    var gender:String? //환자성별
+    var deptCd:String? //진료과코드
+    var deptNm:String? //진료과명
+    var doctorId:String? //진료의 ID
+    var doctorNm:String? //진료의명
+    var treatCls:String? //진료구분코드
+    var treatClsKr:String? //진료구분한글
+    var serviceUrl:String? //환부이미지 API주소
+    var visitDt:String? // 외래 : 진료일자, 입원 : 입원일자
 }

+ 1 - 1
MCPlus/Network/APIClient.swift

@@ -186,7 +186,7 @@ class APIClient: NSObject {
      
      */
     func responseJson(json:DataResponse<Any>){
-        print(json.value)
+        
         self.callBack.value = json.value as? [String:Any]
     }
     

+ 34 - 0
MCPlus/ViewControllers/CustomCameraViewController.swift

@@ -57,6 +57,40 @@ class CustomCameraViewController: UIViewController {
         }
     }
     
+    @IBOutlet weak var deptNmLabel: UILabel!{
+        didSet{
+            PictureViewController.deptNm.signal.observe { [weak deptNmLabel](item) in
+                guard let value = item.value as? String else{ return }
+                let attr = deptNmLabel?.attributedText?.attributes(at: 0, effectiveRange: nil)
+                let attrString = NSMutableAttributedString(string: value, attributes: attr)
+                deptNmLabel?.attributedText = attrString
+            }
+        }
+    }
+    
+    @IBOutlet weak var treatClsKrLabel: UILabel!{
+        didSet{
+            PictureViewController.treatClsKr.signal.observe { [weak treatClsKrLabel](item) in
+                guard let value = item.value as? String else{ return }
+                let attr = treatClsKrLabel?.attributedText?.attributes(at: 0, effectiveRange: nil)
+                let attrString = NSMutableAttributedString(string: value, attributes: attr)
+                treatClsKrLabel?.attributedText = attrString
+            }
+        }
+    }
+    
+    @IBOutlet weak var doctorNmLabel: UILabel!{
+        didSet{
+            PictureViewController.doctorNm.signal.observe { [weak doctorNmLabel](item) in
+                guard let value = item.value as? String else{ return }
+                let attr = doctorNmLabel?.attributedText?.attributes(at: 0, effectiveRange: nil)
+                let attrString = NSMutableAttributedString(string: value, attributes: attr)
+                doctorNmLabel?.attributedText = attrString
+            }
+        }
+    }
+    
+    
     
     var session: AVCaptureSession?
     var stillImageOutput:AVCaptureStillImageOutput{

+ 7 - 11
MCPlus/ViewControllers/PhotoDetailViewController.swift

@@ -103,27 +103,23 @@ extension PhotoDetailViewController:UIScrollViewDelegate{
         param["patientId"] = photo.user?.patientId ?? ""
         param["deptCd"] = photo.user?.deptCd ?? ""
         param["doctorId"] = photo.user?.doctorId ?? ""
-        param["treatCls"] = photo.user?.treatCls ?? ""
+        param["searchCls"] = photo.user?.treatCls ?? ""
+        param["thumbnail"] = ""
         param["excutionDtTm"] = Date().fromString(format: "yyyy-MM-dd hh:mm:ss")
-        
-        var fileParam = [[String:Data]]()
+        param["excutionDtTm"] = photo.user?.visitDt ?? ""
         
         if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {
             //원본 이미지 찾기
             let origin = dir.appendingPathComponent("kunkuk/\(photo.file ?? "")")
             if let data = try? Data(contentsOf: origin){
-                fileParam.append(["image":data])
-            }
-            //썸네일 이미지 찾기
-            let thumb = dir.appendingPathComponent("thumb/\(photo.file ?? "")")
-            if let data = try? Data(contentsOf: thumb){
-                fileParam.append(["thumbnail":data])
+                param["image"] = data.base64EncodedString()
             }
         }
         
-        APIClient("\(MCarePlusConstants.DOMAIN_NAME)\(MCarePlusConstants.APP_NAME)\(Constants.WOUND_IMG_URL).json")
+        let url = "\(MCarePlusConstants.DOMAIN_NAME)/\(photo.user?.serviceUrl ?? "")"
+        APIClient(url)
             .param(reqParam: param)
-            .param(fileParam: fileParam)
+            .enType(.json)
             .connect { [weak self](result:[String:Any]) in
                 
                 //성공일시

+ 11 - 13
MCPlus/ViewControllers/PhotoViewController.swift

@@ -166,31 +166,29 @@ extension PhotoViewController{
         param["patientId"] = photo.user?.patientId ?? ""
         param["deptCd"] = photo.user?.deptCd ?? ""
         param["doctorId"] = photo.user?.doctorId ?? ""
-        param["treatCls"] = photo.user?.treatCls ?? ""
+        param["searchCls"] = photo.user?.treatCls ?? ""
+        param["thumbnail"] = ""
         param["excutionDtTm"] = Date().fromString(format: "yyyy-MM-dd hh:mm:ss")
-        
-        var fileParam = [[String:Data]]()
+        param["excutionDtTm"] = photo.user?.visitDt ?? ""
         
         if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {
             //원본 이미지 찾기
             let origin = dir.appendingPathComponent("kunkuk/\(photo.file ?? "")")
             if let data = try? Data(contentsOf: origin){
-                fileParam.append(["image":data])
-            }
-            //썸네일 이미지 찾기
-            let thumb = dir.appendingPathComponent("thumb/\(photo.file ?? "")")
-            if let data = try? Data(contentsOf: thumb){
-                fileParam.append(["thumbnail":data])
+                param["image"] = data.base64EncodedString()
             }
         }
         
-        APIClient("\(MCarePlusConstants.DOMAIN_NAME)\(MCarePlusConstants.APP_NAME)\(Constants.WOUND_IMG_URL).json")
+        let url = "\(MCarePlusConstants.DOMAIN_NAME)\(photo.user?.serviceUrl ?? "")"
+        
+        APIClient(url)
             .param(reqParam: param)
-            .param(fileParam: fileParam)
+            .enType(.json)
             .connect { [weak self](result:[String:Any]) in
-
+                guard let `result` = result["result"] as? [[String:Any]] else{ return }
+                let returnCd = result.first?["returnCd"] as? String
                 //성공일시
-                if result["returnCd"] as? String == "0000"{
+                if returnCd == "0000"{
                     self?.successCount += 1
                     photo.isSended = true
                     photo.update()

+ 7 - 0
MCPlus/ViewControllers/PictureViewController.swift

@@ -25,6 +25,10 @@ class PictureViewController: UIViewController {
     static var patientId = MutableProperty<String?>(nil)
     static var patientNm = MutableProperty<String?>(nil)
     static var ageGender = MutableProperty<String?>(nil)
+    static var deptNm = MutableProperty<String?>(nil)
+    static var treatClsKr = MutableProperty<String?>(nil)
+    static var doctorNm = MutableProperty<String?>(nil)
+    
 
 }
 
@@ -41,6 +45,9 @@ extension PictureViewController{
         PictureViewController.patientId.value = user?.patientId
         PictureViewController.patientNm.value = user?.patientNm
         PictureViewController.ageGender.value = "\(user?.age ?? "") / \(user?.gender ?? "")"
+        PictureViewController.deptNm.value = user?.deptNm
+        PictureViewController.treatClsKr.value = user?.treatClsKr
+        PictureViewController.doctorNm.value = user?.doctorNm
     }
     
     func scanAction(){

+ 3 - 0
MCPlus/ViewControllers/WebViewController.swift

@@ -455,6 +455,9 @@ extension WebViewController{
             user.doctorId = params["doctorId"]
             user.doctorNm = params["doctorNm"]
             user.treatCls = params["treatCls"]
+            user.treatClsKr = params["treatClsKr"]
+            user.serviceUrl = params["serviceUrl"]
+            user.visitDt = params["visitDt"]
         }
         
         VC.user = user