1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- package com.yihu.ehr.service.patient;
- import com.yihu.ehr.common.config.SysConfig;
- import com.yihu.ehr.model.Patient;
- import java.util.UUID;
- /**
- * 病人文件索引类,用于生成文件路径,不确保文件路径存在
- *
- * @author Air
- * @version 1.0
- * @created 2015.07.01 18:06
- */
- public class PatientCDAIndex {
- private Patient patient;
- public PatientCDAIndex(Patient patient) {
- this.patient = patient;
- }
- public String getDirectory() {
- String dir = SysConfig.getInstance().getTempFile();
- return dir + "/" + patient.getOrgCode() + "/" + patient.getOrgCode() + "-" + patient.getPatientId() + "-" + patient.getEventNo();
- }
- /**
- * 生成病人档案目录
- * orgCode-pateintId-eventNo/data
- *
- * @return
- */
- public String getDataDirectory() {
- return getDirectory() + "/" + IndexType.DATA;
- }
- public String createIndex(String indexType, String fileType) {
- UUID uuid = UUID.randomUUID();
- String index = uuid.toString();
- String dir = getDirectory() + "/" + indexType;
- return dir + "/" + index + fileType;
- }
- public String createDataSetIndex(String indexType, String fileType) {
- UUID uuid = UUID.randomUUID();
- String index = "dataset_index";
- String dir = getDirectory() + "/" + IndexType.DATA + "/" +indexType;
- return dir + "/" + index + fileType;
- }
- /**
- * 生成最终病人档案目录
- * data/cda
- * data/origin
- * data/standard
- *
- * @param indexType
- * @param fileType
- * @return
- */
- public String createDataIndex(String indexType, String fileType) {
- return createIndex(IndexType.DATA + "/" + indexType, fileType);
- }
- public class FileType {
- public final static String XML = ".xml";
- public final static String JSON = ".json";
- public final static String ZIP = ".zip";
- }
- public class IndexType {
- public final static String DATA = "data"; //病人档案数据目录
- public final static String CDA = "cda"; //病人cda档案目录
- public final static String STANDARD = "standard"; //病人标准档案目录
- public final static String ORIGIN = "origin"; //病人原始档案目录
- public final static String ZIP = "zip"; //病人压缩包目录
- public final static String DOCUMENT = "document";
- }
- }
|