1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //
- // Test3ViewController.swift
- // MCPlus
- //
- // Created by seo ha on 30/01/2019.
- // Copyright © 2019 KangSH. All rights reserved.
- //
- import UIKit
- import Photos
- import ReactiveCocoa
- import ReactiveSwift
- class PictureViewController: UIViewController {
- @objc var callBack:(([String:String])->Void)?
-
- var user:User?
-
- @IBOutlet weak var cameraContainer: UIView!
-
- @IBOutlet weak var gallaryContainer: UIView!
-
-
- 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)
- static var titles = MutableProperty<String?>(nil)
-
- }
- extension PictureViewController{
- override func viewDidLoad() {
- super.viewDidLoad()
-
- self.navigationController?.isNavigationBarHidden = true
- // if let testData = "{\"hospitalCD\":\"1000001\",\"patientId\":\"김길동\",\"userId\":\"20\",\"patientNm\":\"M\",\"age\":\"M\",\"gender\":\"M\",\"deptCd\":\"M\",\"deptNm\":\"M\",\"doctorId\":\"M\",\"doctorNm\":\"M\",\"treatCls\":\"M\"}".data(using: .utf8){
- // user = try? JSONDecoder().decode(User.self, from: testData)
- // print(user)
- // }
-
- 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
- PictureViewController.titles.value = "\(Date().fromString(format: "yyyy-MM-dd")) \(user?.treatClsKr ?? "") \(user?.deptNm ?? "")"
- }
-
- func scanAction(){
- let alert = UIAlertController(title: "선택하세요", message: "", preferredStyle: .actionSheet)
- alert.addAction(UIAlertAction(title: "카메라", style: .default, handler: self.cameraAction))
- alert.addAction(UIAlertAction(title: "갤러리", style: .default, handler: self.gallaryAction))
-
- // show action sheet
- if let popoverController = alert.popoverPresentationController {
- popoverController.sourceView = self.view
- popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)
- popoverController.permittedArrowDirections = []
- }
-
- self.present(alert, animated: true, completion: nil)
- }
-
- //커스텀 카메라 호출
- func cameraAction(action:UIAlertAction?){
- self.cameraContainer.isHidden = false
- self.gallaryContainer.isHidden = true
- }
-
- //포토 갤러리 호출
- func gallaryAction(action:UIAlertAction?){
- self.cameraContainer.isHidden = true
- self.gallaryContainer.isHidden = false
- }
-
-
- }
|