Browse Source

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

trick9191 7 years ago
parent
commit
e2d17c0f44
14 changed files with 917 additions and 91 deletions
  1. 130 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/DmExpressagePriceEntity.java
  2. 1 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  3. 185 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionInfo.java
  4. 129 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionReviewed.java
  5. 19 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/dict/DmExpressagePriceDao.java
  6. 173 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  7. 20 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  8. 33 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/express/SFExpressService.java
  9. 4 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/httplog/LogService.java
  10. 93 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java
  11. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SFUtils.java
  12. 100 34
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  13. 2 20
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/express/SFExpressApiController.java
  14. 25 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/express/SFExpressController.java

+ 130 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/dict/DmExpressagePriceEntity.java

@ -0,0 +1,130 @@
package com.yihu.wlyy.entity.dict;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 快递价目表
 */
@Entity
@Table(name = "dm_expressage_price", schema = "wlyy", catalog = "")
public class DmExpressagePriceEntity extends IdEntity {
    private String code;
    private String startAddressName;
    private String endAddressName;
    private Integer firstWeight;
    private Integer firstWeightPrice;
    private Integer continueWeight;
    private Integer continueWeightPrice;
    @Basic
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Basic
    @Column(name = "start_address_name")
    public String getStartAddressName() {
        return startAddressName;
    }
    public void setStartAddressName(String startAddressName) {
        this.startAddressName = startAddressName;
    }
    @Basic
    @Column(name = "end_address_name")
    public String getEndAddressName() {
        return endAddressName;
    }
    public void setEndAddressName(String endAddressName) {
        this.endAddressName = endAddressName;
    }
    @Basic
    @Column(name = "first_weight")
    public Integer getFirstWeight() {
        return firstWeight;
    }
    public void setFirstWeight(Integer firstWeight) {
        this.firstWeight = firstWeight;
    }
    @Basic
    @Column(name = "first_weight_price")
    public Integer getFirstWeightPrice() {
        return firstWeightPrice;
    }
    public void setFirstWeightPrice(Integer firstWeightPrice) {
        this.firstWeightPrice = firstWeightPrice;
    }
    @Basic
    @Column(name = "continue_weight")
    public Integer getContinueWeight() {
        return continueWeight;
    }
    public void setContinueWeight(Integer continueWeight) {
        this.continueWeight = continueWeight;
    }
    @Basic
    @Column(name = "continue_weight_price")
    public Integer getContinueWeightPrice() {
        return continueWeightPrice;
    }
    public void setContinueWeightPrice(Integer continueWeightPrice) {
        this.continueWeightPrice = continueWeightPrice;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DmExpressagePriceEntity that = (DmExpressagePriceEntity) o;
        if (id != null ? !id.equals(that.id) : that.id != null) return false;
        if (code != null ? !code.equals(that.code) : that.code != null) return false;
        if (startAddressName != null ? !startAddressName.equals(that.startAddressName) : that.startAddressName != null)
            return false;
        if (endAddressName != null ? !endAddressName.equals(that.endAddressName) : that.endAddressName != null)
            return false;
        if (firstWeight != null ? !firstWeight.equals(that.firstWeight) : that.firstWeight != null) return false;
        if (firstWeightPrice != null ? !firstWeightPrice.equals(that.firstWeightPrice) : that.firstWeightPrice != null)
            return false;
        if (continueWeight != null ? !continueWeight.equals(that.continueWeight) : that.continueWeight != null)
            return false;
        if (continueWeightPrice != null ? !continueWeightPrice.equals(that.continueWeightPrice) : that.continueWeightPrice != null)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (code != null ? code.hashCode() : 0);
        result = 31 * result + (startAddressName != null ? startAddressName.hashCode() : 0);
        result = 31 * result + (endAddressName != null ? endAddressName.hashCode() : 0);
        result = 31 * result + (firstWeight != null ? firstWeight.hashCode() : 0);
        result = 31 * result + (firstWeightPrice != null ? firstWeightPrice.hashCode() : 0);
        result = 31 * result + (continueWeight != null ? continueWeight.hashCode() : 0);
        result = 31 * result + (continueWeightPrice != null ? continueWeightPrice.hashCode() : 0);
        return result;
    }
}

