Trick il y a 5 ans
Parent
commit
37df169c1f

+ 15 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/InspectionPartsDictDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionPartsDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/9/26.
 */
public interface InspectionPartsDictDao extends PagingAndSortingRepository<WlyyInspectionPartsDictDO, String>, JpaSpecificationExecutor<WlyyInspectionPartsDictDO> {
    List<WlyyInspectionPartsDictDO> findByParentCode(String parentCode);
}

+ 6 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionLogDao.java

@ -4,8 +4,14 @@ import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
/**
 * Created by Trick on 2019/5/17.
 * Created by Trick on 2019/5/17.
 */
 */
public interface PrescriptionLogDao extends PagingAndSortingRepository<WlyyPrescriptionLogDO, String>, JpaSpecificationExecutor<WlyyPrescriptionLogDO> {
public interface PrescriptionLogDao extends PagingAndSortingRepository<WlyyPrescriptionLogDO, String>, JpaSpecificationExecutor<WlyyPrescriptionLogDO> {
    List<WlyyPrescriptionLogDO> findByOutpatientIdOrderByCreateTimeDESC(String outpatientId);
    List<WlyyPrescriptionLogDO> findByPrescriptionCodeOrderByCreateTimeDESC(String prescriptionCode);
}
}

+ 36 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/InspectionService.java

@ -0,0 +1,36 @@
package com.yihu.jw.hospital.prescription.service;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionPartsDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.InspectionPartsDictDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * Created by Trick on 2019/9/26.
 */
@Service
public class InspectionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
    @Autowired
    private InspectionPartsDictDao inspectionPartsDictDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    public List<WlyyInspectionPartsDictDO> findByPartsCode(String parentCode){
        return inspectionPartsDictDao.findByParentCode(parentCode);
    }
    public List<WlyyHospitalSysDictDO> findDictByName(String hospital,String name){
        return hospitalSysDictDao.findByHospitalAndDictName(hospital,name);
    }
}

+ 71 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionLogService.java

@ -0,0 +1,71 @@
package com.yihu.jw.hospital.prescription.service;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionLogDO;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionLogDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
/**
 * Created by Trick on 2019/9/26.
 */
@Service
@Transactional
public class PrescriptionLogService  extends BaseJpaService<WlyyPrescriptionLogDO, PrescriptionLogDao> {
    @Autowired
    private PrescriptionLogDao logDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    /**
     * 处方日志表
     * @param prescriptionCode
     * @param status
     * @param userType
     * @param userCode
     * @param userName
     * @param datajson
     * @param date
     * @return
     */
    public Boolean addPrescriptionLog(String prescriptionCode, Integer status, Integer userType, String userCode, String userName, String datajson, Date date){
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionCode);
        WlyyPrescriptionLogDO log = new WlyyPrescriptionLogDO();
        log.setOutpatientId(prescriptionDO.getOutpatientId());
        log.setPrescriptionCode(prescriptionCode);
        log.setStatus(status);
        log.setUserType(userType);
        log.setUserCode(userCode);
        log.setUserName(userName);
        log.setDatajson(datajson);
        log.setCreateTime(date);
        logDao.save(log);
        return true;
    }
    /**
     * 查询处方日志
     * @param outpatientId
     * @return
     */
    public List<WlyyPrescriptionLogDO> findByOutpatientId(String outpatientId){
        return logDao.findByOutpatientIdOrderByCreateTimeDESC(outpatientId);
    }
    /**
     * 查询处方日志
     * @param prescriptionCode
     * @return
     */
    public List<WlyyPrescriptionLogDO> findByPrescriptionCode(String prescriptionCode){
        return logDao.findByPrescriptionCodeOrderByCreateTimeDESC(prescriptionCode);
    }
}

+ 11 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -141,6 +141,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private OauthYlzConfigDao oauthYlzConfigDao;
    private OauthYlzConfigDao oauthYlzConfigDao;
    @Autowired
    @Autowired
    private PatientRegisterDao patientRegisterDao;
    private PatientRegisterDao patientRegisterDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    
    
    @Value("${demo.flag}")
    @Value("${demo.flag}")
