Selaa lähdekoodia

Merge branch 'dev' of chenweida/patient-co-management into dev

chenweida 7 vuotta sitten
vanhempi
commit
f6a86afe8c

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -26,6 +26,7 @@ public class Prescription extends IdEntity {
    private Date payTime;                   //支付时间
    private Date dosageTime;                //配药完成时间
    private Date dispatchingTime;          //配送员领药时间
    private Date expressageTime;            //配送员到服务站的时间
    private Date finishTime;                //配送员确认送达或居民确认取药的时间
    private String patient;                  //关联 wlyy_patient code
    private String patientName;             //患者名称
@ -348,6 +349,14 @@ public class Prescription extends IdEntity {
        this.statusName = getStatusName(status,null);
    }
    public Date getExpressageTime() {
        return expressageTime;
    }
    public void setExpressageTime(Date expressageTime) {
        this.expressageTime = expressageTime;
    }
    @Transient
    public static String getStatusName(Integer status, String hospitalName) {

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionDao.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -22,4 +23,7 @@ public interface PrescriptionDao extends PagingAndSortingRepository<Prescription
    @Query("select p from Prescription p where p.jwCode=?1 and p.status=?2 ")
    List<Prescription> fingdByJwCodeAndStatus(String jwcode,Integer status);
    //根据处方code得到患者信息
    @Query("select p from Prescription pt,Patient p where p.code=pt.patient  and pt.code=?1")
    Patient findPatientByPrescriptionCode(String prescriptionCode);
}

+ 56 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -1,17 +1,24 @@
package com.yihu.wlyy.service.app.prescription;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDispensaryCodeDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionLogDao;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
/**
 * Created by chenweida on 2017/7/27.
@ -27,6 +34,14 @@ public class PrescriptionExpressageService {
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionNoticesService prescriptionNoticesService;
    @Autowired
    private DoctorDao doctorDao;
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Value("${wechat.appId}")
    private String appId;
    /**
     * 获取处方配送信息信息
@ -155,9 +170,17 @@ public class PrescriptionExpressageService {
     * @param prescriptionDispensaryCode
     * @return
     */
    private Integer dispensaryCode_2(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) {
    private Integer dispensaryCode_2(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode)throws Exception {
        //获取配送的医生信息
        Doctor doctor=doctorDao.findByCode(userCode);
        //修改处方状态为配送中
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        //修改处方状态为完成
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        Date expressageing=new Date();
        prescription.setExpressageTime(expressageing);
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
@ -167,12 +190,22 @@ public class PrescriptionExpressageService {
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserName(doctor.getName());
        prescriptionLog.setUserType(2);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        prescriptionLogDao.save(prescriptionLog);
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        //发送模板消息通知患者药品开始配送
        String url=SystemConf.getInstance().getSystemProperties().getProperty("patient_prescription_expressageing");
        url = url.replace("{server}",wechat_base_url)
                .replace("{appId}",appId)
                .replace("{prescriptionCode}",prescriptionDispensaryCode.getPrescriptionCode());
        Patient patient = prescriptionDao.findPatientByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionNoticesService.sendMessages(patient.getOpenid(),patient.getName(),doctor.getName(), DateUtil.dateToStrLong(expressageing),3, 0,url );
        return prescriptionDispensaryCode.getType();
    }
@ -183,10 +216,15 @@ public class PrescriptionExpressageService {
     * @param prescriptionDispensaryCode
     * @return
     */
    private Integer dispensaryCode_3(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) {
    private Integer dispensaryCode_3(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) throws Exception{
        //获取配送的医生信息
        Doctor doctor=doctorDao.findByCode(userCode);
        //修改处方状态为完成
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        //修改处方状态为配送到服务站
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        Date expressage2hospitalDate=new Date();
        prescription.setExpressageTime(expressage2hospitalDate);
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
@ -196,13 +234,26 @@ public class PrescriptionExpressageService {
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserName(doctor.getName());
        prescriptionLog.setUserType(2);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
        prescriptionLogDao.save(prescriptionLog);
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        //发送模板消息通知患者取药
        String url=SystemConf.getInstance().getSystemProperties().getProperty("patient_prescription_expressage2hospital");
        url = url.replace("{server}",wechat_base_url)
                .replace("{appId}",appId)
                .replace("{prescriptionCode}",prescriptionDispensaryCode.getPrescriptionCode());
        Patient patient = prescriptionDao.findPatientByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionNoticesService.sendMessages(patient.getOpenid(),patient.getName(),doctor.getName(), DateUtil.dateToStrLong(expressage2hospitalDate),4, 0, url);
        return prescriptionDispensaryCode.getType();
    }
    /**

+ 5 - 0
patient-co/patient-co-wlyy/src/main/resources/system.properties

@ -26,6 +26,11 @@ patient_inspect_url =https://open.weixin.qq.com/connect/oauth2/authorize?appid={
patient_examination_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#处方记录
patient_prescription_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#处方,健管师取药
patient_prescription_expressageing=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#处方,健管师送药到服务站
patient_prescription_expressage2hospital=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#就诊记录
patient_visit_pic ={server}/images/visit.png