yeshijie 7 роки тому
батько
коміт
5f15c8b04f

+ 15 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -276,4 +276,19 @@ public class PrescriptionController extends BaseController{
		}
	}
	/**---------------------顺丰快递相关接口---------------------**/
	@RequestMapping(value = "getSFExpressInfoByVisitNo",method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("根据基卫挂号单获取顺丰快递相关信息")
	public Result getSFExpressInfo(
			@ApiParam(name="visitNo", value="基卫处方编号") @RequestParam(value = "visitNo",required = true) String visitNo){
		try {
			return prescriptionService.getSFExpressInfoByVisitNo(visitNo);
		}catch (Exception e){
			e.printStackTrace();
			return Result.error(e.getMessage());
		}
	}
}

+ 2 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDao.java

@ -22,5 +22,6 @@ 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);
    @Query("from Prescription p where p.visitNo=?1")
    Prescription findByVisitNo(String visitNo);
}

+ 14 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionExpressageDao.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.service.dao.prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionExpressage;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface PrescriptionExpressageDao extends PagingAndSortingRepository<PrescriptionExpressage, Long>, JpaSpecificationExecutor<PrescriptionExpressage> {
    @Query("from PrescriptionExpressage p where p.prescriptionCode=?1 and p.del=1")
    PrescriptionExpressage findByPrescriptionPay(String prescriptionCode);
    @Query("from PrescriptionExpressage p where p.mailno=?1")
    PrescriptionExpressage findByPrescriptionExpressMailno(String mailno);
}

+ 10 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Hospital.java