@ -647,6 +649,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String outPatientSql="";
        String outPatientSql="";
        if ("1".equals(status)) {
        if ("1".equals(status)) {
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
        } else if ("2".equals(status)) {
        } else if ("2".equals(status)) {
            //开方成功时候,先用处方号获取本地处方状态是否为开方失败,如果是则需要更新本地的处方
            //开方成功时候,先用处方号获取本地处方状态是否为开方失败,如果是则需要更新本地的处方
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
@ -1167,6 +1171,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        WlyyPrescriptionDO prescription = prescriptionDao.save(prescriptionDO);
        WlyyPrescriptionDO prescription = prescriptionDao.save(prescriptionDO);
        //加入处方状态变更流水日志
        prescriptionLogService.addPrescriptionLog(prescription.getId(),10,2,outpatientDO.getDoctor(),outpatientDO.getDoctorName(),"",new Date());
        //下诊断
        //下诊断
        //删除之前诊断
        //删除之前诊断
        List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId());
        List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId());
@ -1287,6 +1294,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    result.put("code",1);
                    result.put("code",1);
                    result.put("mes","开方提交成功");
                    result.put("mes","开方提交成功");
                    return result;
                    return result;
                }else{
                }else{
                    //开方失败
                    //开方失败
@ -1294,6 +1302,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    prescriptionDao.save(prescription);
                    prescriptionDao.save(prescription);
                    result.put("code",-1);
                    result.put("code",-1);
                    result.put("mes","开方提交失败");
                    result.put("mes","开方提交失败");
                    prescriptionLogService.addPrescriptionLog(prescription.getId(),13,2,outpatientDO.getDoctor(),outpatientDO.getDoctorName(),"",new Date());
                    return result;
                    return result;
                }
                }

+ 54 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyInspectionPartsDictDO.java

@ -0,0 +1,54 @@
package com.yihu.jw.entity.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.crypto.Data;
/**
 * Created by Trick on 2019/9/26.
 */