+ 1 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -22,7 +22,7 @@ public class Prescription extends IdEntity {
    private String jwCode;                  //基卫的处方code
    private String parentCode;             //如果是续方 那就是处方的code
    private Date createTime;               //处方创建时间
    private Date reviewedTime;             //过期时间
    private Date reviewedTime;             //审核时间
    private Date payTime;                   //支付时间
    private Date dosageTime;                //配药完成时间
    private Date dispatchingTime;          //配送员领药时间
@ -50,7 +50,6 @@ public class Prescription extends IdEntity {
    private String caMessage;                   //ca指纹信息
    private String remark;                     //处方备注
    private String reason;                      //续方原因
    private String reviewedReason; //审核不通过的原因
    //    private Double ybCost;                      //医保费用
//    private Double myCost;                      //自己付费
    private Integer prescriptionType;          //处方类型:1、门诊处方,2、住院处方
@ -316,14 +315,6 @@ public class Prescription extends IdEntity {
        this.caCertData = caCertData;
    }
    public String getReviewedReason() {
        return reviewedReason;
    }
    public void setReviewedReason(String reviewedReason) {
        this.reviewedReason = reviewedReason;
    }
    public Integer getPrescriptionType() {
        return prescriptionType;
    }

+ 185 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionInfo.java

@ -1,12 +1,10 @@
package com.yihu.wlyy.entity.patient.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Administrator on 2017/7/21.
@ -25,8 +23,28 @@ public class PrescriptionInfo extends IdEntity{
    private Integer num;                    //药品数目
    private Integer isRefrigerate;         //是否冷藏 1是 0否
    private String direction;               //药品用法
    private Double price;                    //药品价格
    private Double price;                    //药品单价
    private Integer del;               //1可用 0删除 不填数据库默认是1
    private String jwSubCode;//智业子处方号
    private String drugNumUnit;//数量单位编码
    private String drugNumUnitName;//数量单位名称
    private Double cost;//金额
    private String charge;//自付
    private String bindFlag;//成组标志, 0.非成组,1.成组
    private Integer dayCount;//用药天数
    private String drugUsage;//用药方法编码
    private String usageName;//用药方法名称
    private String physicDose;//用药剂量
    private String physicDoseUnit;//剂量单位编码
    private String physicDoseUnitName;//剂量单位名称
    private String physicAmount;//用药总量
    private String physicAmountUnit;//总量单位编码
    private String physicAmountUnitName;//总量单位名称
    private String physicInjectPlace;//注射地点编码
    private String physicInjectPlaceName;//注射地点名称
    private String physicSkinTest;//注射地点名称
    private String physicSkinTestName;//皮试类型名称
    private String remark;//备注
    @Column(name = "code",unique = true , nullable=false)
    public String getCode() {
@ -119,4 +137,168 @@ public class PrescriptionInfo extends IdEntity{
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getJwSubCode() {
        return jwSubCode;
    }
    public void setJwSubCode(String jwSubCode) {
        this.jwSubCode = jwSubCode;
    }
    public String getDrugNumUnit() {
        return drugNumUnit;
    }
    public void setDrugNumUnit(String drugNumUnit) {
        this.drugNumUnit = drugNumUnit;
    }
    public String getDrugNumUnitName() {
        return drugNumUnitName;
    }
    public void setDrugNumUnitName(String drugNumUnitName) {
        this.drugNumUnitName = drugNumUnitName;
    }
    public Double getCost() {
        return cost;
    }
    public void setCost(Double cost) {
        this.cost = cost;
    }
    public String getCharge() {
        return charge;
    }
    public void setCharge(String charge) {
        this.charge = charge;
    }
    @Column(name = "bind_flag")
    public String getBindFlag() {
        return bindFlag;
    }
    public void setBindFlag(String bindFlag) {
        this.bindFlag = bindFlag;
    }
    @Column(name = "day_count")
    public Integer getDayCount() {
        return dayCount;
    }
    public void setDayCount(Integer dayCount) {
        this.dayCount = dayCount;
    }
    public String getDrugUsage() {
        return drugUsage;
    }
    public void setDrugUsage(String drugUsage) {
        this.drugUsage = drugUsage;
    }
    @Column(name = "usage_name")
    public String getUsageName() {
        return usageName;
    }
    public void setUsageName(String usageName) {
        this.usageName = usageName;
    }
    @Column(name = "physic_dose")
    public String getPhysicDose() {
        return physicDose;
    }
    public void setPhysicDose(String physicDose) {
        this.physicDose = physicDose;
    }
    public String getPhysicDoseUnit() {
        return physicDoseUnit;
    }
    public void setPhysicDoseUnit(String physicDoseUnit) {
        this.physicDoseUnit = physicDoseUnit;
    }
    public String getPhysicDoseUnitName() {
        return physicDoseUnitName;
    }
    public void setPhysicDoseUnitName(String physicDoseUnitName) {
        this.physicDoseUnitName = physicDoseUnitName;
    }
    public String getPhysicAmount() {
        return physicAmount;
    }
    public void setPhysicAmount(String physicAmount) {
        this.physicAmount = physicAmount;
    }
    public String getPhysicAmountUnit() {
        return physicAmountUnit;
    }
    public void setPhysicAmountUnit(String physicAmountUnit) {
        this.physicAmountUnit = physicAmountUnit;
    }
    public String getPhysicAmountUnitName() {
        return physicAmountUnitName;
    }
    public void setPhysicAmountUnitName(String physicAmountUnitName) {
        this.physicAmountUnitName = physicAmountUnitName;
    }
    public String getPhysicInjectPlace() {
        return physicInjectPlace;
    }
    public void setPhysicInjectPlace(String physicInjectPlace) {
        this.physicInjectPlace = physicInjectPlace;
    }
    public String getPhysicInjectPlaceName() {
        return physicInjectPlaceName;
    }
    public void setPhysicInjectPlaceName(String physicInjectPlaceName) {
        this.physicInjectPlaceName = physicInjectPlaceName;
    }
    public String getPhysicSkinTest() {
        return physicSkinTest;
    }
    public void setPhysicSkinTest(String physicSkinTest) {
        this.physicSkinTest = physicSkinTest;
    }
    public String getPhysicSkinTestName() {
        return physicSkinTestName;
    }
    public void setPhysicSkinTestName(String physicSkinTestName) {
        this.physicSkinTestName = physicSkinTestName;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 129 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionReviewed.java

@ -0,0 +1,129 @@
package com.yihu.wlyy.entity.patient.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
 * Created by Administrator on 2017/7/21.
 * 处方日志
 */
@Entity
@Table(name = "wlyy_prescription_log")
public class PrescriptionReviewed extends IdEntity {
    private String code;                    //业务流程
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private Date createTime;               //处方创建时间
    private String hospital;                  //医院 关联 dm_hospital code
    private String hospitalName;              //医院 关联 dm_hospital name
    private String dept;                       //科室code
    private String deptName;                   //科室名称
    private String doctor;                  //审核医生
    private String doctorName;                  //审核医生名称
    private Integer status;               //  1审核通过1 0待审核  -1  审核通过   -2无效审核
    private String reason;                  //审核不通过原因
    private String remark;                  //备注
    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 Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/dict/DmExpressagePriceDao.java

@ -0,0 +1,19 @@
package com.yihu.wlyy.repository.dict;
import com.yihu.wlyy.entity.dict.DmExpressagePriceEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 快递费用
 * @author huangwenjie 2017.08.03
 */
public interface DmExpressagePriceDao extends
        PagingAndSortingRepository<DmExpressagePriceEntity, Long>,
        JpaSpecificationExecutor<DmExpressagePriceEntity> {
    @Query("from DmExpressagePriceEntity where code = ?1 and endAddressName LIKE ?2 ")
    DmExpressagePriceEntity getExprePriceEntityByCodeAndEndAdressName(String code,String end_address_name);
}

+ 173 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.app.account;
import com.alibaba.fastjson.JSON;
import com.yihu.wlyy.entity.address.City;
import com.yihu.wlyy.entity.address.Province;
import com.yihu.wlyy.entity.address.Town;
@ -28,17 +29,18 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.third.httplog.LogService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.EncodesUtil;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@ -54,6 +56,7 @@ import org.springside.modules.persistence.SearchFilter.Operator;
import org.springside.modules.security.utils.Digests;
import org.springside.modules.utils.Encodes;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -113,6 +116,16 @@ public class DoctorInfoService extends BaseService {
    @Autowired
    private PushMsgTask pushMsgTask;
    //基卫服务地址
    @Value("${sign.check_upload}")
    private String jwUrl;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    @Autowired
    private LogService logService;
    /**
     * 获取医生的签约病人
     *
@ -1268,17 +1281,164 @@ public class DoctorInfoService extends BaseService {
        }
    }
//    /**
//     * 审方密码设置
//     * @param passwoed
//     * @return
//     */
//    @Transactional
//    public void setCheckPassword(Doctor doctor,String passwoed){
//
//        byte[] salt = Digests.generateSalt(8);
//        doctor.setCheckSalt(Encodes.encodeHex(salt));
//        byte[] hashPassword = Digests.sha1(passwoed.getBytes(), salt, 1024);
//        doctor.setCheckPassword(Encodes.encodeHex(hashPassword));
//    }
    /**
     * 审方密码设置
     * @param passwoed
     * @return
     * 获取CA证书过期时间
     */
    @Transactional
    public void setCheckPassword(Doctor doctor,String passwoed){
    public JSONObject getCAPastDue(String strUserIdcardNum)  throws Exception{
        Boolean isSuccess = true;
        String url = jwUrl+"/third/prescription/GetRealNameSoftCertExpiredDatetime";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            String msg = responseObject.getString("msg");
            if (status == 200) {
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                } else {
//                    JSONObject jsonData = new JSONObject(data);
//                    JSONArray jsonArray = jsonData.getJSONArray("EventList");
//                    re = jsonArray.toString();
                    JSONObject jsonObject = new JSONObject();
                    //1、有证书,并有效,2、有证书,已过期,3、无证书
                    if(StringUtils.isNotEmpty(data)){
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        long times = simpleDateFormat.parse(data).getTime();
                        if(System.currentTimeMillis()<=times){
                            jsonObject.put("type",1);
                        }else{
                            jsonObject.put("type",2);
                        }
                    }else{
                        jsonObject.put("type",3);
                    }
                    jsonObject.put("time",data);
                    return jsonObject;
                }
            } else {
                throw new Exception(responseObject.getString("msg"));
            }
        }else {
            throw new Exception("null response.");
        }
    }
        byte[] salt = Digests.generateSalt(8);
        doctor.setCheckSalt(Encodes.encodeHex(salt));
        byte[] hashPassword = Digests.sha1(passwoed.getBytes(), salt, 1024);
        doctor.setCheckPassword(Encodes.encodeHex(hashPassword));
    /**
     * 修改实名软证书调用保护口令
     */
    public boolean updateAuthenticationPassword(String strUserIdcardNum,String strOldCalledPasswd,String strNewCalledPasswd) throws Exception{
        String url = jwUrl+"/third/prescription/ModifyRealNameSoftCertCalledPasswd";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        params.add(new BasicNameValuePair("strOldCalledPasswd",strOldCalledPasswd));
        params.add(new BasicNameValuePair("strNewCalledPasswd",strNewCalledPasswd));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            String msg = responseObject.getString("msg");
            if (status == 200) {
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                }else{
                    if("0".equals(data)){
                        return true;
                    }
                }
            }else{
                throw new Exception(responseObject.getString("msg"));
            }
        }else{
            throw new Exception("null response.");
        }
        return false;
    }
    public boolean requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData, String srcBusinessStreamNO) throws Exception{
        String url = jwUrl+"/third/prescription/RequestRealNameSoftCertAndSign";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strUserIdcardNum",strUserIdcardNum));
        params.add(new BasicNameValuePair("strRealNameSoftCertCalledPasswd",strRealNameSoftCertCalledPasswd));
        params.add(new BasicNameValuePair("strOriginalData",strOriginalData));
        params.add(new BasicNameValuePair("srcBusinessStreamNO",srcBusinessStreamNO));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            String msg = responseObject.getString("msg");
            if (status == 200) {
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                }else{
                    String[] str = data.split("||");
//                    String strSignData = str[0];
//                    String strCertData = str[1];
//                    JSONObject jsonObject = new JSONObject();
//                    jsonObject.put("strSignData",str[0]);
//                    jsonObject.put("strCertData",str[1]);
                    return verifySignOnMultiServer(str[0],str[1],strOriginalData);
//                    return jsonObject;
                }
            }else{
                throw new Exception(responseObject.getString("msg"));
            }
        }else{
            throw new Exception("null response.");
        }
    }
    //验证签名( ( 带多服务器负载均衡) )
    public boolean verifySignOnMultiServer(String strSignData,String strCertData,String strOriginalData) throws Exception{
        String url = jwUrl+"/third/prescription/VerifySignOnMultiServer";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSignData",strSignData));
        params.add(new BasicNameValuePair("strCertData",strCertData));
        params.add(new BasicNameValuePair("strOriginalData",strOriginalData));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            String msg = responseObject.getString("msg");
            if (status == 200) {
                String data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                    throw new Exception(data);
                }else{
                    if("0".equals(data)){
                        return true;
                    }
                }
            }else{
                throw new Exception(responseObject.getString("msg"));
            }
        }else{
            throw new Exception("null response.");
        }
        return false;
    }
}

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

