Browse Source

检验申请接口-实现添加

huangzhiyong 6 năm trước cách đây
mục cha
commit
87253f4acf

+ 28 - 0
src/main/java/com/yihu/ehr/svrinspection/commons/exception/ManageException.java

@ -0,0 +1,28 @@
package com.yihu.ehr.svrinspection.commons.exception;
/**
 *  公共异常类
 *
 * @author HZY
 * @created 2018/11/15 10:21
 */
public class ManageException extends Exception{
    public ManageException() {
    }
    public ManageException(String message) {
        super(message);
    }
    public ManageException(String message, Throwable cause) {
        super(message, cause);
    }
    public ManageException(Throwable cause) {
        super(cause);
    }
    public ManageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}

+ 53 - 0
src/main/java/com/yihu/ehr/svrinspection/commons/model/IntegerIdentityEntity.java

@ -0,0 +1,53 @@
package com.yihu.ehr.svrinspection.commons.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
 *  integer实体类-基类
 *
 * @author HZY
 * @created 2018/11/14 16:23
 */
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class IntegerIdentityEntity implements Serializable {
    protected Integer id;
    protected Date createTime;
    @Id
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 61 - 27
src/main/java/com/yihu/ehr/svrinspection/controller/AssistanceApplyController.java


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 118 - 0
src/main/java/com/yihu/ehr/svrinspection/controller/AssistanceApplyControllerDemo.java


+ 4 - 1
src/main/java/com/yihu/ehr/svrinspection/dao/AssistanceApplyDao.java

@ -2,6 +2,8 @@ package com.yihu.ehr.svrinspection.dao;
import com.yihu.ehr.svrinspection.model.AssistanceApplyModel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -11,5 +13,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface AssistanceApplyDao extends PagingAndSortingRepository<AssistanceApplyModel,Integer> {
//    Page<AssistanceApplyModel> queryAllBy
    Page<AssistanceApplyModel> queryAllByApplyOrgAndExamTypeAndExamDeptAndPatientNameLike(String appOrg, String type,String dept,String patientName, Pageable pageable);
}

+ 13 - 17
src/main/java/com/yihu/ehr/svrinspection/model/AssistanceApplyModel.java

@ -1,7 +1,10 @@
package com.yihu.ehr.svrinspection.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.ehr.svrinspection.commons.model.IntegerIdentityEntity;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
/**
 * @author HZY
@ -9,16 +12,16 @@ import java.sql.Timestamp;
 */
@Entity
@Table(name = "org_assistance_apply", schema = "", catalog = "healtharchive")
public class AssistanceApplyModel {
public class AssistanceApplyModel extends IntegerIdentityEntity {
    private String applyOrg;
    private String applyUserId;
    private Timestamp applyDate;
    private Date applyDate;
    private String remark;
    private String picture;
    private Integer isRead;
    private String solutionOrg;
    private Integer solutionStatus;
    private Timestamp solutionDate;
    private Date solutionDate;
    private String solutionReply;
    private String solutionUserId;
    private String solutionUserName;
@ -29,7 +32,6 @@ public class AssistanceApplyModel {
    private String patientName;
    private String patientAge;
    private String patientSex;
    private int id;
    @Basic
    @Column(name = "apply_org", nullable = true, length = 32)
@ -52,12 +54,13 @@ public class AssistanceApplyModel {
    }
    @Basic
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "apply_date", nullable = true)
    public Timestamp getApplyDate() {
    public Date getApplyDate() {
        return applyDate;
    }
    public void setApplyDate(Timestamp applyDate) {
    public void setApplyDate(Date applyDate) {
        this.applyDate = applyDate;
    }
@ -112,12 +115,13 @@ public class AssistanceApplyModel {
    }
    @Basic
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "solution_date", nullable = true)
    public Timestamp getSolutionDate() {
    public Date getSolutionDate() {
        return solutionDate;
    }
    public void setSolutionDate(Timestamp solutionDate) {
    public void setSolutionDate(Date solutionDate) {
        this.solutionDate = solutionDate;
    }
@ -221,14 +225,6 @@ public class AssistanceApplyModel {
        this.patientSex = patientSex;
    }
    @Id
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
}

+ 29 - 1
src/main/java/com/yihu/ehr/svrinspection/service/AssistanceApplyService.java

@ -1,14 +1,42 @@
package com.yihu.ehr.svrinspection.service;
import com.yihu.ehr.query.BaseJpaService;
import com.yihu.ehr.svrinspection.commons.exception.ManageException;
import com.yihu.ehr.svrinspection.dao.AssistanceApplyDao;
import com.yihu.ehr.svrinspection.model.AssistanceApplyModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
 *  检验申请 业务类
 * @author HZY
 * @created 2018/11/14 9:21
 */
@Transactional
@Service
public class AssistanceApplyService {
public class AssistanceApplyService  extends BaseJpaService<AssistanceApplyModel, AssistanceApplyDao> {
    @Autowired
    private AssistanceApplyDao assistanceApplyDao;
    public AssistanceApplyModel findById(int id){
        return assistanceApplyDao.findOne(id);
    }
    public AssistanceApplyModel solutionApply(int id,String replyUserId,String replyContent) throws ManageException {
        AssistanceApplyModel applyModel = findById(id);
        if (applyModel == null) {
            throw new ManageException("申请不存在!");
        }
        applyModel.setSolutionUserId(replyUserId);
        applyModel.setSolutionReply(replyContent);
        applyModel.setSolutionDate(new Date());
        applyModel.setSolutionStatus(0);
        assistanceApplyDao.save(applyModel);
        return applyModel;
    }
}