@ -50,6 +50,8 @@ public class Hospital extends IdEntity {
	private String roadCode;
	//中心/站点
	private String centerSite;
	//联系电话
	private String phone;
	public String getDel() {
		return del;
@ -172,4 +174,12 @@ public class Hospital extends IdEntity {
	public void setCenterSite(String centerSite) {
		this.centerSite = centerSite;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
}

+ 307 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionExpressage.java

@ -0,0 +1,307 @@
package com.yihu.wlyy.service.entity.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.service.common.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "wlyy_prescription_expressage")
public class PrescriptionExpressage extends IdEntity {
    private String code;                    //业务code
    private String prescriptionCode;      //处方code  关联表wlyy_prescription code
    private String mailno;                  //快递单号
    private String name;                    //收货人名称
    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 Integer price;                    //快递的配送费用 单位是分
    private Integer weight;                  //快递重量  单位是g
    //配送人信息
    private String hospitalName;            // 如果配送方式是健管师那么这个字段存服务站名称,如果是快递配送那么是快递公司名称
    private String hospitalAddress;         // 机构地址
    private String expressageName;          //配送人名称
    private String expressageCode;          //配送人code
    private String expressageMobile;        //配送人电话
    private Date expressageTime;                //开始配送的时间
    //医院接收快递信息
    private String acceptMobile;        //医院药品接收人电话
    private String acceptCode;        //医院药品接收人Code
    private String acceptName;        //医院药品接收人名称
    private String acceptHospital;        //医院药品接收人名称
    private String acceptHospitalName;        //医院药品接收人名称
    private Date acceptTime;                //接收的时间
    private Integer oneselfPickupFlg;//是否自取 1是 0否
    private Date createTime;                //创建的时间
    private Integer del;    //1可用 0删除
    @Column(name = "code", unique = true , nullable=false)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTownCode() {
        return townCode;
    }
    public void setTownCode(String townCode) {
        this.townCode = townCode;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public String getStreetCode() {
        return streetCode;
    }
    public void setStreetCode(String streetCode) {
        this.streetCode = streetCode;
    }
    public String getStreetName() {
        return streetName;
    }
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public Integer getPrice() {
        return price;
    }
    public void setPrice(Integer price) {
        this.price = price;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getOneselfPickupFlg() {
        return oneselfPickupFlg;
    }
    public void setOneselfPickupFlg(Integer oneselfPickupFlg) {
        this.oneselfPickupFlg = oneselfPickupFlg;
    }
    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;
    }
    public Integer getWeight() {
        return weight;
    }
    public void setWeight(Integer weight) {
        this.weight = weight;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getHospitalAddress() {
        return hospitalAddress;
    }
    public void setHospitalAddress(String hospitalAddress) {
        this.hospitalAddress = hospitalAddress;
    }
    public String getAcceptMobile() {
        return acceptMobile;
    }
    public void setAcceptMobile(String acceptMobile) {
        this.acceptMobile = acceptMobile;
    }
    public String getAcceptCode() {
        return acceptCode;
    }
    public void setAcceptCode(String acceptCode) {
        this.acceptCode = acceptCode;
    }
    public String getAcceptName() {
        return acceptName;
    }
    public void setAcceptName(String acceptName) {
        this.acceptName = acceptName;
    }
    public String getAcceptHospital() {
        return acceptHospital;
    }
    public void setAcceptHospital(String acceptHospital) {
        this.acceptHospital = acceptHospital;
    }
    public String getAcceptHospitalName() {
        return acceptHospitalName;
    }
    public void setAcceptHospitalName(String acceptHospitalName) {
        this.acceptHospitalName = acceptHospitalName;
    }
    public Date getExpressageTime() {
        return expressageTime;
    }
    public void setExpressageTime(Date expressageTime) {
        this.expressageTime = expressageTime;
    }
    public Date getAcceptTime() {
        return acceptTime;
    }
    public void setAcceptTime(Date acceptTime) {
        this.acceptTime = acceptTime;
    }
}

+ 198 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/VO/PrescriptionExpressageVO.java

@ -0,0 +1,198 @@
package com.yihu.wlyy.service.entity.prescription.VO;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo;
import java.util.ArrayList;
import java.util.List;
public class PrescriptionExpressageVO extends Result {
    //快递编号
    private String mailno;
    //业务类型:如标准快递
    private String mailtype;
    //目的地区域代码
    private String destcode;
    /**----寄方信息----**/
    // 医院名稱
    private String j_name;
    //省份名称
    private String j_provinceName;
    //城市名称
    private String j_cityName;
    //区县名称
    private String j_townName;
    //医院详细地址
    private String j_address;
    //联系电话
    private String j_phone;
    /**----收方信息----**/
    //收货人名称
    private String d_name;
    //省份名称
    private String d_provinceName;
    //城市名称
    private String d_cityName;
    //区县名称
    private String d_townName;
    //医院详细地址
    private String d_address;
    //收货人座机号
    private String d_phone;
    //产品类别:11--医药常温
    private Integer express_type;
    //付款方式:1:寄方付,2:收方付 3:第三方付
    private Integer pay_method;
    //订单的药品详情
    private List<PrescriptionInfo> infos = new ArrayList<>();
    public String getMailno() {
        return mailno;
    }
    public void setMailno(String mailno) {
        this.mailno = mailno;
    }
    public String getJ_name() {
        return j_name;
    }
    public void setJ_name(String j_name) {
        this.j_name = j_name;
    }
    public String getJ_provinceName() {
        return j_provinceName;
    }
    public void setJ_provinceName(String j_provinceName) {
        this.j_provinceName = j_provinceName;
    }
    public String getJ_cityName() {
        return j_cityName;
    }
    public void setJ_cityName(String j_cityName) {
        this.j_cityName = j_cityName;
    }
    public String getJ_townName() {
        return j_townName;
    }
    public void setJ_townName(String j_townName) {
        this.j_townName = j_townName;
    }
    public String getJ_address() {
        return j_address;
    }
    public void setJ_address(String j_address) {
        this.j_address = j_address;
    }
    public String getJ_phone() {
        return j_phone;
    }
    public void setJ_phone(String j_phone) {
        this.j_phone = j_phone;
    }
    public String getD_name() {
        return d_name;
    }
    public void setD_name(String d_name) {
        this.d_name = d_name;
    }
    public String getD_provinceName() {
        return d_provinceName;
    }
    public void setD_provinceName(String d_provinceName) {
        this.d_provinceName = d_provinceName;
    }
    public String getD_cityName() {
        return d_cityName;
    }
    public void setD_cityName(String d_cityName) {
        this.d_cityName = d_cityName;
    }
    public String getD_townName() {
        return d_townName;
    }
    public void setD_townName(String d_townName) {
        this.d_townName = d_townName;
    }
    public String getD_address() {
        return d_address;
    }
    public void setD_address(String d_address) {
        this.d_address = d_address;
    }
    public String getD_phone() {
        return d_phone;
    }
    public void setD_phone(String d_phone) {
        this.d_phone = d_phone;
    }
    public Integer getExpress_type() {
        return express_type;
    }
    public void setExpress_type(Integer express_type) {
        this.express_type = express_type;
    }
    public Integer getPay_method() {
        return pay_method;
    }
    public void setPay_method(Integer pay_method) {
        this.pay_method = pay_method;
    }
    public List<PrescriptionInfo> getInfos() {
        return infos;
    }
    public void setInfos(List<PrescriptionInfo> infos) {
        this.infos = infos;
    }
    public String getMailtype() {
        return mailtype;
    }
    public void setMailtype(String mailtype) {
        this.mailtype = mailtype;
    }
    public String getDestcode() {
        return destcode;
    }
    public void setDestcode(String destcode) {
        this.destcode = destcode;
    }
}

+ 66 - 8
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -2,22 +2,20 @@ package com.yihu.wlyy.service.service.prescription;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.dao.DoctorMappingDao;
import com.yihu.wlyy.service.dao.HospitalDao;
import com.yihu.wlyy.service.dao.PatientDao;
import com.yihu.wlyy.service.dao.SignFamilyDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionDiagnosisDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionLogDao;
import com.yihu.wlyy.service.dao.prescription.*;
import com.yihu.wlyy.service.entity.Hospital;
import com.yihu.wlyy.service.entity.Patient;
import com.yihu.wlyy.service.entity.SignFamily;
import com.yihu.wlyy.service.entity.prescription.Prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionDiagnosis;
import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo;
import com.yihu.wlyy.service.entity.prescription.PrescriptionLog;
import com.yihu.wlyy.service.entity.prescription.*;
import com.yihu.wlyy.service.entity.prescription.VO.PrescriptionExpressageVO;
import com.yihu.wlyy.service.service.ZysoftBaseService;
import net.sf.json.JSONArray;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -56,6 +54,10 @@ public class PrescriptionService extends ZysoftBaseService{
    private SignFamilyDao signFamilyDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private HospitalDao hospitalDao;
    private String channelTopic = "redisPrescription";
@ -497,4 +499,60 @@ public class PrescriptionService extends ZysoftBaseService{
    /*********************************************请求智业接口数据 end**************************************************/
    /*********************************************智业请求顺丰快递接口数据 START**************************************************/
    /**
     * 根据基卫处方编码获取顺丰快递相关信息
     * @param visitNo
     * @return
     */
    public Result getSFExpressInfoByVisitNo(String visitNo) {
        //根据基卫处方编号获取处方信息
        Prescription prescription = prescriptionDao.findByVisitNo(visitNo);
        if(prescription == null){
            return Result.error(-1,"查询失败,未找到处方,挂号单为:"+visitNo);
        }
        //根据处方编码获取处方快递信息
        PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionPay(prescription.getCode());
        if(prescriptionExpressage == null || StringUtils.isBlank(prescriptionExpressage.getMailno())){
            return Result.error(-2,"查询失败,该处方的快递还未成功下单,挂号单为:"+visitNo);
        }
        //根据医院CODE,获取医院详细
        Hospital hospital = hospitalDao.findByCode(prescription.getHospital());
        //获取订单的药品详情
        List<PrescriptionInfo> prescriptionInfolist = prescriptionInfoDao.findByPrescriptionCode(prescription.getCode());
        PrescriptionExpressageVO vo = new PrescriptionExpressageVO();
        vo.setMailno(prescriptionExpressage.getMailno());
        vo.setMailtype("标准快递");
        vo.setDestcode(prescriptionExpressage.getCityCode());
        //-----寄方信息----
        vo.setJ_name(hospital.getName());
        vo.setJ_provinceName(hospital.getProvinceName());
        vo.setJ_cityName(hospital.getCityName());
        vo.setJ_townName(hospital.getTownName());
        vo.setJ_address(hospital.getAddress());
        vo.setJ_phone(hospital.getPhone());
        //-----收方信息-----
        vo.setD_name(prescriptionExpressage.getName());
        vo.setD_provinceName(prescriptionExpressage.getProvinceName());
        vo.setD_cityName(prescriptionExpressage.getCityName());
        vo.setD_townName(prescriptionExpressage.getTownName());
        vo.setD_address(prescriptionExpressage.getAddress());
        vo.setD_phone(prescriptionExpressage.getPhone());
        vo.setPay_method(2);
        vo.setExpress_type(11);
        vo.setInfos(prescriptionInfolist);
        return Result.success("查询成功",vo);
    }
    /*********************************************智业请求顺丰快递接口数据 END**************************************************/
}

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/express/SFExpressService.java

@ -212,12 +212,14 @@ public class SFExpressService extends BaseService {
            String filter_result = "";
            String orderid = "";//业务订单号
            String mailno = "";//顺丰运单号
            String destCode = "";//目的地区域代码
            List<?> child = root.elements();
            for (Object o : child) {
                Element e = (Element) o;
                filter_result = e.attributeValue("filter_result");
                orderid = e.attributeValue("orderid");
                mailno = e.attributeValue("mailno");
                destCode = e.attributeValue("destCode");
            }
            if(StringUtils.isNotBlank(filter_result) && "3".equals(filter_result)){
                logger.info("顺丰快递下订单失败:派送地址不可派送,处方编号:"+sfexpress_obj.getPrescriptionCode());
@ -229,6 +231,7 @@ public class SFExpressService extends BaseService {
                throw new Exception("顺丰快递下订单失败:未获取到快递单号!");
            }
            sfexpress_obj.setMailno(mailno);
            sfexpress_obj.setCityCode(destCode);
        }
        return sfexpress_obj;
    }
@ -526,6 +529,7 @@ public class SFExpressService extends BaseService {
                String filter_result = "";
                String orderid = "";//业务订单号
                String mailno = "";//顺丰运单号
                String destCode = "";//目的地区域代码
                //错误代对应的文字
                Document redoc = doc.selectSingleNode("/Response/Body/Orderresponse").getDocument();
@ -536,6 +540,7 @@ public class SFExpressService extends BaseService {
                    filter_result = e.attributeValue("filter_result");
                    orderid = e.attributeValue("orderid");
                    mailno = e.attributeValue("mailno");
                    destCode = e.attributeValue("destCode");
                }
                if(StringUtils.isBlank(mailno)){
@ -549,6 +554,7 @@ public class SFExpressService extends BaseService {
                }
                sfexpress_obj.setMailno(mailno);
                sfexpress_obj.setCityCode(destCode);
            }
            //如果成功获取到快递单号,则保存处方物流记录,保存配送日志

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SFUtils.java

@ -162,7 +162,7 @@ public class SFUtils {
        xml.append("d_province='"+sfexpress_obj.getProvinceName()+"' ");
        xml.append("d_city='"+sfexpress_obj.getCityName()+"' ");
        xml.append("d_county='"+sfexpress_obj.getTownName()+"' ");
        //快件产品类别:21,医药专运(常温)
        //快件产品类别:11,医药常温
        //付款方式:1:寄方付,2:收方付 3:第三方付
        xml.append("express_type='11' pay_method='2' >");
//        xml.append("express_type='11' pay_method='1' custid='9999999999'>");