Java tutorial
/* * Copyright (C) 2014 S&I Co.,Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (C) 2001-2014 OpenDolphin Lab., Life Sciences Computing, Corp. * 825 Sylk BLDG., 1-Yamashita-Cho, Naka-Ku, Kanagawa-Ken, Yokohama-City, JAPAN. * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation; either version 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program; * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307 USA. * * (R)OpenDolphin version 2.4, Copyright (C) 2001-2014 OpenDolphin Lab., Life Sciences Computing, Corp. * (R)OpenDolphin comes with ABSOLUTELY NO WARRANTY; for details see the GNU General * Public License, version 3 (GPLv3) This is free software, and you are welcome to redistribute * it under certain conditions; see the GPLv3 for details. */ package open.dolphin.infomodel; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; /** * ???CLAIM?????? * * @author Minagawa,Kazushi. Digital Globe, Inc. * @author modified Chikara Fujihira <fujihirach@sandi.co.jp>, S&I Co.,Ltd. */ @JsonIgnoreProperties(ignoreUnknown = true) public class DocInfoModel extends InfoModel implements Comparable, java.io.Serializable { // = DocumentModel.id @Transient private long docPk; // = DocumentModel.id @Transient private long parentPk; // 32bit GUID (MML ouput) @Column(nullable = false, length = 32) private String docId; // (Dolphin @Column(nullable = false) private String docType; // @Column(nullable = false) private String title; // ? MML @Column(nullable = false) private String purpose; // ? MML @Transient private String purposeDesc; // ? MML @Transient private String purposeCodeSys; // = DocumentModel.started?? @Transient private Date firstConfirmDate; // @Transient private Date confirmDate; // private String department; // // ????????JMARI? private String departmentDesc; // @Transient private String departmentCodeSys; // ?? private String healthInsurance; // ???? private String healthInsuranceDesc; // ?? @Transient private String healthInsuranceCodeSys; // ??GUID ORCA???????? private String healthInsuranceGUID; // ? private boolean hasMark; // private boolean hasImage; //RP private boolean hasRp; // private boolean hasTreatment; // private boolean hasLaboTest; // ???++ private String versionNumber; // ? @Transient private String versionNotes; // 32bit ID private String parentId; // ?? private String parentIdRelation; // ?? @Transient private String parentIdDesc; // ?? @Transient private String parentIdCodeSys; // @Transient private Collection<AccessRightModel> accessRights; // = DocumentModel.status @Transient private String status; // ???? @Transient private String handleClass; // Flag and param for senders // ? private String labtestOrderNumber; // ? @Transient private boolean sendLabtest; // CLAIM? @Transient private boolean sendClaim; // MML? @Transient private boolean sendMml; // ? @Transient private boolean priscriptionOutput; // Claim Sender for JMS+MDB // ?????? @Transient private PVTHealthInsuranceModel pVTHealthInsuranceModel; @OneToOne(cascade = { CascadeType.ALL }) @JoinColumn(name = "admission_id", nullable = true) private AdmissionModel admission; public AdmissionModel getAdmissionModel() { return admission; } public void setAdmissionModel(AdmissionModel admission) { this.admission = admission; } public DocInfoModel() { } // ?? @Transient private String facilityName; // @Transient private String createrLisence; // ID @Transient private String patientId; // ??? @Transient private String patientName; // @Transient private String patientGender; //minagawa^ ?() @Temporal(value = TemporalType.TIMESTAMP) private Date claimDate; //minagawa$ // ???? // : Document->creator? // ; Document->karteId? // @Transient private Date issuanceDate; // ?? @Transient private String InstitutionNumber; // @Transient private Date period; // ????? @Transient private boolean chkPatientInfo; // @Transient private boolean chkUseDrugInfo; // ???????? @Transient private boolean chkHomeMedical; // ??????? @Transient private boolean useGeneralName; public long getDocPk() { return docPk; } /** * Document ? Database Primary Key ? * * @param docPk Database Primary Key */ public void setDocPk(long docPk) { this.docPk = docPk; } /** * ?PrimaryKey? * * @return ?PrimaryKey */ public long getParentPk() { return parentPk; } /** * ?PrimaryKey? * * @param parentPk ?PrimaryKey */ public void setParentPk(long parentPk) { this.parentPk = parentPk; } /** * ID? * * @param docId ID */ public void setDocId(String docId) { this.docId = docId; } /** * ID? * * @return ID */ public String getDocId() { return docId; } /** * ? * * @param docType */ public void setDocType(String docType) { this.docType = docType; } /** * ? * * @return */ public String getDocType() { return docType; } /** * ? * * @param title */ public void setTitle(String title) { this.title = title; } /** * ? * * @return */ public String getTitle() { return title; } /** * ?? * * @param purpose ? */ public void setPurpose(String purpose) { this.purpose = purpose; } /** * ?? * * @return ? */ public String getPurpose() { return purpose; } /** * ?? * * @param purposeDesc ? */ public void setPurposeDesc(String purposeDesc) { this.purposeDesc = purposeDesc; } /** * ?? * * @return ? */ public String getPurposeDesc() { return purposeDesc; } /** * ?? * * @param purposeCodeSys ? */ public void setPurposeCodeSys(String purposeCodeSys) { this.purposeCodeSys = purposeCodeSys; } /** * ?? * * @return ? */ public String getPurposeCodeSys() { return purposeCodeSys; } /** * ??? * * @param firstConfirmDate ?? */ public void setFirstConfirmDate(Date firstConfirmDate) { this.firstConfirmDate = firstConfirmDate; } /** * ??? * * @return ?? */ public Date getFirstConfirmDate() { return firstConfirmDate; } /** * ???? * * @return ??? */ public String getFirstConfirmDateTrimTime() { return ModelUtils.getDateAsString(getFirstConfirmDate()); } /** * ???? * * @return ??? */ public String getFirstConfirmDateTime() { return ModelUtils.getDateAsFormatString(getFirstConfirmDate(), ISO_DF_FORMAT); } /** * ? * * @param confirmDate */ public void setConfirmDate(Date confirmDate) { this.confirmDate = confirmDate; } /** * ? * * @return */ public Date getConfirmDate() { return confirmDate; } /** * ?? * * @return ? */ public String getConfirmDateTrimTime() { return ModelUtils.getDateAsString(getConfirmDate()); } /** * ?? * * @return ? */ public String getConfirmDateTime() { return ModelUtils.getDateAsFormatString(getConfirmDate(), ISO_DF_FORMAT); } /** * ? * * @param department */ public void setDepartment(String department) { this.department = department; } /** * ? * * @return */ public String getDepartment() { return department; } /** * ? * * @param departmentDesc */ public void setDepartmentDesc(String departmentDesc) { this.departmentDesc = departmentDesc; } /** * ? * * @return */ public String getDepartmentDesc() { return departmentDesc; } public String getDepartmentName() { String[] tokens = tokenizeDept(departmentDesc); return tokens[0]; } public String getDepartmentCode() { String[] tokens = tokenizeDept(departmentDesc); if (tokens[1] != null) { return tokens[1]; } return getDepartment(); } public String getAssignedDoctorName() { String[] tokens = tokenizeDept(departmentDesc); return tokens[2]; } public String getAssignedDoctorId() { String[] tokens = tokenizeDept(departmentDesc); return tokens[3]; } public String getJMARICode() { String[] tokens = tokenizeDept(departmentDesc); return tokens[4]; } private String[] tokenizeDept(String dept) { // ????????JMARI // ????? String[] ret = new String[5]; Arrays.fill(ret, null); if (dept != null) { try { String[] params = dept.split("\\s*,\\s*"); System.arraycopy(params, 0, ret, 0, params.length); } catch (Exception e) { e.printStackTrace(System.err); } } return ret; } /** * ? * * @param departmentCodeSys */ public void setDepartmentCodeSys(String departmentCodeSys) { this.departmentCodeSys = departmentCodeSys; } /** * ? * * @return */ public String getDepartmentCodeSys() { return departmentCodeSys; } /** * ??? * * @param healthInsurance */ public void setHealthInsurance(String healthInsurance) { this.healthInsurance = healthInsurance; } /** * ??? * * @return ?? */ public String getHealthInsurance() { return healthInsurance; } /** * ??? * * @param healthInsuranceDesc ?? */ public void setHealthInsuranceDesc(String healthInsuranceDesc) { this.healthInsuranceDesc = healthInsuranceDesc; } /** * ??? * * @return ?? */ public String getHealthInsuranceDesc() { return healthInsuranceDesc; } /** * ??? * * @param healthInsuranceCodeSys ?? */ public void setHealthInsuranceCodeSys(String healthInsuranceCodeSys) { this.healthInsuranceCodeSys = healthInsuranceCodeSys; } /** * ??? * * @return ?? */ public String getHealthInsuranceCodeSys() { return healthInsuranceCodeSys; } /** * ??GUID? * * @param healthInsuranceGUID ??UUID */ public void setHealthInsuranceGUID(String healthInsuranceGUID) { this.healthInsuranceGUID = healthInsuranceGUID; } /** * ??GUID? * * @return ??UUID */ public String getHealthInsuranceGUID() { return healthInsuranceGUID; } /** * ??????? * * @param hasMark ?? true */ public void setHasMark(boolean hasMark) { this.hasMark = hasMark; } /** * ??????? * * @return ?? true */ public boolean isHasMark() { return hasMark; } public Boolean isHasMarkBoolean() { return hasMark; } /** * ???????? * * @param hasImage ??? true */ public void setHasImage(boolean hasImage) { this.hasImage = hasImage; } /** * ???????? * * @return ??? true */ public boolean isHasImage() { return hasImage; } public Boolean isHasImageBoolean() { return hasImage; } /** * ??????? * * @param hasRp ?? true */ public void setHasRp(boolean hasRp) { this.hasRp = hasRp; } /** * ??????? * * @return ?? true */ public boolean isHasRp() { return hasRp; } public Boolean isHasRpBoolean() { return hasRp; } /** * ??????? * * @param hasTreatment ?? true */ public void setHasTreatment(boolean hasTreatment) { this.hasTreatment = hasTreatment; } /** * ??????? * * @return ?? true */ public boolean isHasTreatment() { return hasTreatment; } public Boolean isHasTreatmentBoolean() { return hasTreatment; } /** * ??????? * * @param hasLaboTest ?? true */ public void setHasLaboTest(boolean hasLaboTest) { this.hasLaboTest = hasLaboTest; } public boolean isHasLaboTest() { return hasLaboTest; } /** * ??????? * * @return ?? true */ public Boolean isHasLaboTestBoolean() { return hasLaboTest; } /** * ??? * * @param version ?? */ public void setVersionNumber(String version) { this.versionNumber = version; } /** * ??? * * @return ?? */ public String getVersionNumber() { return versionNumber; } /** * ?? * * @param versionNotes ? */ public void setVersionNotes(String versionNotes) { this.versionNotes = versionNotes; } /** * ?? * * @return ? */ public String getVersionNotes() { return versionNotes; } /** * ID? * * @param parentId ID */ public void setParentId(String parentId) { this.parentId = parentId; } /** * ID? * * @return ID */ public String getParentId() { return parentId; } /** * ??? * * @param parentIdRelation ?? */ public void setParentIdRelation(String parentIdRelation) { this.parentIdRelation = parentIdRelation; } /** * ??? * * @return ?? */ public String getParentIdRelation() { return parentIdRelation; } /** * ??? * * @param relationDesc ?? */ public void setParentIdDesc(String relationDesc) { this.parentIdDesc = relationDesc; } /** * ??? * * @return ?? */ public String getParentIdDesc() { return parentIdDesc; } /** * ??? * * @param relationCodeSys ??? */ public void setParentIdCodeSys(String relationCodeSys) { this.parentIdCodeSys = relationCodeSys; } /** * ??? * * @return ?? */ public String getParentIdCodeSys() { return parentIdCodeSys; } /** * ? * * @return AccessRightModel? */ public Collection<AccessRightModel> getAccessRights() { return accessRights; } /** * ? * * @param accessRights */ public void setAccessRights(Collection<AccessRightModel> accessRights) { this.accessRights = accessRights; } /** * ? * * @param accessRight ? */ public void addAccessRight(AccessRightModel accessRight) { if (accessRights == null) { setAccessRights(new ArrayList<AccessRightModel>(3)); } accessRights.add(accessRight); } /** * ???? * * @param status ??? */ public void setStatus(String status) { this.status = status; } /** * ???? * * @return ??? */ public String getStatus() { return status; } public String getHandleClass() { return handleClass; } public void setHandleClass(String handleClass) { this.handleClass = handleClass; } /** * ?? */ @Override public int hashCode() { return docId.hashCode() + 11; } /** * ID? eqaul ????? * * @param other * @return equal ? true */ @Override public boolean equals(Object other) { if (other != null && getClass() == other.getClass()) { return getDocId().equals(((DocInfoModel) other).getDocId()); } return false; } /** * ?????? * * @param other * @return */ @Override public int compareTo(Object other) { if (other != null && getClass() == other.getClass()) { Date val1 = getFirstConfirmDate(); Date val2 = ((DocInfoModel) other).getFirstConfirmDate(); int result = (val1 != null && val2 != null) ? val1.compareTo(val2) : 0; if (result == 0) { val1 = getConfirmDate(); val2 = ((DocInfoModel) other).getConfirmDate(); result = (val1 != null && val2 != null) ? val1.compareTo(val2) : 0; } return result; } return -1; } @Override protected Object clone() throws CloneNotSupportedException { super.clone(); DocInfoModel ret = new DocInfoModel(); // ret.setAccessRights(this.getAccessRights()); ret.setConfirmDate(this.getConfirmDate()); ret.setDepartment(this.getDepartment()); ret.setDepartmentCodeSys(this.getDepartmentCodeSys()); ret.setDepartmentDesc(this.getDepartmentDesc()); // ret.setDocPk(this.getDocPk()); // ret.setDocId(this.getDocId()); // ret.setDocType(this.getDocType()); ret.setFirstConfirmDate(this.getFirstConfirmDate()); ret.setHandleClass(this.getHandleClass()); ret.setHasImage(this.isHasImage()); ret.setHasLaboTest(this.isHasLaboTest()); ret.setHasMark(this.isHasMark()); ret.setHasRp(this.isHasRp()); ret.setHasTreatment(this.isHasTreatment()); ret.setHealthInsurance(this.getHealthInsurance()); ret.setHealthInsuranceCodeSys(this.getHealthInsuranceCodeSys()); ret.setHealthInsuranceDesc(this.getHealthInsuranceDesc()); ret.setHealthInsuranceGUID(this.getHealthInsuranceGUID()); // ret.setParentId(this.getParentId()); // ret.setParentIdCodeSys(this.getParentIdCodeSys()); // ret.setParentIdDesc(this.getParentIdDesc()); // ret.setParentIdRelation(this.getParentIdRelation()); // ret.setParentPk(this.getParentPk()); // ret.setPurpose(this.getPurpose()); ret.setPurposeCodeSys(this.getPurposeCodeSys()); ret.setPurposeDesc(this.getPurposeDesc()); ret.setStatus(this.getStatus()); ret.setTitle(this.getTitle()); ret.setVersionNotes(this.getVersionNotes()); ret.setVersionNumber(this.getVersionNumber()); return ret; // ret.setDocPk(this.getDocPk()); // ret.setDocId(this.getDocId()); // ret.setParentPk(this.getParentPk()); } public String getLabtestOrderNumber() { return labtestOrderNumber; } public void setLabtestOrderNumber(String labtestOrderNumber) { this.labtestOrderNumber = labtestOrderNumber; } public boolean isSendClaim() { return sendClaim; } public void setSendClaim(boolean sendClaim) { this.sendClaim = sendClaim; } public boolean isSendLabtest() { return sendLabtest; } public void setSendLabtest(boolean sendLabtest) { this.sendLabtest = sendLabtest; } public boolean isSendMml() { return sendMml; } public void setSendMml(boolean sendMml) { this.sendMml = sendMml; } public String getFirstConfirmDateWithMark() { StringBuilder sb = new StringBuilder(); sb.append(getFirstConfirmDateTrimTime()); if (IInfoModel.STATUS_TMP.equals(status)) { sb.append(""); } if (IInfoModel.DOCTYPE_SUMMARY.equals(docType)) { sb.append(""); } if (admission != null) { sb.append(""); } if (hasRp) { sb.append(""); } return sb.toString(); } public boolean isKarte() { boolean ret = IInfoModel.DOCTYPE_KARTE.equals(docType) || IInfoModel.DOCTYPE_S_KARTE.equals(docType); return ret; } public PVTHealthInsuranceModel getPVTHealthInsuranceModel() { return getpVTHealthInsuranceModel(); } public void setPVTHealthInsuranceModel(PVTHealthInsuranceModel selectedInsurance) { this.setpVTHealthInsuranceModel(selectedInsurance); } public String getFacilityName() { return facilityName; } public void setFacilityName(String facilityName) { this.facilityName = facilityName; } public String getCreaterLisence() { return createrLisence; } public void setCreaterLisence(String createrLisence) { this.createrLisence = createrLisence; } public String getPatientId() { return patientId; } public void setPatientId(String patientId) { this.patientId = patientId; } public String getPatientName() { return patientName; } public void setPatientName(String patientName) { this.patientName = patientName; } public String getPatientGender() { return patientGender; } public void setPatientGender(String patientGender) { this.patientGender = patientGender; } //minagawa^ CLAIM? () public Date getClaimDate() { return claimDate; } public void setClaimDate(Date date) { claimDate = date; } //minagawa$ public boolean isPriscriptionOutput() { return priscriptionOutput; } public void setPriscriptionOutput(boolean priscriptionOutput) { this.priscriptionOutput = priscriptionOutput; } public PVTHealthInsuranceModel getpVTHealthInsuranceModel() { return pVTHealthInsuranceModel; } public void setpVTHealthInsuranceModel(PVTHealthInsuranceModel pVTHealthInsuranceModel) { this.pVTHealthInsuranceModel = pVTHealthInsuranceModel; } public Date getIssuanceDate() { return issuanceDate; } public void setIssuanceDate(Date issuanceDate) { this.issuanceDate = issuanceDate; } public String getInstitutionNumber() { return InstitutionNumber; } public void setInstitutionNumber(String InstitutionNumber) { this.InstitutionNumber = InstitutionNumber; } public Date getPeriod() { return period; } public void setPeriod(Date period) { this.period = period; } public boolean isChkPatientInfo() { return chkPatientInfo; } public void setChkPatientInfo(boolean chkPatientInfo) { this.chkPatientInfo = chkPatientInfo; } public boolean isChkUseDrugInfo() { return chkUseDrugInfo; } public void setChkUseDrugInfo(boolean chkUseDrugInfo) { this.chkUseDrugInfo = chkUseDrugInfo; } public boolean isChkHomeMedical() { return chkHomeMedical; } public void setChkHomeMedical(boolean chkHomeMedical) { this.chkHomeMedical = chkHomeMedical; } public boolean isUseGeneralName() { return useGeneralName; } public void setUseGeneralName(boolean useGeneralName) { this.useGeneralName = useGeneralName; } //minagawa^ () public boolean isScheduled() { boolean ret = (this.status != null && this.status.equals(IInfoModel.STATUS_TMP) && this.getFirstConfirmDate() != null && this.getConfirmDate() != null && this.getFirstConfirmDate().after(this.getConfirmDate())); return ret; } //minagawa$ }