Sfoglia il codice sorgente

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

huangwenjie 7 anni fa
parent
commit
323e06363e

+ 0 - 1
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/message/HealthMessageJob.java

@ -22,7 +22,6 @@ import org.springframework.util.StringUtils;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * Created by Administrator on 2016.10.25.

+ 62 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionExpressage.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
@ -23,19 +24,27 @@ public class PrescriptionExpressage extends IdEntity{
    private String mobile;                  //收货人手机号码
    private String phone;                   //收货人座机号
    private String address;                 //收货人详细地址
    private String provinceCode;           //省代码
    private String provinceName;           //省名称
    private String cityCode;                //市代码
    private String cityName;                //市名称
    private String townCode;                //区代码
    private String townName;                //区名称
    private String streetCode;              //街道代码
    private String streetName;              //街道名称
    private String provinceCode;           //收货人省代码
    private String provinceName;           //收货人省名称
    private String cityCode;                //收货人市代码
    private String cityName;                //收货人市名称
    private String townCode;                //收货人区代码
    private String townName;                //收货人区名称
    private String streetCode;              //收货人街道代码
    private String streetName;              //收货人街道名称
    private Integer price;                    //快递的配送费用 单位是分
    private String expressageName;          //配送人名称
    private String expressageCode;          //配送人code
    private String expressageMobile;        //配送人电话
    private String hospitalName;            //如果配送方式是健管师那么这个字段存服务站名称,如果是快递配送那么是快递公司名称
    private Double price;                    //快递的配送费用
    private Date createTime;                //创建的时间
    private Integer oneselfPickupFlg;//是否自取 1是 0否
    //没有hibernate映射
    private Integer dispensaryType;            //取药类型:1 自取 2快递配送 3健管师配送
    private Integer status;                  //状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
        return code;
@ -157,11 +166,11 @@ public class PrescriptionExpressage extends IdEntity{
        this.hospitalName = hospitalName;
    }
    public Double getPrice() {
    public Integer getPrice() {
        return price;
    }
    public void setPrice(Double price) {
    public void setPrice(Integer price) {
        this.price = price;
    }
@ -185,4 +194,46 @@ public class PrescriptionExpressage extends IdEntity{
    public String getMailno() { return mailno; }
    public void setMailno(String mailno) { this.mailno = mailno; }
    public String getExpressageName() {
        return expressageName;
    }
    public void setExpressageName(String expressageName) {
        this.expressageName = expressageName;
    }
    public String getExpressageCode() {
        return expressageCode;
    }
    public void setExpressageCode(String expressageCode) {
        this.expressageCode = expressageCode;
    }
    public String getExpressageMobile() {
        return expressageMobile;
    }
    public void setExpressageMobile(String expressageMobile) {
        this.expressageMobile = expressageMobile;
    }
    @Transient
    public Integer getDispensaryType() {
        return dispensaryType;
    }
    public void setDispensaryType(Integer dispensaryType) {
        this.dispensaryType = dispensaryType;
    }
    @Transient
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionPay.java

@ -21,8 +21,8 @@ public class PrescriptionPay extends IdEntity {
    private String ybCard;//医保卡号
    private Integer type;// 1 医保支付
    private Integer status;//状态  成功1 失败0
    private Double ybCost;//医保费用
    private Double myCost;//自己付费
    private Integer ybCost;//统筹金额  单位分
    private Integer myCost;//自费金额  单位分
    public String getCode() {
        return code;
@ -81,19 +81,19 @@ public class PrescriptionPay extends IdEntity {
        this.status = status;
    }
    public Double getYbCost() {
    public Integer getYbCost() {
        return ybCost;
    }
    public void setYbCost(Double ybCost) {
    public void setYbCost(Integer ybCost) {
        this.ybCost = ybCost;
    }
    public Double getMyCost() {
    public Integer getMyCost() {
        return myCost;
    }
    public void setMyCost(Double myCost) {
    public void setMyCost(Integer myCost) {
        this.myCost = myCost;
    }
}

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultDao.java

@ -45,4 +45,10 @@ public interface ConsultDao extends PagingAndSortingRepository<Consult, Long>, J
    // 按类型查询患者咨询记录
    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.evaluate,a.relationCode  from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and a.del = '1' and a.type=?2 order by a.czrq desc")
    Page<Object> findByPatientAndType(String patient,Integer type, Pageable pageRequest);
    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.evaluate,a.relationCode from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and a.id < ?3 and a.del = '1' and a.type=?4 and a.symptoms like ?2 order by a.czrq desc")
    Page<Object> findByPatientAndType(String patient, String title, long id,Integer type, Pageable pageRequest);
    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.doctor,b.evaluate,a.relationCode from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and a.del = '1' and a.type=?3 and a.symptoms like ?2 order by a.czrq desc")
    Page<Object> findByPatientAndType(String patient, String title,Integer type, Pageable pageRequest);
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java

@ -12,6 +12,6 @@ import java.util.List;
 * Created by chenweida on 2017/7/27.
 */
public interface PrescriptionPayDao extends PagingAndSortingRepository<PrescriptionPay, Long>, JpaSpecificationExecutor<PrescriptionPay> {
    @Query("from PrescriptionPay p where p.prescriptionCode=?1 ")
    @Query("from PrescriptionPay p where p.prescriptionCode=?1 and p.status=1")
    PrescriptionPay findByPrescriptionPay(String prescriptionCode);
}

+ 14 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultService.java

@ -128,11 +128,21 @@ public class ConsultService extends BaseService {
		Sort sort = new Sort(Direction.DESC, "id");
		// 分页信息
		PageRequest pageRequest = new PageRequest(0, pagesize, sort);
		if (id > 0) {
			return consultDao.findByPatientAndType(patient, id,type, pageRequest);
		} else {
			return consultDao.findByPatientAndType(patient,type, pageRequest);
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			if (id > 0) {
				return consultDao.findByPatientAndType(patient,title, id,type, pageRequest);
			} else {
				return consultDao.findByPatientAndType(patient,title,type, pageRequest);
			}
		}else{
			if (id > 0) {
				return consultDao.findByPatientAndType(patient, id,type, pageRequest);
			} else {
				return consultDao.findByPatientAndType(patient,type, pageRequest);
			}
		}
	}
	public Consult findOneConsult(String consult) {

+ 19 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -879,14 +879,14 @@ public class ConsultTeamService extends ConsultService {
            // 查询患者信息
            Patient p = patientDao.findByCode(patient);
            //获取基位处方详情
            //1、获取基位处方详情(保存续方表、药品续方信息表、续方疾病类型表)
            Prescription prescription = new Prescription();
            savePrescription(prescription,jwCode,doctor,p,ct,reason);
            String symptoms = savePrescription(prescription,jwCode,doctor,p,ct,reason);
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("title",p.getName()+"申请续方");
            //获取体征记录
            //2、获取体征记录
            Iterable<PatientDevice> devices = patientDeviceDao.findByUser(patient);
            if(devices!=null||devices.iterator().hasNext()){
                int count = messageDao.findTzMessage(patient);
@ -894,11 +894,11 @@ public class ConsultTeamService extends ConsultService {
            }else{
                jsonObject.put("tzMsg","居民未绑定体征设备");
            }
            //获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
            //3、获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
            jsonObject.put("lastTime","");
            String symptoms = jsonObject.toString();
            String content = jsonObject.toString();
            //创建咨询
            //4、创建咨询
            JSONObject users = new JSONObject();//咨询参与者
            users.put(patient, 0);
            users.put(doctorCode, 0);
@ -925,10 +925,11 @@ public class ConsultTeamService extends ConsultService {
            ct.setCzrq(new Date());
            ct.setDel("1");
            ct.setStatus(0);
            ct.setEvaluate(0);
            // 医生未读数量为1
            ct.setDoctorRead(1);
            // 添加咨询记录
            Consult consult = addConsult(ct.getPatient(), null, ct.getSymptoms(), ct.getImages(), ct.getType());
            Consult consult = addConsult(ct.getPatient(), "申请续方", ct.getSymptoms(), ct.getImages(), ct.getType());
            // 设置关联指导
            consult.setGuidance(ct.getGuidance());
            //关联业务code
@ -937,9 +938,9 @@ public class ConsultTeamService extends ConsultService {
            ct.setConsult(consult.getCode());
            //推送给IM去创建议题,取得成员消息
            JSONObject messages = ImUtill.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
            JSONObject messages = ImUtill.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), content, consult.getImages(),agent);
            //续方咨询的sessionid为居民code+续方code+咨询类型
            //5、(im创建咨询) 续方咨询的sessionid为居民code+续方code+咨询类型
            JSONObject obj = ImUtill.createTopics(patient + "_" + prescription.getCode() + "_" + ct.getType(), consult.getCode(), p.getName(), users, messages, ImUtill.SESSION_TYPE_PRESCRIPTION);
            if (obj == null) {
                throw new RuntimeException("IM消息发送异常!");
@ -951,7 +952,7 @@ public class ConsultTeamService extends ConsultService {
            consultTeamDao.save(ct);
            consultDao.save(consult);
            //记录咨询的医生详情
            //6、记录咨询的医生详情
            ConsultTeamDoctor cd = new ConsultTeamDoctor();
            cd.setConsult(consult.getCode());
            cd.setDel("1");
@ -959,13 +960,13 @@ public class ConsultTeamService extends ConsultService {
            cd.setTo(doctorCode);
            consultTeamDoctorDao.save(cd);
            //发送系统消息提示团队长有未审核的消息
            //7、发送系统消息提示团队长有未审核的消息
            addCheckMessage(prescription,p);
            // 保存医生咨询信息
            //8、 保存医生咨询信息
            // 添加咨询转发记录
            // 添加医生咨询日志
            String content = addLogs(ct);
            addLogs(ct);
            return 1;
        }
@ -1007,7 +1008,8 @@ public class ConsultTeamService extends ConsultService {
     * @param reason
     * @return
     */
    public Prescription savePrescription(Prescription prescription,String jwCode,Doctor doctor,Patient p,ConsultTeam ct,String reason){
    public String savePrescription(Prescription prescription,String jwCode,Doctor doctor,Patient p,ConsultTeam ct,String reason){
        String re = "";
        prescription.setCode(getCode());
        prescription.setParentCode(jwCode);
        prescription.setHospitalName(doctor.getHospitalName());
@ -1049,9 +1051,11 @@ public class ConsultTeamService extends ConsultService {
        diagnosis.setUpdateTime(new Date());
        prescriptionDiagnosisDao.save(diagnosis);
        re +=diagnosis.getName();
        prescriptionLogService.addLog(prescription,3,1,1);
        return prescription;
        return re;
    }
    /**

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -157,10 +157,10 @@ public class MessageService extends BaseService {
        if (prescriptionMessage != null && prescriptionMessage.size() > 0) {
            prescriptionJson.put("amount", prescriptionMessage.size());
            JSONObject msgJson = new JSONObject();
            msgJson.put("title", systemMessage.get(0).getTitle());
            msgJson.put("type", systemMessage.get(0).getType());
            msgJson.put("msg", systemMessage.get(0).getContent());
            msgJson.put("msgTime", DateUtil.dateToStrLong(systemMessage.get(0).getCreateTime()));
            msgJson.put("title", prescriptionMessage.get(0).getTitle());
            msgJson.put("type", prescriptionMessage.get(0).getType());
            msgJson.put("msg", prescriptionMessage.get(0).getContent());
            msgJson.put("msgTime", DateUtil.dateToStrLong(prescriptionMessage.get(0).getCreateTime()));
            prescriptionJson.put("lastMessage", msgJson);
        } else {
            prescriptionJson.put("amount", 0);

+ 44 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -1,8 +1,14 @@
package com.yihu.wlyy.web.doctor.prescription;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionPay;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.service.app.prescription.PrescriptionPayService;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -11,6 +17,8 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created by Trick on 2017/7/25.
 */
@ -23,6 +31,10 @@ public class PrescriptionInfoController extends BaseController{
    private PrescriptionInfoService prescriptionInfoService;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private PrescriptionPayService prescriptionPayService;
    /**
     * 确认配送 二维码方式
@ -143,5 +155,37 @@ public class PrescriptionInfoController extends BaseController{
        }
    }
    /**
     * 订单跟踪 包含处方药品信息 订单记录  支付记录
     * 根据处方code获取处方流程
     *
     * @param prescriptionCode
     * @return
     */
    @RequestMapping(value = "/prescriptionFollow", method = RequestMethod.GET)
    @ApiOperation(value = "获取处方订单详情")
    public String prescriptionFollow(
            @RequestParam(required = true) @ApiParam(value = "处方code", name = "prescriptionCode") String prescriptionCode) {
        try {
            JSONObject jo = new JSONObject();
            //获取处方信息
            Prescription prescription = prescriptionService.findByCode(prescriptionCode);
            //获取处方药品信息
            List<PrescriptionInfo> prescriptionInfos = prescriptionInfoService.getPrescriptionInfo(prescriptionCode);
            //获取付款信息
            PrescriptionPay prescriptionPay = prescriptionPayService.findByPrescriptionCode(prescriptionCode);
            //获取配送信息
            PrescriptionExpressage prescriptionExpressage = prescriptionExpressageService.findByPrescriptionCode(prescriptionCode);
            prescriptionExpressage.setDispensaryType(prescription.getType());//处方配送方式
            prescriptionExpressage.setStatus(prescription.getStatus());//处方状态
            jo.put("prescriptionInfos", prescriptionInfos);
            jo.put("prescriptionPay", prescriptionPay);
            jo.put("prescriptionExpressage", prescriptionExpressage);
            return write(200, "查询成功", "data", jo);
        } catch (Exception e) {
            return error(-1, "获取失败");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/express/SFExpressController.java

@ -130,7 +130,7 @@ public class SFExpressController extends BaseController {
        }
    }
    @RequestMapping(value="/SFOrderService",method = RequestMethod.POST)
    @RequestMapping(value="/SFOrderService",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("通过快递单号或者业务订单号查询包裹路由信息")
    public String SFRouteService(