@Entity
@Table(name = "wlyy_inspection_parts_dict")
public class WlyyInspectionPartsDictDO extends IntegerIdentityEntity {
    private String code;//部位业务code',
    private String name;//部位名称',
    private String parentCode;//上级部位名称',
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Data createTime;//
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getParentCode() {
        return parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    public Data getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Data createTime) {
        this.createTime = createTime;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java

@ -95,7 +95,7 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
     * 就诊中:10 诊断中,11 药师审核失败 / 调整中,12  药师审核完成,13  开方失败/调整中
     * 就诊中:10 诊断中,11 药师审核失败 / 调整中,12  药师审核完成,13  开方失败/调整中
     * 待支付:20 诊断完成/开方成功/待支付,21 支付失败/待支付中
     * 待支付:20 诊断完成/开方成功/待支付,21 支付失败/待支付中
     * 待取药:30 支付成功/等待配药,31 配药成功/等待取药,32 配送中
     * 待取药:30 支付成功/等待配药,31 配药成功/等待取药,32 配送中
     * 已完成:100 已完成/未评价 ,101 已完成已经评价
     * 已完成:100 已完成/未评价
     */
     */
    private Integer status;
    private Integer status;

+ 38 - 125
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionLogDO.java

@ -19,164 +19,77 @@ import java.util.Date;
@Table(name = "wlyy_prescription_log")
@Table(name = "wlyy_prescription_log")
public class WlyyPrescriptionLogDO extends UuidIdentityEntity {
public class WlyyPrescriptionLogDO extends UuidIdentityEntity {
    /**
	 * 
	 */
	private String saasId;
    /**
	 * 处方code 关联表wlyy_prescription id
	 */
	private String prescriptionCode;
    /**
	 * 创建时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date createTime;
    /**
	 * 类型: -1 失效 1HIS对接 2易联众对接  3创建处方 4 审核  5付款 6 配送 7完成 8物流对接
	 */
	private Integer type;
    /**
	 * (-2 患者自己取消 -1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
	 */
	private Integer status;
    /**
	 * 医生或者患者code
	 */
	private String userCode;
    /**
	 * 医生或者患者name
	 */
	private String userName;
    /**
	 * 1 患者 2医生
	 */
	private Integer userType;
    /**
	 * 医院id
	 */
	private String hospital;
    /**
	 * 医院名称
	 */
	private String hospitalName;
    /**
	 * 操作是否成功 1成功 0失败
	 */
	private Integer flag;
    /**
	 * 备注信息
	 */
	private String remark;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@Column(name = "prescription_code")
    private String outpatientId;//
    private String prescriptionCode;//处方code 关联表wlyy_prescription id',
    private String datajson;//附加信息展示字段',
    private Integer status;//续方取消:-3 支付过期取消,-2 患者自己取消 ,-1 医生取消 ;候诊中:0 候诊中;就诊中:10 诊断中,11 药师审核失败 / 调整中,12  药师审核完成,13  开方失败/调整中;待支付:20 诊断完成/开方成功/待支付,21 支付失败/待支付中;待取药:30 支付成功/等待配药,31 配药成功/等待取药,32 配送中;已完成:100 已完成',
    private Integer userType;//1 患者 2医生',
    private String userCode;//医生或者患者code',
    private String userName;//医生或者患者name',
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;//创建时间',
    public String getOutpatientId() {
        return outpatientId;
    }
    public void setOutpatientId(String outpatientId) {
        this.outpatientId = outpatientId;
    }
    public String getPrescriptionCode() {
    public String getPrescriptionCode() {
        return prescriptionCode;
        return prescriptionCode;
    }
    }
    public void setPrescriptionCode(String prescriptionCode) {
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
        this.prescriptionCode = prescriptionCode;
    }
    }
	@Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    public String getDatajson() {
        return datajson;
    }
    }
	@Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    public void setDatajson(String datajson) {
        this.datajson = datajson;
    }
    }
	@Column(name = "status")
    public Integer getStatus() {
    public Integer getStatus() {
        return status;
        return status;
    }
    }
    public void setStatus(Integer status) {
    public void setStatus(Integer status) {
        this.status = status;
        this.status = status;
    }
    }
	@Column(name = "user_code")
    public Integer getUserType() {
        return userType;
    }
    public void setUserType(Integer userType) {
        this.userType = userType;
    }
    public String getUserCode() {
    public String getUserCode() {
        return userCode;
        return userCode;
    }
    }
    public void setUserCode(String userCode) {
    public void setUserCode(String userCode) {
        this.userCode = userCode;
        this.userCode = userCode;
    }
    }
	@Column(name = "user_name")
    public String getUserName() {
    public String getUserName() {
        return userName;
        return userName;
    }
    }
    public void setUserName(String userName) {
    public void setUserName(String userName) {
        this.userName = userName;
        this.userName = userName;
    }
    }
	@Column(name = "user_type")
    public Integer getUserType() {
        return userType;
    }
    public void setUserType(Integer userType) {
        this.userType = userType;
    }
	@Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
	@Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
	@Column(name = "flag")
    public Integer getFlag() {
        return flag;
    }
    public void setFlag(Integer flag) {
        this.flag = flag;
    public Date getCreateTime() {
        return createTime;
    }
    }
	@Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    }
}
}

+ 4 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java

@ -53,8 +53,10 @@ public class PrescriptionStatusUpdateService {
    public void autoPush() throws Exception{
    public void autoPush() throws Exception{
        //获取所有就诊中已挂号、已下临时处方、并且未结束的处方
        //获取所有就诊中已挂号、已下临时处方、并且未结束的处方
        String sql = "SELECT o.id,o.con_no,o.register_no,p.mapping_code,pre.adm_no,pre.real_order,pre.id preId,pre.dispensary_type,pre.status FROM base.wlyy_outpatient o LEFT JOIN base.wlyy_patient_mapping p ON o.patient=p.patient " +
                "LEFT JOIN base.wlyy_prescription pre on o.id=pre.outpatient_id WHERE o.status=1 AND o.con_no IS NOT NULL  AND pre.real_order IS NOT NULL  ";
        String sql = "SELECT o.id,o.con_no,o.register_no,p.mapping_code,pre.adm_no,pre.real_order,pre.id preId,pre.dispensary_type,pre.status " +
                "FROM base.wlyy_outpatient o LEFT JOIN base.wlyy_patient_mapping p ON o.patient=p.patient " +
                "LEFT JOIN base.wlyy_prescription pre on o.id=pre.outpatient_id " +
                "WHERE o.status=1 AND o.con_no IS NOT NULL  AND pre.real_order IS NOT NULL  ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String, Object> map : list) {
        for (Map<String, Object> map : list) {
            //处方号
            //处方号