@ -1041,6 +1041,26 @@ public class ConsultTeamService extends ConsultService {
        prescriptionInfo.setDrugFormat("2.5mg*80片/盒");//药品规格
        prescriptionInfo.setNum(10);//药品数目
        prescriptionInfo.setIsRefrigerate(0);//是否冷藏 1是 0否
        prescriptionInfo.setJwSubCode("");//智业子处方号
        prescriptionInfo.setDrugNumUnit("");//数量单位编码
        prescriptionInfo.setDrugNumUnitName("");//数量单位名称
        prescriptionInfo.setCost(1.00d);//金额
        prescriptionInfo.setCharge("");//自付
        prescriptionInfo.setBindFlag("0");//成组标志, 0.非成组,1.成组
        prescriptionInfo.setDayCount(2);//用药天数
        prescriptionInfo.setDrugUsage("");//用药方法编码
        prescriptionInfo.setUsageName("");//用药方法名称
        prescriptionInfo.setPhysicDose("");//用药剂量
        prescriptionInfo.setPhysicDoseUnit("");//剂量单位编码
        prescriptionInfo.setPhysicDoseUnitName("");//剂量单位名称
        prescriptionInfo.setPhysicAmount("");//用药总量
        prescriptionInfo.setPhysicAmountUnit("");//总量单位编码
        prescriptionInfo.setPhysicAmountUnitName("");//总量单位名称
        prescriptionInfo.setPhysicInjectPlace("");//注射地点编码
        prescriptionInfo.setPhysicInjectPlaceName("");//注射地点名称
        prescriptionInfo.setPhysicSkinTest("");//注射地点名称
        prescriptionInfo.setPhysicSkinTestName("");//皮试类型名称
        prescriptionInfo.setRemark("");//备注
        prescriptionInfoDao.save(prescriptionInfo);
        PrescriptionDiagnosis diagnosis = new PrescriptionDiagnosis();

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

@ -1,9 +1,11 @@
package com.yihu.wlyy.service.app.express;
import com.yihu.wlyy.entity.dict.DmExpressagePriceEntity;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressageLog;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.repository.dict.DmExpressagePriceDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionExpressageLogDao;
@ -59,6 +61,9 @@ public class SFExpressService extends BaseService {
    @Autowired
    private SFUtils SFUtils;
    @Autowired
    private JpaTransactionManager transactionManager;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
@ -66,7 +71,7 @@ public class SFExpressService extends BaseService {
    private PrescriptionDao prescriptionDao;
    @Autowired
    private JpaTransactionManager transactionManager;
    private DmExpressagePriceDao dmExpressagePriceDao;
    @Autowired
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
@ -391,13 +396,13 @@ public class SFExpressService extends BaseService {
        //根据快递单号获取处方配送详细信息
        PrescriptionExpressage sfexpress = prescriptionExpressageDao.findByPrescriptionExpressMailno(mailno);
        //根据快递单号获取本地的路由信息
        List<PrescriptionExpressageLog> localroutinfos = prescriptionExpressageLogDao.findByPrescriptionCode(sfexpress.getPrescriptionCode());
        //需要增量更新到本地的路由信息集合
        List<PrescriptionExpressageLog> newroutinfolist = new ArrayList<>();
        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事务隔离级别,开启新事务
        TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
        try {
@ -412,6 +417,7 @@ public class SFExpressService extends BaseService {
            for (PrescriptionExpressageLog pushlog: pushSFLogs) {
                //判断是否有已收件的路由节点
                if("已收件".equals(pushlog.getAcceptRemark())){
                    isContainEndRoutInfo = true;
                }
@ -429,7 +435,7 @@ public class SFExpressService extends BaseService {
                prescriptionExpressageLogDao.save(newroutinfolist);
            }
            //如果路由信息节点包含了"已收件"节点,这修改处方派送状态为完成,增加物流派送日志为完成
            //如果路由信息节点包含了"已收件"节点,则修改处方状态为完成,增加物流派送日志为完成
            if(isContainEndRoutInfo){
                //修改处方状态为完成
                prescriptionDao.updateStatus(sfexpress.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.finish.getValue());
@ -453,4 +459,26 @@ public class SFExpressService extends BaseService {
    }
    /**
     * 根据收寄地址获取快递费用
     * @param d_province 省份名称
     * @param d_city     城市名称
     * @return
     */
    public DmExpressagePriceEntity getSFExpressPrice(String d_province, String d_city) {
        String end_address_name = "";
        if("厦门市".equals(d_city)){
            end_address_name = "同城";
        }else{
            if("福建省".equals(d_province)){
                end_address_name = "省内";
            }else{
                end_address_name = d_city;
            }
        }
        DmExpressagePriceEntity sfprice =  dmExpressagePriceDao.getExprePriceEntityByCodeAndEndAdressName("shunfeng",end_address_name);
        return sfprice;
    }
}

+ 4 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/httplog/LogService.java

@ -22,9 +22,10 @@ public class LogService {
    private SystemDictService systemDictService;
    public String openApiType = "0";
    public String signType = "1";
    public String archiveType = "2";
    public String onepayType = "3";
    public String signType = "1";   //签约
    public String archiveType = "2";    //档案
    public String onepayType = "3"; //医保支付
    public String caType = "4";     //CA认证

+ 93 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -0,0 +1,93 @@
package com.yihu.wlyy.service.third.jw;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * 基位长处方接口
 * Created by yeshijie on 2017/8/3.
 */
@Service
public class JwPrescriptionService {
    //基卫服务地址
    @Value("${sign.check_upload}")
    private String jwUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 获取字典列表
     * @param dictName
     * @return
     * @throws Exception
     */
    public String getDictForI(String dictName) throws Exception{
        String url = jwUrl + "/third/prescription/getDictForI";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("dictName", dictName));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
    public String getRecipeTemplate(String dictName) throws Exception{
        String url = jwUrl + "/third/prescription/getRecipeTemplate";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("dictName", dictName));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
    public String getLastRecipe(String dictName) throws Exception{
        String url = jwUrl + "/third/prescription/getLastRecipe";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("dictName", dictName));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
    public String saveRecipe(String dictName) throws Exception{
        String url = jwUrl + "/third/prescription/saveRecipe";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("dictName", dictName));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
    public String getDispUnSettleFeeList(String dictName) throws Exception{
        String url = jwUrl + "/third/prescription/getDispUnSettleFeeList";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("dictName", dictName));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
    public String executeSickSettle(String dictName) throws Exception{
        String url = jwUrl + "/third/prescription/executeSickSettle";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("dictName", dictName));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
}

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

@ -66,7 +66,7 @@ public class SFUtils {
    public String getSFOrderFilterXml(String d_address,String sf_code,String orderid,String j_tel,String j_address,String d_tel){
        //head 传入接口接入码
        StringBuilder xml = new StringBuilder("<Request service='OrderFilterService' lang='zh-cn'> <Head>"+sf_code+"</Head><Body>");
        StringBuilder xml = new StringBuilder("<Request service='OrderFilterService' lang='zh-cn'><Head>"+sf_code+"</Head><Body>");
        xml.append("<OrderFilter filter_type='1' ");
        //订单号
@ -113,7 +113,7 @@ public class SFUtils {
     */
    public String postSFOrderService(PrescriptionExpressage sfexpress_obj,String sf_code) {
        //head 传入接口接入码
        StringBuilder xml = new StringBuilder("<Request service='OrderService' lang='zh-cn'> <Head>"+sf_code+"</Head><Body>");
        StringBuilder xml = new StringBuilder("<Request service='OrderService' lang='zh-cn'><Head>"+sf_code+"</Head><Body>");
        xml.append("<Order ");
        //订单号(快递业务号作为订单号"SF开头的为顺丰快递")
        xml.append("orderid='"+sfexpress_obj.getCode()+"' ");
@ -192,7 +192,7 @@ public class SFUtils {
     */
    public String getRoutInfos(PrescriptionExpressage sfexpress_obj, String sf_code) {
        //head 传入接口接入码
        StringBuilder xml = new StringBuilder("<Request service='RouteService' lang='zh-cn'> <Head>"+sf_code+"</Head><Body>");
        StringBuilder xml = new StringBuilder("<Request service='RouteService' lang='zh-cn'><Head>"+sf_code+"</Head><Body>");
        xml.append("<RouteRequest tracking_type='1' method_type='1' ").append("tracking_number='"+sfexpress_obj.getMailno()+"' />");
        xml.append("</Body></Request>");
        return xml.toString();

+ 100 - 34
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -26,9 +26,12 @@ import com.yihu.wlyy.util.*;
import io.swagger.annotations.Api;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
@ -95,6 +98,7 @@ public class DoctorController extends BaseController {
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 社区医院下医生列表查询接口 没分页
     *
@ -1888,57 +1892,119 @@ public class DoctorController extends BaseController {
        }
    }
    /**
     * 设置审方密码
     * @param password
     * @return
     */
    @RequestMapping(value = "/setCheckPassword", method = RequestMethod.POST)
    @ResponseBody
//    /**
//     * 设置审方密码
//     * @param password
//     * @return
//     */
//    @RequestMapping(value = "/setCheckPassword", method = RequestMethod.POST)
//    @ResponseBody
//    @ObserverRequired
//    public String setCheckPassword(@RequestParam String password){
//
//        try {
//
//            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
//            if (doctor == null) {
//                return error(-1, "密码设置失败!");
//            }
////            doctorInfoService.setCheckPassword(doctor,password);
//            return write(200, "密码设置成功");
//        }catch (Exception e){
//            error(e);
//            return invalidUserException(e, -1, "密码设置失败");
//        }
//    }
//    /**
//     * 修改审方密码
//     * @param oldPassword
//     * @param newPassword
//     * @return
//     */
//    @ObserverRequired
//    @ResponseBody
//    @RequestMapping(value = "/updateCheckPassword", method = RequestMethod.POST)
//    public String updateCheckPassword(@RequestParam String oldPassword,@RequestParam String newPassword){
//
//        try {
//            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
//            if (doctor == null) {
//                return error(-1, "修改审方密码失败!");
//            } else {
//                String encodePWD = EncodesUtil.entryptPassword(Encodes.decodeHex(doctor.getCheckSalt()), oldPassword);
//                if (StringUtils.equals(doctor.getCheckPassword(), encodePWD)) {
////                    doctorInfoService.setCheckPassword(doctor,newPassword);
//                    return write(200, "密码设置成功");
//                } else {
//                    return error(-1, "修改失败:审方旧密码错误!");
//                }
//            }
//        } catch (Exception e) {
//            error(e);
//            return invalidUserException(e, -1, "修改失败!");
//        }
//    }
    //获取实名软证书的过期时间
    @ObserverRequired
    public String setCheckPassword(@RequestParam String password){
    @ResponseBody
    @RequestMapping(value = "/getAuthenticationCA", method = RequestMethod.GET)
    public String getAuthenticationCA(){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            JSONObject data = doctorInfoService.getCAPastDue(doctor.getIdcard());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
            error(e);
            return error(-1, "获取信息失败!");
        }
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            if (doctor == null) {
                return error(-1, "密码设置失败!");
    }
    //修改实名软证书调用保护口令
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/updateAuthenticationPassword", method = RequestMethod.POST)
    public String updateAuthenticationPassword(
            @RequestParam(value = "strOldCalledPasswd",required = true) String strOldCalledPasswd,
            @RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd);
            if(b){
                return write(200, "修改密码成功!", "data", b);
            }
            doctorInfoService.setCheckPassword(doctor,password);
            return write(200, "密码设置成功");
        }catch (Exception e){
            return error(-1, "修改密码失败!");
        }catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "密码设置失败");
            return error(-1, "修改密码失败!");
        }
    }
    /**
     * 修改审方密码
     * @param oldPassword
     * @param newPassword
     * @return
     * 请求实名软证书并进行数字签名
     */
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/updateCheckPassword", method = RequestMethod.POST)
    public String updateCheckPassword(@RequestParam String oldPassword,@RequestParam String newPassword){
    @RequestMapping(value = "/requestRealNameSoftCertAndSign", method = RequestMethod.POST)
    public String requestRealNameSoftCertAndSign(
            @RequestParam(value = "strRealNameSoftCertCalledPasswd",required = true) String strRealNameSoftCertCalledPasswd,
            @RequestParam(value = "strOriginalData",required = true) String strOriginalData,
            @RequestParam(value = "srcBusinessStreamNO",required = true) String srcBusinessStreamNO){
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            if (doctor == null) {
                return error(-1, "修改审方密码失败!");
            } else {
                String encodePWD = EncodesUtil.entryptPassword(Encodes.decodeHex(doctor.getCheckSalt()), oldPassword);
                if (StringUtils.equals(doctor.getCheckPassword(), encodePWD)) {
                    doctorInfoService.setCheckPassword(doctor,newPassword);
                    return write(200, "密码设置成功");
                } else {
                    return error(-1, "修改失败:审方旧密码错误!");
                }
            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
//            JSONObject obj = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,srcBusinessStreamNO);
            boolean b = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,srcBusinessStreamNO);
            if(b){
                return write(200, "认证成功!", "data", b);
            }
        } catch (Exception e) {
            return error(-1, "认证失败!");
        }catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "修改失败!");
            return error(-1, "认证失败!");
        }
    }
}

+ 2 - 20
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/express/SFExpressApiController.java

@ -27,14 +27,7 @@ public class SFExpressApiController extends BaseController {
    @Autowired
    private SFExpressService sfexpressService;
    private String successxml = "<Response service=”RoutePushService”><Head>OK</Head></Response>";
    private String errorxml = "<Response service=”RoutePushService”>\n" +
            "\n" +
            "<Head>ERR</Head>\n" +
            "\n" +
            "<ERROR code=\"4001\">系统发生数据错误或运行时异常</ERROR>\n" +
            "\n" +
            "</Response>";
    private String successxml = "<Response service='RoutePushService'><Head>OK</Head></Response>";
    @RequestMapping(value="/routepushservice",method = RequestMethod.POST)
    @ResponseBody
@ -42,26 +35,15 @@ public class SFExpressApiController extends BaseController {
    @ObserverRequired
    public String SFRoutePushService (
            @ApiParam(name="xml", value="入参报文") @RequestParam(value = "xml",required = true) String xml){
        try {
            xml = URLDecoder.decode(xml,"utf-8");
            sfexpressService.SFRoutePushService(xml);
            return successxml;
        }catch (Exception e){
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return "<Response service=”RoutePushService”>\n" +
                    "\n" +
                    "<Head>ERR</Head>\n" +
                    "\n" +
                    "<ERROR code=\"-1\">系统发生数据错误或运行时异常</ERROR>\n" +
                    "\n" +
                    "</Response>";
            return "<Response service='RoutePushService'><Head>ERR</Head><ERROR code='-1'>系统发生数据错误或运行时异常</ERROR></Response>";
        }
    }
}

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

@ -2,6 +2,7 @@ package com.yihu.wlyy.web.patient.express;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.dict.DmExpressagePriceEntity;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressage;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionExpressageLog;
@ -172,4 +173,28 @@ public class SFExpressController extends BaseController {
        }
    }
    @RequestMapping(value = "/getsfexpressprice", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("根据收寄地址获取快递费用")
    public String SFExpressPrice(
//            @ApiParam(name = "j_city", value = "寄方地址(城市),默认为厦门", defaultValue = "厦门")
//            @RequestParam(value = "j_city", required = false) String j_city,
            @ApiParam(name = "d_province", value = "收方地址(省份)")
            @RequestParam(value = "d_province", required = false) String d_province,
            @ApiParam(name = "d_city", value = "收方地址(城市)")
            @RequestParam(value = "d_city", required = false) String d_city){
        try {
            DmExpressagePriceEntity expreprice = sfexpressService.getSFExpressPrice(d_province,d_city);
            return write(200, "查询成功","data",expreprice);
        }catch (Exception e){
            //日志文件中记录异常信息
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败,"+e.getMessage());
        }
    }
}