|  | @@ -25,7 +25,6 @@ import thyyxxk.webserver.config.envionment.CaData;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.config.exception.BizException;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.config.exception.ExceptionEnum;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.constants.YesOrNo;
 | 
	
		
			
				|  |  | -import thyyxxk.webserver.dao.his.ca.EmrCaSignDao;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.dao.his.zhuyuanyisheng.emr.EmrPatientDao;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.ResultVo;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.ca.*;
 | 
	
	
		
			
				|  | @@ -50,12 +49,9 @@ public class CaServer implements Assertion {
 | 
	
		
			
				|  |  |      private final String SUCCRSS = "success";
 | 
	
		
			
				|  |  |      private final RedisLikeService redisLikeService;
 | 
	
		
			
				|  |  |      private final EmrServer emrServer;
 | 
	
		
			
				|  |  | -    private final EmrPatientDao dao;
 | 
	
		
			
				|  |  |      private final RedisServer redisServer;
 | 
	
		
			
				|  |  | -    private final EmrCaSignDao emrCaSignDao;
 | 
	
		
			
				|  |  |      private final EmrPatientDao emrPatientDao;
 | 
	
		
			
				|  |  | -    private final Archive archive;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +    private final String archivePath;
 | 
	
		
			
				|  |  |      private final static String privateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKAc+jzqVKHsjNdyuDGL7u6zZR55j87l+0GGT4/yEV+K8ZtL1GoIgOD6vv6eEg2iOwl6Wh6hq8XR4cIyzVyvMZ35dIw3oGN89ObtuCha7gLOmWYUIGVnkUBkLFeIdwe4F8bq1q15o7azsTVekSyNJf/wnxWMp8ibtvO41T8DIzZPAgMBAAECgYAeeLVVD4Gw2VyKij4sy8Var1CQxrDMPu+c7ktJCVguFzrZA8r2rQyeBIqB2aJ07smOibcJ+lm/Ca0N8O4tc/gcm4g/JsjBALFUmqyCkLQpRyIbz8V9uAmrLcchT74GS727Uv4KVTmQNDZTPIDdSZWSJ8S+WKmj8q3wUF1HLF1eXQJBAOC7D6xIB2XNS6Voa7C7m8aeg53lfcDUVJ6m0YFdvMbsU2cnlxnCSX1OsghFuVQLKcGeN+aXiTEileb3pAl2RC0CQQC2ZDtDb+1OmLmRNugp29Pmm8MM8KpktfqiBFi92Q747XwEeMgLi3qetq1wDT4dgvyURs2McsbF7diVtFv7DMXrAkAoYzXj3mYF86k+ps+DyZOrVF2PCOlauE4k3RIVz8TXcy1iAolzRalzbastNWqjIgZ1F3wwYtdzDyYlhifi03BZAkEArkgidPMbwDGhiAf+WhkrZz1JaTECsM9PGcergGVLsENFcQR0qstxtPz7x4lv5EVI0urA+Man93OptIsuJTr0VwJAd86EbHyOn5Lah7ptPGsmsqkrdMZcJ3chRj6pDtvb0A2lhaJfDRxmAiWCnviPhTApH6/1WRzBqc1ZTymyRTF9kA==";
 | 
	
		
			
				|  |  |      private final static String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgHPo86lSh7IzXcrgxi+7us2UeeY/O5ftBhk+P8hFfivGbS9RqCIDg+r7+nhINojsJeloeoavF0eHCMs1crzGd+XSMN6BjfPTm7bgoWu4CzplmFCBlZ5FAZCxXiHcHuBfG6tateaO2s7E1XpEsjSX/8J8VjKfIm7bzuNU/AyM2TwIDAQAB";
 | 
	
		
			
				|  |  |      RSA idCardRsa = new RSA(privateKey, publicKey);
 | 
	
	
		
			
				|  | @@ -64,15 +60,19 @@ public class CaServer implements Assertion {
 | 
	
		
			
				|  |  |          return "ca-emr-" + documentId;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public CaServer(CaData caData, RedisLikeService redisLikeService, EmrServer emrServer, EmrPatientDao dao, RedisServer redisServer, EmrCaSignDao emrCaSignDao, EmrPatientDao emrPatientDao, Archive archive) {
 | 
	
		
			
				|  |  | +    public CaServer(CaData caData,
 | 
	
		
			
				|  |  | +                    RedisLikeService redisLikeService,
 | 
	
		
			
				|  |  | +                    EmrServer emrServer,
 | 
	
		
			
				|  |  | +                    RedisServer redisServer,
 | 
	
		
			
				|  |  | +                    EmrPatientDao emrPatientDao,
 | 
	
		
			
				|  |  | +                    Archive archive) {
 | 
	
		
			
				|  |  |          this.caData = caData;
 | 
	
		
			
				|  |  |          this.redisLikeService = redisLikeService;
 | 
	
		
			
				|  |  |          this.emrServer = emrServer;
 | 
	
		
			
				|  |  | -        this.dao = dao;
 | 
	
		
			
				|  |  |          this.redisServer = redisServer;
 | 
	
		
			
				|  |  | -        this.emrCaSignDao = emrCaSignDao;
 | 
	
		
			
				|  |  |          this.emrPatientDao = emrPatientDao;
 | 
	
		
			
				|  |  | -        this.archive = archive;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        archivePath = archive.getPath() + "/emr";
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public List<CaReturn.CaData> sendBatchByCode(CaSignClass.Send send) {
 | 
	
	
		
			
				|  | @@ -256,9 +256,9 @@ public class CaServer implements Assertion {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private void verifyMedicalRecordStatus(String documentId, EmrSignType type) {
 | 
	
		
			
				|  |  |          EmrPatientData emrData = emrPatientDao.selectById(documentId);
 | 
	
		
			
				|  |  | -//        if (emrData == null || emrData.getDelFlag() == 1) {
 | 
	
		
			
				|  |  | -//            throw new BizException(ExceptionEnum.LOGICAL_ERROR, "病历已被删除。");
 | 
	
		
			
				|  |  | -//        }
 | 
	
		
			
				|  |  | +        if (emrData == null || emrData.getDelFlag() == 1) {
 | 
	
		
			
				|  |  | +            throw new BizException(ExceptionEnum.LOGICAL_ERROR, "病历已被删除。");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          isTrueErr(emrData.getSignComplete(), "签名流程已完成请勿重复点击");
 | 
	
		
			
				|  |  |          if (emrData.getSignType() != null && !Objects.equals(type.getCode(), emrData.getSignType())) {
 | 
	
		
			
				|  |  |              throw new BizException(ExceptionEnum.LOGICAL_ERROR, "请使用上次选择的方式完成CA流程中途不得修改。");
 | 
	
	
		
			
				|  | @@ -681,21 +681,21 @@ public class CaServer implements Assertion {
 | 
	
		
			
				|  |  |      public String uploadBase64(CaSignClass.Upload upload) {
 | 
	
		
			
				|  |  |          byte[] file = Base64.decode(upload.getFile());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        String tmpPath = "/emr" + "/" + upload.getPatNo()
 | 
	
		
			
				|  |  | +        String tmpPath = "/" + upload.getPatNo()
 | 
	
		
			
				|  |  |                  + "/" + upload.getTimes()
 | 
	
		
			
				|  |  |                  + "/" + upload.getFileName();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String pdfPath = tmpPath + ".pdf";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        String caPath = "/emr" + "/" + upload.getPatNo()
 | 
	
		
			
				|  |  | +        String caPath = "/" + upload.getPatNo()
 | 
	
		
			
				|  |  |                  + "/" + upload.getTimes()
 | 
	
		
			
				|  |  |                  + "/ca/" + upload.getFileName()
 | 
	
		
			
				|  |  |                  + ".txt";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          // 写入CA数据
 | 
	
		
			
				|  |  | -        FileUtil.writeString(upload.getCaData(), archive.getPath() + caPath, StandardCharsets.UTF_8);
 | 
	
		
			
				|  |  | +        FileUtil.writeString(upload.getCaData(), archivePath + caPath, StandardCharsets.UTF_8);
 | 
	
		
			
				|  |  |          // 写入pdf
 | 
	
		
			
				|  |  | -        FileUtil.writeBytes(file, archive.getPath() + pdfPath);
 | 
	
		
			
				|  |  | +        FileUtil.writeBytes(file, archivePath + pdfPath);
 | 
	
		
			
				|  |  |          return "/archive" + pdfPath;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |