trick9191 преди 7 години
родител
ревизия
70ddf96b93
променени са 49 файла, в които са добавени 2708 реда и са изтрити 138 реда
  1. 6 2
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/config/jpa/MedicineJpa.java
  2. 41 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/IdEntity.java
  3. 68 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/MedicineAnswerLog.java
  4. 91 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/MedicineExaminationAnwser.java
  5. 4 0
      patient-co-service/wlyy_service/pom.xml
  6. 14 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/DateUtil.java
  7. 411 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/BaseController.java
  8. 130 18
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  9. 3 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionDao.java
  10. 14 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/prescription/PrescriptionExpressageDao.java
  11. 10 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Hospital.java
  12. 104 13
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/Prescription.java
  13. 307 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionExpressage.java
  14. 9 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionInfo.java
  15. 3 3
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionLog.java
  16. 198 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/VO/PrescriptionExpressageVO.java
  17. 186 46
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  18. 2 2
      patient-co/patient-co-statistics/pom.xml
  19. 6 0
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/SwaggerConfig.java
  20. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java
  21. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/security/WebSecurityConfig.java
  22. 13 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/SignFamily.java
  23. 37 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  24. 142 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/Service.java
  25. 151 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/ServiceItem.java
  26. 142 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/SignFamilyService.java
  27. 144 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/SignFamilyServiceItem.java
  28. 8 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/redis/RedisMsgPubSubListener.java
  29. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  30. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  31. 15 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/ServiceDao.java
  32. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/ServiceItemDao.java
  33. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/SignFamilyServiceDao.java
  34. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/SignFamilyServiceItemDao.java
  35. 65 22
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  36. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/express/SFExpressService.java
  37. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  38. 10 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  39. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  40. 176 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignFamilyServiceService.java
  41. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java
  42. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SFUtils.java
  43. 32 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  44. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  45. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  46. 39 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceController.java
  47. 27 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java
  48. 2 2
      patient-co/patient-co-wlyy/src/main/resources/config/fdfs_client.conf
  49. 1 1
      pom.xml

+ 6 - 2
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/config/jpa/MedicineJpa.java

@ -1,5 +1,6 @@
package com.yihu.mm.config.jpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
@ -22,14 +23,15 @@ import javax.sql.DataSource;
/**
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "medicineEntityManagerFactory",
        transactionManagerRef = "medicineTransactionManager",
        basePackages = {"com.yihu.mm.repository.medicine"})  //设置Repository所在位置
        basePackages = {"com.yihu.mm.repository.medicine"})   //设置Repository所在位置
public class MedicineJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
@ -58,6 +60,8 @@ public class MedicineJpa {
    }
    @Primary
    @Bean(name = "medicineTransactionManager")
    JpaTransactionManager medicineTransactionManager(

+ 41 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/IdEntity.java

@ -0,0 +1,41 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.mm.entity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
/**
 * 统一定义id的entity基类.
 * 
 * 基类统一定义id的属性名称、数据类型、列名映射及生成策略.
 * Oracle需要每个Entity独立定义id的SEQUCENCE时,不继承于本类而改为实现一个Idable的接口。
 * 
 * @author calvin
 */
// JPA 基类的标识
@MappedSuperclass
public abstract class IdEntity implements Serializable {
	private static final long serialVersionUID = 3673803562328635206L;
	protected Long id;  // 非业务主键
	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
}

+ 68 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/MedicineAnswerLog.java

@ -0,0 +1,68 @@
package com.yihu.mm.entity.medicine;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.mm.entity.IdEntity;
import java.util.Date;
/**
 * Created by Administrator on 2017/8/9.
 */
public class MedicineAnswerLog extends IdEntity{
    private String patientCode; //客户code
    private String tpId;    //试卷编号
    private String tpName; //试卷名称
    private Date createTime;    //创建时间
    private String remark;      //备注
    private String problems;    //问题的集合
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getTpId() {
        return tpId;
    }
    public void setTpId(String tpId) {
        this.tpId = tpId;
    }
    public String getTpName() {
        return tpName;
    }
    public void setTpName(String tpName) {
        this.tpName = tpName;
    }
    @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 String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getProblems() {
        return problems;
    }
    public void setProblems(String problems) {
        this.problems = problems;
    }
}

+ 91 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/entity/medicine/MedicineExaminationAnwser.java

@ -0,0 +1,91 @@
package com.yihu.mm.entity.medicine;
import com.yihu.mm.entity.IdEntity;
/**
 * Created by Administrator on 2017/8/9.
 */
public class MedicineExaminationAnwser extends IdEntity{
    private String tpId;    //试卷编号
    private String tpName;  //试卷名称
    private Integer tpType; //'问卷类型',1:初筛问卷,2:助理问卷,4:现场问卷
    private String pbId;    //因素编号
    private String pbTitle; //因素题目
    private String pbAlternative;   //备选答案
    private String tpsId;    //试卷因素编号
    private Integer tpsSort;  //排序编号
    private Integer iMultiselect;   //是否多选,1:单选,2:多选
    public String getTpId() {
        return tpId;
    }
    public void setTpId(String tpId) {
        this.tpId = tpId;
    }
    public String getTpName() {
        return tpName;
    }
    public void setTpName(String tpName) {
        this.tpName = tpName;
    }
    public Integer getTpType() {
        return tpType;
    }
    public void setTpType(Integer tpType) {
        this.tpType = tpType;
    }
    public String getPbId() {
        return pbId;
    }
    public void setPbId(String pbId) {
        this.pbId = pbId;
    }
    public String getPbTitle() {
        return pbTitle;
    }
    public void setPbTitle(String pbTitle) {
        this.pbTitle = pbTitle;
    }
    public String getPbAlternative() {
        return pbAlternative;
    }
    public void setPbAlternative(String pbAlternative) {
        this.pbAlternative = pbAlternative;
    }
    public String getTpsId() {
        return tpsId;
    }
    public void setTpsId(String tpsId) {
        this.tpsId = tpsId;
    }
    public Integer getTpsSort() {
        return tpsSort;
    }
    public void setTpsSort(Integer tpsSort) {
        this.tpsSort = tpsSort;
    }
    public Integer getiMultiselect() {
        return iMultiselect;
    }
    public void setiMultiselect(Integer iMultiselect) {
        this.iMultiselect = iMultiselect;
    }
}

+ 4 - 0
patient-co-service/wlyy_service/pom.xml

@ -119,6 +119,10 @@
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>
        <!-- 智业接口引用 -->
        <dependency>

+ 14 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/util/DateUtil.java

@ -64,6 +64,20 @@ public class DateUtil {
        return formatter.format(dateDate);
    }
    /**
     * 将短时间格式时间转换为字符串 yyyy-MM-dd
     *
     * @param dateDate
     * @return
     */
    public static String dateToStr(java.util.Date dateDate, String format) {
        if (dateDate == null) {
            return "";
        }
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        return formatter.format(dateDate);
    }
    /**
     * 获取当前时间 yyyy-MM-dd HH:mm:ss
     * @return

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

@ -0,0 +1,411 @@
package com.yihu.wlyy.service.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.common.model.IdEntity;
import com.yihu.wlyy.service.common.util.DateUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.ReflectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.util.*;
public class BaseController {
    private static Logger logger = LoggerFactory.getLogger(BaseController.class);
    @Autowired
    protected HttpServletRequest request;
    public void error(Exception e) {
        logger.error(DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss")+":"+getClass().getName() + ":", e.getMessage());
        e.printStackTrace();
    }
    public void warn(Exception e) {
        logger.warn(getClass().getName() + ":", e.getMessage());
        e.printStackTrace();
    }
    public void infoMessage(String message) {
        logger.info(message);
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String error(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
    /**
     * 接口处理成功
     *
     * @param msg
     * @return
     */
    public String success(String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", 200);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
    public String write(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, String key, List<?> list) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, list);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, JSONObject value) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, JSONArray value) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param total 总数
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, int total, String key, JSONArray value) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            json.put("total", total);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, Object value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, String key, Page<?> list) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            // 是否为第一页
            map.put("isFirst", list.isFirst());
            // 是否为最后一页
            map.put("isLast", list.isLast());
            // 总条数
            map.put("total", list.getTotalElements());
            // 总页数
            map.put("totalPages", list.getTotalPages());
            map.put(key, list.getContent());
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, String key, Page<?> page, JSONArray array) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            // 是否为第一页
            json.put("isFirst", page == null ? false : page.isFirst());
            // 是否为最后一页
            json.put("isLast", page == null ? true : page.isLast());
            // 总条数
            json.put("total", page == null ? 0 : page.getTotalElements());
            // 总页数
            json.put("totalPages", page == null ? 0 : page.getTotalPages());
            json.put(key, array);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, Map<?, ?> value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, String value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, String key, IdEntity entity) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, entity);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String write(int code, String msg, boolean isFirst, boolean isLast, long total, int totalPages, String key, Object values) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            // 是否为第一页
            json.put("isFirst", isFirst);
            // 是否为最后一页
            json.put("isLast", isLast);
            // 总条数
            json.put("total", total);
            // 总页数
            json.put("totalPages", totalPages);
            json.put(key, values);
            return json.toString();
        } catch (Exception e) {
            logger.error("BaseController:", e.getMessage());
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    public String trimEnd(String param, String trimChars) {
        if (param.endsWith(trimChars)) {
            param = param.substring(0, param.length() - trimChars.length());
        }
        return param;
    }
    /**
     * 无效用户消息返回
     *
     * @param e
     * @param defaultCode
     * @param defaultMsg
     * @return
     */
    public String invalidUserException(Exception e, int defaultCode, String defaultMsg) {
        try {
            // if (e instanceof UndeclaredThrowableException) {
            // UndeclaredThrowableException ute = (UndeclaredThrowableException) e;
            // InvalidUserException iue = (InvalidUserException) ute.getUndeclaredThrowable();
            // if (iue != null) {
            // return error(iue.getCode(), iue.getMsg());
            // }
            // }
            return error(defaultCode, defaultMsg);
        } catch (Exception e2) {
            return null;
        }
    }
    public List<Map<String, Object>> copyBeans(Collection<? extends Object> beans, String... propertyNames) {
        List<Map<String, Object>> result = new ArrayList<>();
        for (Object bean : beans) {
            result.add(copyBeanProperties(bean, propertyNames));
        }
        return result;
    }
    /**
     * 复制特定属性。
     *
     * @param bean
     * @param propertyNames
     * @return
     */
    public Map<String, Object> copyBeanProperties(Object bean, String... propertyNames) {
        Map<String, Object> simplifiedBean = new HashMap<>();
        for (String propertyName : propertyNames) {
            Field field = ReflectionUtils.findField(bean.getClass(), propertyName);
            if (field != null) {
                field.setAccessible(true);
                Object value = ReflectionUtils.getField(field, bean);
                simplifiedBean.put(propertyName, value == null ? "" : value);
            } else {
                simplifiedBean.put(propertyName, "");
            }
        }
        return simplifiedBean;
    }
}

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

@ -9,20 +9,17 @@ import io.swagger.annotations.ApiParam;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
/**
 * 长处方接口
 * */
@Controller
@RestController
@RequestMapping(value = "/third/prescription/")
@Api(description = "长处方接口")
public class PrescriptionController {
public class PrescriptionController extends BaseController{
	@Autowired
	PrescriptionCAService caService;
@ -33,7 +30,6 @@ public class PrescriptionController {
	/**************************************提供智业调用的接口 start******************************************************/
	@RequestMapping(value = "prescriptionAdjustCompleted",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收线下处方调整完成消息")
	public Result prescriptionAdjustCompleted(@ApiParam(name="data",value="json串",defaultValue = "{}")
											  @RequestParam(value = "data",required = true) String data){
@ -46,7 +42,6 @@ public class PrescriptionController {
	}
	@RequestMapping(value = "prePayCompletion",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收预结算完成消息")
	public Result prePayCompletion(@ApiParam(name="data",value="json串",defaultValue = "{}")
								   @RequestParam(value = "data",required = true) String data){
@ -62,7 +57,6 @@ public class PrescriptionController {
	}
	@RequestMapping(value = "dispensingComplete",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收配药完成消息")
	public Result dispensingComplete(@ApiParam(name="data",value="json串",defaultValue = "{}")
									 @RequestParam(value = "data",required = true) String data){
@ -76,7 +70,6 @@ public class PrescriptionController {
	}
	@RequestMapping(value = "pharmacistPrescriptionCompletion",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("接收药师审方完成及结果消息")
	public Result pharmacistPrescriptionCompletion(@ApiParam(name="data",value="json串",defaultValue = "{}")
												   @RequestParam(value = "data",required = true) String data){
@ -89,26 +82,130 @@ public class PrescriptionController {
		}
	}
	@RequestMapping(value = "pharmacistPrescriptionCompletion",method = RequestMethod.POST)
	@ResponseBody
	@RequestMapping(value = "readNewsOnline",method = RequestMethod.POST)
	@ApiOperation("提供在线问诊消息调阅")
	public String readNewsOnline(@ApiParam(name="data",value="json串",defaultValue = "{}")
								 @RequestParam(value = "data",required = true) String data){
		JSONObject jsonObject = new JSONObject();
		try {
			jsonObject.put("status",200);
			jsonObject.put("msg","success");
			jsonObject.put("url","http://www.yihu.com/");
			return write(200,"success","url","http://www.yihu.com/");
		}catch (Exception e){
			e.printStackTrace();
			jsonObject.put("msg",e.getMessage());
			return error(-1,e.getMessage());
		}
		return jsonObject.toString();
	}
	/**************************************提供智业调用的接口 end*******************************************************/
	/************************************ 长处方 ************************************************************/
	@RequestMapping(value = "getDictForI",method = RequestMethod.POST)
	@ApiOperation("字典获取接口")
	public Result getDictForI(@ApiParam(name="dictName",value="字典名称",defaultValue = "IV_PHYSIC_DICT")
							  @RequestParam(value = "dictName",required = true) String dictName,
							  @ApiParam(name="hospital",value="医院code",defaultValue = "3501111")
							  @RequestParam(value = "hospital",required = true) String hospital)
	{
		try {
			String re = prescriptionService.getDictForI(dictName,hospital);
			return Result.success("字典获取接口成功!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "getRecipeTemplate",method = RequestMethod.POST)
	@ApiOperation("处方模板获取接口")
	public Result getRecipeTemplate(@ApiParam(name="deptCode",value="科室编码",defaultValue = "")
									@RequestParam(value = "deptCode",required = true) String deptCode,
									@ApiParam(name="staffCode",value="人员code",defaultValue = "")
									@RequestParam(value = "staffCode",required = true) String staffCode,
									@ApiParam(name="hospital",value="医院code",defaultValue = "3501111")
									@RequestParam(value = "hospital",required = true) String hospital)
	{
		try {
			String re = prescriptionService.getRecipeTemplate(staffCode,deptCode,hospital);
			return Result.success("处方模板获取接口!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "getLastRecipe",method = RequestMethod.POST)
	@ApiOperation("调阅历史处方接口")
	public Result getLastRecipe(@ApiParam(name="cardNo",value="病人卡号",defaultValue = "")
								@RequestParam(value = "cardNo",required = true) String cardNo,
								@ApiParam(name="recipeNo",value="第一次获取上一方时传入0,第二次获取上一方时传入第一次返回的医嘱号,以此类推",defaultValue = "")
								@RequestParam(value = "recipeNo",required = true) String recipeNo,
								@ApiParam(name="applyTimeFrom",value="开始时间",defaultValue = "")
								@RequestParam(value = "applyTimeFrom",required = true) String applyTimeFrom,
								@ApiParam(name="applyTimeEnd",value="结束时间",defaultValue = "")
								@RequestParam(value = "applyTimeEnd",required = true) String applyTimeEnd)
	{
		try {
			String re = prescriptionService.getLastRecipe(cardNo,recipeNo,applyTimeFrom,applyTimeEnd);
			return Result.success("调阅历史处方接口!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "saveRecipe",method = RequestMethod.POST)
	@ApiOperation("挂号开处方接口")
	public Result saveRecipe(@ApiParam(name="prescriptionCode",value="续方code",defaultValue = "123")
							 @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode)
	{
		try {
			String re = prescriptionService.saveRecipe(prescriptionCode);
			return Result.success("挂号开处方接口!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "getDispUnSettleFeeList",method = RequestMethod.POST)
	@ApiOperation("查询处方结算结果列表")
	public Result getDispUnSettleFeeList(@ApiParam(name="cardNo",value="病人卡号",defaultValue = "")
										 @RequestParam(value = "cardNo",required = true) String cardNo,
										 @ApiParam(name="visitNo",value="挂号号",defaultValue = "")
										 @RequestParam(value = "visitNo",required = true) String visitNo)
	{
		try {
			String re = prescriptionService.getDispUnSettleFeeList(cardNo,null,null);
			return Result.success("查询处方结算结果列表!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "executeSickSettle",method = RequestMethod.POST)
	@ApiOperation("院内结算确认接口")
	public Result executeSickSettle(@ApiParam(name="json",value="json",defaultValue = "{}")
									@RequestParam(value = "json",required = true) String json)
	{
		try {
			String re = prescriptionService.executeSickSettle(JSONObject.fromObject(json),null,null);
			return Result.success("院内结算确认接口!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	/************************************ CA认证 ************************************************************/
	@RequestMapping(value = "RequestRealNameSoftCertAndSign",method = RequestMethod.POST)
	@ResponseBody
@ -179,4 +276,19 @@ public class PrescriptionController {
		}
	}
	/**---------------------顺丰快递相关接口---------------------**/
	@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());
		}
	}
}

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

@ -21,4 +21,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);
    @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;
	}
}

+ 104 - 13
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/Prescription.java

@ -19,18 +19,24 @@ import java.util.Date;
public class Prescription extends IdEntity {
    private String code;                    //业务主键
    private String jwCode;                  //基卫的处方code
    private String jwCode;                  //基卫的历史处方code
    private String visitNo;                  //基卫的挂号code(调用基位开方接口后回调给我们后才有值)
    private String recipeNo;                  //基卫的处方code(调用基位开方接口后回调给我们后才有值)
    private String parentCode;             //如果是续方 那就是处方的code
    private Date createTime;               //处方创建时间
    private Date reviewedTime;             //审核时间
    private Date payTime;                   //支付时间
    private Date failTime;                  //基位 开方失败时间
    private String failReason;                  //基位 开方失败原因
    private Date dosageTime;                //配药完成时间
    private Date dispatchingTime;          //配送员领药时间
    private Date expressageTime;            //配送员到服务站的时间
    private Date finishTime;                //配送员确认送达或居民确认取药的时间
    private String patient;                  //关联 wlyy_patient code
    private String patientName;             //患者名称
    private String ssc;//社保卡号
    private Integer type;                    //1 处方 2 续方
    private Integer status;                  //状态 (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中,3调整成功,4调整失败 10 审核通过/开方中  , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送  41配送失败  42配送中   43配送到服务站  100配送到患者手中/已完成)
    private Integer status;                  //状态 (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中 3.调整完成 4.调整失败 10 审核通过/开方中  , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送  41配送失败  42配送中   43配送到服务站  100配送到患者手中/已完成)
    private String doctor;                   //开处方的医生code 关联 wlyy_doctor
    private String doctorName;               //医生名称
    private Long adminTeamId;             //患者签约的行政团队
@ -54,6 +60,9 @@ public class Prescription extends IdEntity {
//    private Double myCost;                      //自己付费
    private Integer prescriptionType;          //处方类型:1、门诊处方,2、住院处方
    private String cancelReason;
    private String adjustReason;
    private String statusName; //
@ -348,6 +357,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) {
@ -385,31 +402,49 @@ public class Prescription extends IdEntity {
            case 2: {
                return "调整处方中";
            }
            case 3: {
                return "调整成功";
            }
            case 4: {
                return "调整失败";
            }
            case 21: {
                return "药师审核失败";
            }
            case 31: {
                return "开方失败";
            }
            case 10: {
                return "开方中";
            }
            case 20: {
                return "开方完成";
            }
            case 21: {
                return "支付失败";
                return "药师审核中";
            }
            case 30: {
                return "订单已支付";
                return "开方中/药师审核成功";
            }
            case 40: {
                return "配药完成";
                return "开方完成/待支付 ";
            }
            case 41: {
                return "支付失败";
            }
            case 50: {
                return " 支付成功/待配药";
            }
            case 60: {
                return "配药成功/待配送";
            }
            case 61: {
                return "配送失败";
            }
            case 42: {
                return "分配健管师配送";
            case 62: {
                return "分配健管师 ";
            }
            case 45: {
                return "配送中";
            case 65: {
                return "配送中 ";
            }
            case 49: {
            case 69: {
                if (StringUtils.isEmpty(hospitalName)) {
                    return "配送到服务站";
                }
@ -423,4 +458,60 @@ public class Prescription extends IdEntity {
        }
        return "未知";
    }
    public String getCancelReason() {
        return cancelReason;
    }
    public void setCancelReason(String cancelReason) {
        this.cancelReason = cancelReason;
    }
    public String getAdjustReason() {
        return adjustReason;
    }
    public void setAdjustReason(String adjustReason) {
        this.adjustReason = adjustReason;
    }
    public String getVisitNo() {
        return visitNo;
    }
    public void setVisitNo(String visitNo) {
        this.visitNo = visitNo;
    }
    public String getRecipeNo() {
        return recipeNo;
    }
    public void setRecipeNo(String recipeNo) {
        this.recipeNo = recipeNo;
    }
    public Date getFailTime() {
        return failTime;
    }
    public void setFailTime(Date failTime) {
        this.failTime = failTime;
    }
    public String getFailReason() {
        return failReason;
    }
    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
}

+ 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;
    }
}

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

@ -19,6 +19,7 @@ public class PrescriptionInfo extends IdEntity {
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private String drugCode;               //药品code
    private String drugName;               //药品名称
    private String subjectClass;               //科目类别编码
    private String drugRate;               //吃药频率
    private String drugRateName;          //用药频次名称
    private String drugFormat;             //药品规格
@ -311,4 +312,12 @@ public class PrescriptionInfo extends IdEntity {
    public void setDrugRateName(String drugRateName) {
        this.drugRateName = drugRateName;
    }
    public String getSubjectClass() {
        return subjectClass;
    }
    public void setSubjectClass(String subjectClass) {
        this.subjectClass = subjectClass;
    }
}

+ 3 - 3
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/prescription/PrescriptionLog.java

@ -58,21 +58,21 @@ public class PrescriptionLog extends IdEntity {
        // 审核不通过
        no_reviewed("审核不通过", -1),
        revieweding("待审核", 0),
        //审核中
        revieweding("待审核", 0),
        changeing("调整中", 2),
        change_success("调整成功",3),
        change_error("调整失败",4),
        Pharmacist_examination_error("药师审核失败",5),
        add_error("开方失败",6),
        reviewed_success(" 医生审核(CA)通过", 10),
        //药师审核中
        Pharmacist_examination("药师审核中",20),
        Pharmacist_examination_error("药师审核失败",21),
        //开方中/药师审核成功
        adding("开方中/药师审核成功",30),
        add_error("开方失败",31),
        //待支付
        wait_pay("开方完成/待支付", 40),

+ 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;
    }
}

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

@ -1,26 +1,31 @@
package com.yihu.wlyy.service.service.prescription;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.dao.prescription.PrescriptionDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.dao.prescription.PrescriptionLogDao;
import com.yihu.wlyy.service.entity.prescription.Prescription;
import com.yihu.wlyy.service.entity.prescription.PrescriptionInfo;
import com.yihu.wlyy.service.entity.prescription.PrescriptionLog;
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.*;
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.*;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -41,9 +46,20 @@ public class PrescriptionService extends ZysoftBaseService{
    private StringRedisTemplate redisTemplate;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private HospitalDao hospitalDao;
    @Value("${redis.channelTopic}")
    private String channelTopic;
    private String channelTopic = "redisPrescription";
    /**
     * 新增续方日志
@ -83,9 +99,9 @@ public class PrescriptionService extends ZysoftBaseService{
            JSONObject pre = json.getJSONObject("Data");
            String prescriptionCode = pre.getString("PRESCRIPTION_CODE");
            Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
            if(prescription.getStatus()==2||prescription.getStatus()==4){
            if(prescription.getStatus()==PrescriptionLog.PrescriptionLogStatus.changeing.getValue()||prescription.getStatus()==PrescriptionLog.PrescriptionLogStatus.change_error.getValue()){
                if(CODE==1){
                    prescription.setStatus(3);
                    prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.change_success.getValue());
                    prescriptionDao.save(prescription);
                    //调整续方的药品信息
@ -126,8 +142,13 @@ public class PrescriptionService extends ZysoftBaseService{
                        prescriptionInfoDao.save(prescriptionInfo);
                    }
                    // redis 的发布
                    redisTemplate.convertAndSend(channelTopic,JSONObject.fromObject(prescription).toString());
                    // redis 的发布 {tilte:redisAddPrescription   state: 1 ,//1:成功,2.失败 mes:'开方成功' prescription : "0001" //续方CODE  }
                    JSONObject message = new JSONObject();
                    message.put("title","adjustPrescription");
                    message.put("state",1);
                    message.put("prescription",prescriptionCode);
                    message.put("mes","调整处方完成");
                    redisTemplate.convertAndSend(channelTopic,message.toString());
                }else {
                    //调整失败
                    prescription.setStatus(4);
@ -166,6 +187,22 @@ public class PrescriptionService extends ZysoftBaseService{
            if(code==1){
                String orderNo = json.getString("ORDER_NO");//挂号编号
                String recipeNo = json.getString("RECIPE_NO");//处方编号
                //修改续方表状态
//                Prescription prescription = prescriptionDao.f
                //修改续方审核表状态
                // redis 的发布 {tilte:redisAddPrescription   state: 1 ,//1:成功,2.失败 mes:'开方成功' prescription : "0001" //续方CODE  }
                JSONObject message = new JSONObject();
                message.put("title","redisAddPrescription");
                message.put("state",1);
                message.put("prescription","fd3b137cd907456dbcc5b11ecd701741");
//                message.put("mes","预结算完成完成");
                message.put("mes","success");
                redisTemplate.convertAndSend(channelTopic,message.toString());
            }
        }catch (JSONException ex){
@ -195,6 +232,15 @@ public class PrescriptionService extends ZysoftBaseService{
            if(code==1){
                String orderNo = json.getString("ORDER_NO");//挂号编号
                String recipeNo = json.getString("RECIPE_NO");//处方编号
                //判断健管师配送要添加续方消息,提示健管师有续方代配送
                JSONObject message = new JSONObject();
                message.put("title","dispensingComplete");
                message.put("state",1);
                message.put("prescription","fd3b137cd907456dbcc5b11ecd701741");
//                message.put("mes","预结算完成完成");
                message.put("mes","success");
                redisTemplate.convertAndSend(channelTopic,message.toString());
            }
        }catch (JSONException ex){
@ -251,17 +297,15 @@ public class PrescriptionService extends ZysoftBaseService{
     * 7.1字典获取接口
     * @param dictName 字典名称
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getDictForI(String dictName,String hospital,String licence)  throws Exception
    public String getDictForI(String dictName,String hospital)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        String[] hospitalMapping = getHospitalMapping(hospital); //获取机构映射
        hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
@ -280,17 +324,14 @@ public class PrescriptionService extends ZysoftBaseService{
     * @param staffCode 员工编码
     * @param deptCode 部门编码
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getRecipeTemplate(String staffCode,String deptCode,String hospital,String licence)  throws Exception
    public String getRecipeTemplate(String staffCode,String deptCode,String hospital)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        String[] hospitalMapping = getHospitalMapping(hospital); //获取机构映射
        hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
@ -307,20 +348,25 @@ public class PrescriptionService extends ZysoftBaseService{
    /**
     * 调阅历史处方接口
     * @param cardNo 卡号
     * @param cardNo 社保卡号
     * @param recipeNo 医嘱号
     * @param hospital
     * @param licence
     * @param applyTimeFrom 开始时间
     * @param applyTimeEnd 结束时间
     * @return
     * @throws Exception
     */
    public String getLastRecipe(String cardNo,String recipeNo,String hospital,String licence)  throws Exception
    public String getLastRecipe(String cardNo,String recipeNo,String applyTimeFrom,String applyTimeEnd)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        String hospital = null;
        String licence = null;
        Patient patient = patientDao.findBySsc(cardNo);
        SignFamily signFamily = signFamilyDao.findByPatient(patient.getCode());
        //
        String[] hospitalMapping = getHospitalMapping(signFamily.getHospital()); //获取机构映射
        hospital = hospitalMapping[0];
        licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
@ -329,6 +375,8 @@ public class PrescriptionService extends ZysoftBaseService{
        Map<String,String> params = new HashMap<>();
        params.put("cardNo",cardNo);
        params.put("recipeNo",recipeNo);
        params.put("applyTimeFrom",applyTimeFrom);
        params.put("applyTimeEnd",applyTimeEnd);
        String response = postSecond("getLastRecipe","调阅历史处方接口",params,null,header,false,2);
@ -337,27 +385,63 @@ public class PrescriptionService extends ZysoftBaseService{
    /**
     * 7.4 挂号开处方接口
     * @param json
     * @param hospital
     * @param licence
     * @param prescriptionCode
     * @return
     * @throws Exception
     */
    public String saveRecipe(JSONObject json, String hospital, String licence)  throws Exception
    public String saveRecipe(String prescriptionCode)  throws Exception
    {
        if(hospital==null){
            String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
            hospital = hospitalMapping[0];
            licence = hospitalMapping[1];
        }
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        String[] hospitalMapping = getHospitalMapping(prescription.getHospital()); //获取机构映射
        String hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        //拼接开方参数
        JSONObject json = new JSONObject();
        json.put("cardNo",prescription.getSsc());// "cardNo": "病人卡号",
//            "saveDept": "开单科室编码",
//            "REGISTER_TYPE": "挂号类型编码",
//            "RATE_TYPE": "费别类型编码",
        String jwdoctor = doctorMappingDao.findByDocotrCodeAndJwDoctorHospital(prescription.getDoctor(),hospital);
        json.put("saveOperator",jwdoctor);// "saveOperator": "开单人员编码",
        List<PrescriptionDiagnosis> prescriptionDiagnosisList = prescriptionDiagnosisDao.findByPrescriptionCode(prescriptionCode);
        json.put("DIAGNOSE_CODE",prescriptionDiagnosisList.get(0).getCode());//"DIAGNOSE_CODE": "诊断编码",
        List<PrescriptionInfo> list = prescriptionInfoDao.findByPrescriptionCode(prescriptionCode);
        JSONArray ja = new JSONArray();
        for (PrescriptionInfo info : list){
            JSONObject js = new JSONObject();
            js.put("ITEM_CODE",info.getDrugCode());//"ITEM_CODE": "药品代码",
            js.put("ITEM_NAME",info.getDrugName());//"ITEM_NAME": "药品名称",
            js.put("SUBJECT_CLASS",info.getSubjectClass());//"SUBJECT_CLASS": "科目类别编码",
            js.put("ITEM_QUANTITY",info.getNum());//"ITEM_QUANTITY": "药品数量",
            js.put("ITEM_UNIT",info.getDrugNumUnit());// "ITEM_UNIT": " 数量单位编码 ",
            js.put("ITEM_SPEC",info.getDrugFormat());//  "ITEM_SPEC": "药品规格",
            js.put("ITEM_PRICE",info.getPrice());// "ITEM_PRICE": "药品单价",
            js.put("COST",info.getCode());// "COST": "药品金额",
            js.put("BIND_FLAG",info.getBindFlag());// "BIND_FLAG": " 成组标志, 0.非成组,1.成组",
            js.put("FREQUENCY",info.getDrugRate());// "FREQUENCY": "用药频次编码",
            js.put("DAY_COUNT",info.getDayCount());// "DAY_COUNT": "用药天数",
            js.put("USAGE",info.getDrugUsage());// "USAGE": "用药方法编码",
            js.put("PHYSIC_DOSE",info.getPhysicDose());// "PHYSIC_DOSE": " 用药剂量",
            js.put("PHYSIC_DOSE_UNIT",info.getPhysicDoseUnit());// "PHYSIC_DOSE_UNIT": " 剂量单位编码",
            js.put("PHYSIC_AMOUNT",info.getPhysicAmount());// "PHYSIC_AMOUNT": " 用药总量",
            js.put("PHYSIC_AMOUNT_UNIT",info.getPhysicAmountUnit());// "PHYSIC_AMOUNT_UNIT": " 总量单位编码",
            js.put("PHYSIC_INJECT_PLACE",info.getPhysicInjectPlace());// "PHYSIC_INJECT_PLACE": " 注射地点编码",
            js.put("PHYSIC_SKIN_TEST",info.getPhysicSkinTest());// "PHYSIC_SKIN_TEST": " 皮试类型编码",
            js.put("REMARK",info.getRemark());// " REMARK ": " 备注"
            ja.add(js);
        }
        json.put("recipeInfo",ja);
        String response = postSecond("saveRecipe","挂号开处方接口",null,json,header,false,2);
        return response;
        return null;
    }
    /**
@ -415,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**************************************************/
}

+ 2 - 2
patient-co/patient-co-statistics/pom.xml

@ -49,8 +49,8 @@
        <version.spring-boot>1.3.5.RELEASE</version.spring-boot>
        <version.spring-framework>4.2.5.RELEASE</version.spring-framework>
        <version.spring-session>1.2.0.RELEASE</version.spring-session>
        <version.swagger>2.4.0</version.swagger>
        <version.swagger-ui>2.4.0</version.swagger-ui>
        <version.swagger>2.7.0</version.swagger>
        <version.swagger-ui>2.7.0</version.swagger-ui>
        <version.tomcat-embed>8.0.28</version.tomcat-embed>
    </properties>

+ 6 - 0
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/SwaggerConfig.java

@ -23,6 +23,11 @@ import static springfox.documentation.builders.PathSelectors.regex;
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurerAdapter {
    private static final String PUBLIC_API = "Default";
    /**
     * 解决swagger UI资源映射找不到问题
     * @param registry
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("swagger-ui.html")
@ -31,6 +36,7 @@ public class SwaggerConfig extends WebMvcConfigurerAdapter {
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
    @Bean
    public Docket publicAPI() {
        return new Docket(DocumentationType.SWAGGER_2)

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java

@ -37,9 +37,9 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
        // 多个拦截器组成一个拦截器链
        // addPathPatterns 用于添加拦截规则
        // excludePathPatterns 用户排除拦截
        registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**", "/statistics/province/**", "/statistics/**");
        registry.addInterceptor(patientInterceptor).addPathPatterns("/patient/**");
        registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");
//        registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**", "/statistics/province/**", "/statistics/**");
//        registry.addInterceptor(patientInterceptor).addPathPatterns("/patient/**");
//        registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");
        super.addInterceptors(registry);
        logger.info("init doctorInterceptor,patientInterceptor");

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/security/WebSecurityConfig.java

@ -27,6 +27,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                .antMatchers("/configuration/security").authenticated()
                .anyRequest().permitAll()
                .and()
                .headers().frameOptions().disable()
                .and()
                .csrf().disable()
                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
                .permitAll()

+ 13 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/SignFamily.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;
/**
@ -37,7 +38,7 @@ public class SignFamily extends IdEntity {
    private String doctorHealthName;    // 健康管理师姓名
    private Date begin;         // 签约开始日期
    private Date end;           // 签约结束日期
    private Integer status;     // 签约状态(-1患者已取消,-2已拒绝,-3已解约,-4已到期,0待签约,1已签约,2患者申请取消签约
    private Integer status;     // 签约状态(-1患者已取消,-2已拒绝,-3已解约,-4已到期 -5超过1500同步智业不成功 -6智业返回不成功 未建档,0待签约,1已签约,2患者申请取消签约
    private String images;      // 签约图片附件URL,多图以逗号分隔
    private String reason;      // 解约原因
    private Date czrq;          // 操作时间
@ -63,6 +64,9 @@ public class SignFamily extends IdEntity {
    private Long adminTeamId;//行政团队ID
    private Date expensesTime;//缴费时间
    private Integer num;//签约数
    //1.3.3.2新增字段
    //基卫服务类型
    private String serverType;
@ -559,4 +563,12 @@ public class SignFamily extends IdEntity {
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
    @Transient
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
}

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

@ -19,11 +19,15 @@ import java.util.Date;
public class Prescription extends IdEntity {
    private String code;                    //业务主键
    private String jwCode;                  //基卫的处方code
    private String jwCode;                  //基卫的历史处方code
    private String visitNo;                  //基卫的挂号code(调用基位开方接口后回调给我们后才有值)
    private String recipeNo;                  //基卫的处方code(调用基位开方接口后回调给我们后才有值)
    private String parentCode;             //如果是续方 那就是处方的code
    private Date createTime;               //处方创建时间
    private Date reviewedTime;             //审核时间
    private Date payTime;                   //支付时间
    private Date failTime;                  //基位 开方失败时间
    private String failReason;                  //基位 开方失败原因
    private Date dosageTime;                //配药完成时间
    private Date dispatchingTime;          //配送员领药时间
    private Date expressageTime;            //配送员到服务站的时间
@ -469,4 +473,36 @@ public class Prescription extends IdEntity {
    public void setAdjustReason(String adjustReason) {
        this.adjustReason = adjustReason;
    }
    public String getVisitNo() {
        return visitNo;
    }
    public void setVisitNo(String visitNo) {
        this.visitNo = visitNo;
    }
    public String getRecipeNo() {
        return recipeNo;
    }
    public void setRecipeNo(String recipeNo) {
        this.recipeNo = recipeNo;
    }
    public Date getFailTime() {
        return failTime;
    }
    public void setFailTime(Date failTime) {
        this.failTime = failTime;
    }
    public String getFailReason() {
        return failReason;
    }
    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }
}

+ 142 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/Service.java

@ -0,0 +1,142 @@
package com.yihu.wlyy.entity.service;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by chenweida on 2 17/8/8.
 * 服务表 一个签约可以对应对个服务 也可以为0
 */
@Entity
@Table(name = "wlyy_service")
public class Service extends IdEntity {
    private String code; //非业务主键
    private String name;       //	服务名称	 		 	 
    private String town;          //	可为空 有值时是 某个区的特定服务	 		 	 
    private String hospital;     //	可为空 有值时是 某个机构的特定服务
    private String image;//图片的url
    private String introduce;     //	简介	 		 	 
    private Integer del;//	是否删除  1可用   不可用
    private Date createTime;  //		创建时间
    private String createUser;//	创建人code
    private String createUserName;   //	创建人name
    private Date updateTime;  //修改时间
    private String updateUser;//	修改人code
    private String updateUserName;    //	修改人name
    private String remark;   //	备注
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getImage() {
        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
}

+ 151 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/ServiceItem.java

@ -0,0 +1,151 @@
package com.yihu.wlyy.entity.service;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by chenweida on 2 17/8/8.
 * 服务项表 一个签约可以对应对个服务 也可以为0
 */
@Entity
@Table(name = "wlyy_service_item")
public class ServiceItem extends IdEntity {
    private String code; //非业务主键
    private String serviceCode;// 所属服务code 关联表 wlyy_Service
    private String name;       //	服务名称
    private String image;   //图片的url
    private Integer type;   // 服务类型 1 热线电话 2 中医体检
    private String mobile;  //服务项对应的热线电话
    private String introduce;     //	简介	 		 	 
    private Integer del;    //	是否删除  1可用   不可用
    private Date createTime;  //创建时间
    private String createUser; //	创建人code
    private String createUserName;    //	创建人name
    private Date updateTime;    //修改时间
    private String updateUser;  //	修改人code
    private String updateUserName;    //	修改人name
    private String remark;      //	备注
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getServiceCode() {
        return serviceCode;
    }
    public void setServiceCode(String serviceCode) {
        this.serviceCode = serviceCode;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getImage() {
        return image;
    }
    public void setImage(String image) {
        this.image = image;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 142 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/SignFamilyService.java

@ -0,0 +1,142 @@
package com.yihu.wlyy.entity.service;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by chenweida on 2 17/8/8.
 * 签约服务表 一个签约可以对应对个服务 也可以为0
 */
@Entity
@Table(name = "wlyy_sign_family_service")
public class SignFamilyService extends IdEntity {
    private String code; //非业务主键
    private String serviceCode;//所属的服务code
    private String signCode;    //关联的签约
    private String patient;   //所属患者
    private String patientName; //所属患者名称
    private Integer del;    //	是否删除  1可用   不可用
    private Date signTime;  //服务签约时间
    private Date createTime;  //		创建时间
    private String createUser;//	创建人code
    private String createUserName;   //	创建人name
    private Date updateTime;  //修改时间
    private String updateUser;//	修改人code
    private String updateUserName;    //	修改人name
    private String remark;   //	备注
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getServiceCode() {
        return serviceCode;
    }
    public void setServiceCode(String serviceCode) {
        this.serviceCode = serviceCode;
    }
    public String getSignCode() {
        return signCode;
    }
    public void setSignCode(String signCode) {
        this.signCode = signCode;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Date getSignTime() {
        return signTime;
    }
    public void setSignTime(Date signTime) {
        this.signTime = signTime;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 144 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/service/SignFamilyServiceItem.java

@ -0,0 +1,144 @@
package com.yihu.wlyy.entity.service;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by chenweida on 2 17/8/8.
 * 签约服务项表 一个签约可以对应对个服务 也可以为0
 */
@Entity
@Table(name = "wlyy_sign_family_service_item")
public class SignFamilyServiceItem extends IdEntity {
    private String code; //非业务主键
    private String serviceCode;// 所属服务code 关联表 wlyy_Service
    private String signServiceCode;// 签约的包的code 关联 wlyy_sign_family_service code
    private String serviceItemCode;// 所属服务项 关联表wlyy_service_item  code
    private String signCode;//签约code
    private String patient;   //所属患者
    private Integer del;//	是否删除  1可用   不可用				 	 
    private Date createTime;  //		创建时间
    private String createUser;//	创建人code
    private String createUserName;   //	创建人name
    private Date updateTime;  //修改时间
    private String updateUser;//	修改人code
    private String updateUserName;    //	修改人name
    private String remark;   //	备注
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getServiceCode() {
        return serviceCode;
    }
    public void setServiceCode(String serviceCode) {
        this.serviceCode = serviceCode;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getSignServiceCode() {
        return signServiceCode;
    }
    public void setSignServiceCode(String signServiceCode) {
        this.signServiceCode = signServiceCode;
    }
    public String getServiceItemCode() {
        return serviceItemCode;
    }
    public void setServiceItemCode(String serviceItemCode) {
        this.serviceItemCode = serviceItemCode;
    }
    public String getSignCode() {
        return signCode;
    }
    public void setSignCode(String signCode) {
        this.signCode = signCode;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
}

+ 8 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/redis/RedisMsgPubSubListener.java

@ -1,8 +1,7 @@
package com.yihu.wlyy.redis;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.util.HttpUtil;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -19,6 +18,8 @@ public class RedisMsgPubSubListener extends JedisPubSub {
    @Autowired
    private PrescriptionInfoService prescriptionInfoService;
    @Autowired
    private PrescriptionService prescriptionService;
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
@ -63,6 +64,11 @@ public class RedisMsgPubSubListener extends JedisPubSub {
                logger.info(json.toString());
                //审核消息发送
                prescriptionInfoService.onMesSquareState(message);
            }else if("dispensingComplete".equals(title)){//配药完成
                //提醒健管师待取药
                String prescriptionCode = json.getString("prescription");
            }
        }catch (Exception e){
            logger.error("redis_error...",e);

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -67,6 +67,9 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("select count(a) from Message a where a.read = 0 and a.over ='0'  and a.receiver=?1 and a.type=?2 ")
    int findMessageNum(String doctor, Integer type);
    @Query("update Message a set a.prescriptionStatus=?2 where a.relationCode = ?1 and a.type=6 ")
    int updatePreScriptionMessage(String relateCode,String prescriptionStatus);
    @Query("update Message a set a.read = 0,a.over = '0' where a.receiver = ?1 and a.type = ?2")
    @Modifying
    int setMessageReaded(String doctor,Integer type);

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -404,15 +404,15 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    SignFamily findOutTimeSigningByPatient(String patient);
    @Query(value = " select a.*  from wlyy_sign_family a where a.patient = ?1  and a.status = -4 and a.team_code = ?2 order by a.apply_date desc limit 0,1", nativeQuery = true)
    SignFamily findOutTimeSigningByPatientAndTeamCode(String patient,String teamCode);
    SignFamily findOutTimeSigningByPatientAndTeamCode(String patient, String teamCode);
    //      完成缴费后更新签约开始时间begin 缴费状态expensesStatus 医保流水号medical_insurance_num  扣费时间expenses_time
    @Modifying
    @Query("update SignFamily a set a.begin = ?2 ,a.medicalInsuranceNum=?3,a.expensesStatus = ?4,a.expensesTime = ?2,a.signPaySource = ?5 where a.code = ?1 ")
    int updatePatientBegin(String code, Date begin,String medicalInsuranceNum,String expensesStatus,int signPaySource );
    int updatePatientBegin(String code, Date begin, String medicalInsuranceNum, String expensesStatus, int signPaySource);
    //查询居民的扣费状态
    @Query( " select a from SignFamily a where a.patient = ?1 ")
    @Query(" select a from SignFamily a where a.patient = ?1 ")
    SignFamily findPatientExpensesStatus(String patient);
}

+ 15 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/ServiceDao.java

@ -0,0 +1,15 @@
package com.yihu.wlyy.repository.service;
import com.yihu.wlyy.entity.service.Service;
import com.yihu.wlyy.entity.template.DoctorTeamGuidanceTemplate;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/8.
 */
public interface ServiceDao extends PagingAndSortingRepository<Service, Long>, JpaSpecificationExecutor<Service> {
    @Query("from Service where code=?1 and del=1")
    Service findByCode(String serviceCode);
}

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/ServiceItemDao.java

@ -0,0 +1,16 @@
package com.yihu.wlyy.repository.service;
import com.yihu.wlyy.entity.service.ServiceItem;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by chenweida on 2017/8/8.
 */
public interface ServiceItemDao extends PagingAndSortingRepository<ServiceItem, Long>, JpaSpecificationExecutor<ServiceItem> {
    @Query(" from ServiceItem where serviceCode=?1 and del=1")
    List<ServiceItem> findByServiceCode(String serviceCode);
}

+ 17 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/SignFamilyServiceDao.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.repository.service;
import com.yihu.wlyy.entity.service.ServiceItem;
import com.yihu.wlyy.entity.service.SignFamilyService;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by chenweida on 2017/8/8.
 */
public interface SignFamilyServiceDao extends PagingAndSortingRepository<SignFamilyService, Long>, JpaSpecificationExecutor<SignFamilyService> {
    @Query("select s from ServiceItem s,SignFamilyServiceItem si where s.code=si.serviceItemCode and si.patient=?1")
    List<ServiceItem> getPatientServiceItems(String patient);
}

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/service/SignFamilyServiceItemDao.java

@ -0,0 +1,12 @@
package com.yihu.wlyy.repository.service;
import com.yihu.wlyy.entity.service.SignFamilyService;
import com.yihu.wlyy.entity.service.SignFamilyServiceItem;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/8.
 */
public interface SignFamilyServiceItemDao extends PagingAndSortingRepository<SignFamilyServiceItem, Long>, JpaSpecificationExecutor<SignFamilyServiceItem> {
}

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

@ -15,6 +15,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.WlyyPatientSick;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.address.CityDao;
import com.yihu.wlyy.repository.address.ProvinceDao;
import com.yihu.wlyy.repository.address.TownDao;
@ -25,6 +26,7 @@ import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientSickDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
@ -116,9 +118,12 @@ public class DoctorInfoService extends BaseService {
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private PrescriptionDao prescriptionDao;
    //基卫服务地址
    @Value("${sign.check_upload}")
    private String jwUrl;
    private String jwUrl;//="http://192.168.131.105:8011";
    @Autowired
    private HttpClientUtil HttpClientUtil;
@ -1295,19 +1300,49 @@ public class DoctorInfoService extends BaseService {
//        doctor.setCheckPassword(Encodes.encodeHex(hashPassword));
//    }
    /**
     *  判断实名软证书是否已申请
     */
    public boolean judgeRealNameSoftCertIsApplied(String doctorCode) throws Exception{
        Doctor doctor = findDoctorByCode(doctorCode);
        String strUserIdcardNum = doctor.getIdcard();
        String data ="";
        String url = jwUrl+"/third/prescription/IsApplied";
        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");
            if (status == 200) {
                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("null response.");
        }
        return false;
    }
    /**
     * 获取线上CA是否认证过
     */
    public JSONObject isAuthentication(String doctorCode)  throws Exception{
    public JSONObject isAuthentication(String doctorCode) throws Exception{
        Doctor doctor = findDoctorByCode(doctorCode);
        String strUserIdcardNum = doctor.getIdcard();
//        String strUserIdcardNum = doctor.getIdcard();
        Boolean isSuccess = true;
        JSONObject jsonObject = new JSONObject();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if(doctor.getIscertified()==1){
            if(doctor.getCertifiedOvertime().getTime()>System.currentTimeMillis()){
                //1、线上未认证,有证书,并有效,2、线上未认证,有证书,已过期,3、线上未认证,无证书,4、线上已认证,并有效
                jsonObject.put("type",4);
                String data = simpleDateFormat.format(doctor.getCertifiedOvertime());
                jsonObject.put("time",data);
@ -1315,17 +1350,20 @@ public class DoctorInfoService extends BaseService {
                jsonObject = getCAPastDue(doctorCode,jsonObject);
            }
        }else{
            jsonObject = getCAPastDue(doctorCode,jsonObject);
            boolean j = judgeRealNameSoftCertIsApplied(doctorCode);
            if(j){
                jsonObject = getCAPastDue(doctorCode,jsonObject);
            }else{
                jsonObject.put("type",3);
            }
        }
        return jsonObject;
    }
    /**
     * 获取CA证书过期时间
     */
    @Transactional
    public JSONObject getCAPastDue(String doctorCode,JSONObject jsonObject)  throws Exception{
        Doctor doctor = findDoctorByCode(doctorCode);
        String strUserIdcardNum = doctor.getIdcard();
@ -1340,7 +1378,6 @@ public class DoctorInfoService extends BaseService {
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
            int status = responseObject.getInt("status");
            String msg = responseObject.getString("msg");
            if (status == 200) {
                data = responseObject.getString("data");
                if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
@ -1358,12 +1395,13 @@ public class DoctorInfoService extends BaseService {
                            jsonObject.put("type",2);
                        }
                    }else{
                        jsonObject.put("type",3);
//                        jsonObject.put("type",3);
                        throw new Exception("null data.");
                    }
                }
            } else {
                throw new Exception(responseObject.getString("msg"));
                jsonObject.put("type",3);
            }
        }else {
            throw new Exception("null response.");
@ -1413,18 +1451,19 @@ public class DoctorInfoService extends BaseService {
     * @param strUserIdcardNum
     * @param strRealNameSoftCertCalledPasswd
     * @param strOriginalData
     * @param srcBusinessStreamNO
     * @return
     * @throws Exception
     */
    public boolean requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData, String srcBusinessStreamNO) throws Exception{
    @Transactional
    public JSONObject requestRealNameSoftCertAndSign(String strUserIdcardNum,String strRealNameSoftCertCalledPasswd,String strOriginalData,String prescriptionCode) 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));
        params.add(new BasicNameValuePair("strOriginalData",MD5.GetMD5Code(strOriginalData)));
//        params.add(new BasicNameValuePair("srcBusinessStreamNO",srcBusinessStreamNO));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
@ -1438,11 +1477,17 @@ public class DoctorInfoService extends BaseService {
                    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;
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("strSignData",str[0]);
                    jsonObject.put("strCertData",str[1]);
                    jsonObject.put("srcBusinessStreamNO",str[2]);
                    Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
                    prescription.setCaMessage(str[0]);
                    prescription.setCaCertData(str[1]);
                    prescriptionDao.save(prescription);
//                    String srcBusinessStreamNO = str[2];//CA 数字签名唯一流水号
//                    return verifySignOnMultiServer(str[0],str[1],strOriginalData);
                    return jsonObject;
                }
            }else{
                throw new Exception(responseObject.getString("msg"));
@ -1459,7 +1504,7 @@ public class DoctorInfoService extends BaseService {
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSignData",strSignData));
        params.add(new BasicNameValuePair("strCertData",strCertData));
        params.add(new BasicNameValuePair("strOriginalData",strOriginalData));
        params.add(new BasicNameValuePair("strOriginalData",MD5.GetMD5Code(strOriginalData)));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if (!StringUtils.isEmpty(response)){
            JSONObject responseObject = new JSONObject(response);
@ -1485,8 +1530,6 @@ public class DoctorInfoService extends BaseService {
    //校验医师输入的CA证书是否正确
    public boolean  checkCertificate(String doctorCode,String certificateNum){
        List<NameValuePair> params = new ArrayList<>();
        String response = HttpClientUtil.post("http://120.77.209.211:5000/yueren/phonekey", params, "UTF-8");
        int count = doctorDao.checkCertificate(doctorCode,certificateNum);
        if(count>0){
            return true;

+ 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/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -193,7 +193,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    public Map<String, Object> getQrcode(String dispensaryCode ,String patientCode ,Integer type){
        String sql = "select p2.code as dispensaryCode,p2.img_url,p3.hospital_name as hospitalName  from wlyy_prescription_dispensary_code p2 " +
        String sql = "select  p2.is_use as isUse,p2.code as dispensaryCode,p2.img_url,p3.hospital_name as hospitalName  from wlyy_prescription_dispensary_code p2 " +
                " left join  wlyy_prescription p1 on p2.prescription_code=p1.code LEFT JOIN wlyy_prescription_expressage p3 on p1.code=p3.prescription_code " +
                " where p2.prescription_code=? and p1.patient=? and p2.type=?  and p2.is_Use=0 ";
        Map<String, Object> result = jdbcTemplate.queryForMap(sql,dispensaryCode,patientCode,type);

+ 10 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -1,5 +1,9 @@
package com.yihu.wlyy.service.app.prescription;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
import org.json.JSONObject;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
@ -8,6 +12,7 @@ import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
@ -17,7 +22,6 @@ import com.yihu.wlyy.util.ImUtill;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -61,6 +65,8 @@ public class PrescriptionInfoService extends BaseService {
    private ImUtill imUtill;
    @Autowired
    private DoctorAdminTeamDao doctorAdminTeamDao;
    @Autowired
    private MessageDao messageDao;
    private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
@ -400,6 +406,9 @@ public class PrescriptionInfoService extends BaseService {
                reviewed.setReviewedTime(new Date());
                reviewed.setStatus(PrescriptionReviewed.PrescriptionReviewedStatus.del.getValue());
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(code,"2");
                //审核不用过发送消息
                //发送Im消息
                JSONObject content = new JSONObject();

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -24,6 +24,18 @@ public class PrescriptionService extends BaseService {
     */
    public Prescription findByCode(String prescriptionCode) {
        return prescriptionDao.findByCode(prescriptionCode);
    }
    /**
     * 配药完成
     * @param code
     */
    public void dispensingComplete(String code){
        Prescription prescription = prescriptionDao.findByCode(code);
    }
    /**

+ 176 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignFamilyServiceService.java

@ -0,0 +1,176 @@
package com.yihu.wlyy.service.app.sign;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.service.Service;
import com.yihu.wlyy.entity.service.ServiceItem;
import com.yihu.wlyy.entity.service.SignFamilyService;
import com.yihu.wlyy.entity.service.SignFamilyServiceItem;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.service.ServiceDao;
import com.yihu.wlyy.repository.service.ServiceItemDao;
import com.yihu.wlyy.repository.service.SignFamilyServiceDao;
import com.yihu.wlyy.repository.service.SignFamilyServiceItemDao;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * Created by chenweida on 2017/8/8.
 * 签约服务 服务类型
 */
@org.springframework.stereotype.Service
public class SignFamilyServiceService {
    @Autowired
    private ServiceDao serviceDao;
    @Autowired
    private ServiceItemDao serviceItemDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private SignFamilyServiceDao signFamilyServiceDao;
    @Autowired
    private SignFamilyServiceItemDao signFamilyServiceItemDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 给患者批量分配服务
     *
     * @param patients    患者code
     * @param serviceCode 服务code
     * @throws Exception
     */
    @Transactional
    public JSONObject patientsAddService(List<String> patients, String serviceCode) throws Exception {
        JSONObject jo = new JSONObject();
        List<String> errorPatient = new ArrayList<>();
        Service service = serviceDao.findByCode(serviceCode);
        List<ServiceItem> serviceItems = serviceItemDao.findByServiceCode(serviceCode);
        List<SignFamilyService> saveSignFamilyServiceList = new ArrayList<>();
        List<SignFamilyServiceItem> saveSignFamilyServiceItemeList = new ArrayList<>();
        for (String patientCode : patients) {
            //判断患者是否有已经扣费的签约
            SignFamily sgnFamily = this.getSignFamily(patientCode);
            if (sgnFamily == null || sgnFamily.getNum() == 0 || sgnFamily.getNum() == null) {
                errorPatient.add(patientCode);
                continue;
            }
            //添加服务
            SignFamilyService signFamilyService = new SignFamilyService();
            signFamilyService.setServiceCode(service.getCode());
            String signServiceCode = UUID.randomUUID().toString();
            signFamilyService.setCode(signServiceCode);
            signFamilyService.setCreateTime(new Date());
            signFamilyService.setSignCode(sgnFamily.getCode());
            signFamilyService.setSignTime(new Date());
            signFamilyService.setDel(1);
            saveSignFamilyServiceList.add(signFamilyService);
            //添加服务项
            for (ServiceItem oneServiceItem : serviceItems) {
                SignFamilyServiceItem signFamilyServiceItem = new SignFamilyServiceItem();
                signFamilyServiceItem.setCode(UUID.randomUUID().toString());
                signFamilyServiceItem.setCreateTime(new Date());
                signFamilyServiceItem.setDel(1);
                signFamilyServiceItem.setServiceCode(service.getCode());
                signFamilyServiceItem.setServiceItemCode(oneServiceItem.getCode());
                signFamilyServiceItem.setSignCode(sgnFamily.getCode());
                signFamilyServiceItem.setSignServiceCode(signServiceCode);
                saveSignFamilyServiceItemeList.add(signFamilyServiceItem);
            }
        }
        signFamilyServiceDao.save(saveSignFamilyServiceList);
        signFamilyServiceItemDao.save(saveSignFamilyServiceItemeList);
        jo.put("status", 1);//执行成功
        jo.put("errorPatients", errorPatient);//未成功的患者
        return jo;
    }
    /**
     * 给患者分配服务
     *
     * @param patient     患者code
     * @param serviceCode 服务code
     * @throws Exception
     */
    @Transactional
    public boolean patientAddService(String patient, String serviceCode) throws Exception {
        Service service = serviceDao.findByCode(serviceCode);
        List<ServiceItem> serviceItems = serviceItemDao.findByServiceCode(serviceCode);
        //判断患者是否有已经扣费的签约
        SignFamily sgnFamily = this.getSignFamily(patient);
        //添加服务
        SignFamilyService signFamilyService = new SignFamilyService();
        signFamilyService.setServiceCode(service.getCode());
        String signServiceCode = UUID.randomUUID().toString();
        signFamilyService.setCode(signServiceCode);
        signFamilyService.setCreateTime(new Date());
        signFamilyService.setSignCode(sgnFamily.getCode());
        signFamilyService.setSignTime(new Date());
        signFamilyService.setDel(1);
        //添加服务项
        List<SignFamilyServiceItem> saveSignFamilyServiceItemeList = new ArrayList<>();
        for (ServiceItem oneServiceItem : serviceItems) {
            SignFamilyServiceItem signFamilyServiceItem = new SignFamilyServiceItem();
            signFamilyServiceItem.setCode(UUID.randomUUID().toString());
            signFamilyServiceItem.setCreateTime(new Date());
            signFamilyServiceItem.setDel(1);
            signFamilyServiceItem.setServiceCode(service.getCode());
            signFamilyServiceItem.setServiceItemCode(oneServiceItem.getCode());
            signFamilyServiceItem.setSignCode(sgnFamily.getCode());
            signFamilyServiceItem.setSignServiceCode(signServiceCode);
            saveSignFamilyServiceItemeList.add(signFamilyServiceItem);
        }
        signFamilyServiceDao.save(signFamilyService);
        signFamilyServiceItemDao.save(saveSignFamilyServiceItemeList);
        return true;
    }
    /**
     * 查找患者有哪些服务项
     *
     * @param patient     患者code
     * @param serviceCode 服务code
     * @return
     * @throws Exception
     */
    public List<ServiceItem> getPatientServiceItem(String patient, String serviceCode) throws Exception {
        StringBuffer sql = new StringBuffer(" SELECT " +
                "   s.* " +
                " FROM " +
                "   wlyy_service_item s, " +
                "   wlyy_sign_family_service_item si " +
                " WHERE " +
                "   s.`code` = si.service_item_code ");
        if (!StringUtils.isEmpty(patient)) {
            sql.append(" and si.patient = '" + patient + "'");
        }
        if (!StringUtils.isEmpty(serviceCode)) {
            sql.append(" and si.service_code = '" + serviceCode + "'");
        }
        return jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper(ServiceItem.class));
    }
    private SignFamily getSignFamily(String patient) {
        String sql = "select count(id) num,code from wlyy_sign_family where patient='" + patient + "' ";
        List<SignFamily> signFamilies = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SignFamily.class));
        return signFamilies.get(0);
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java

@ -26,7 +26,7 @@ public class TokenService extends BaseService {
	 * 生成token
	 * @param user 用户标识
	 * @param imei 手机IMEI码
	 * @param platform 1患者,2医生,3患者微信公众号
	 * @param platform 1患者,2医生,3患者微信公众号,4pc端医生
	 * @return
	 * @throws Exception
	 */
@ -49,7 +49,7 @@ public class TokenService extends BaseService {
		token.setUser(user);
		token.setCzrq(czrq);
		// 先删除防止重复
		tokenDao.deleteByUser(user);
		tokenDao.deleteByUserAndPlatform(user,platform);
		// 添加新的token
		token = tokenDao.save(token);
		if (token == null) {

+ 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'>");

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

@ -1871,11 +1871,12 @@ public class DoctorController extends BaseController {
    @RequestMapping(value = "/isAuthentication", method = RequestMethod.GET)
    public String isAuthentication(){
        try {
            //0de6a26a62dd11e69faffa163e8aee56
            JSONObject data = doctorInfoService.isAuthentication(getRepUID());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
            error(e);
            return error(-1, "获取信息失败!");
            return error(-1, e.getMessage());
        }
    }
@ -1896,7 +1897,7 @@ public class DoctorController extends BaseController {
            return error(-1, "修改密码失败!");
        }catch (Exception e) {
            error(e);
            return error(-1, "修改密码失败!");
            return error(-1, e.getMessage());
        }
    }
@ -1910,19 +1911,19 @@ public class DoctorController extends BaseController {
    public String requestRealNameSoftCertAndSign(
            @RequestParam(value = "strRealNameSoftCertCalledPasswd",required = true) String strRealNameSoftCertCalledPasswd,
            @RequestParam(value = "strOriginalData",required = true) String strOriginalData,
            @RequestParam(value = "srcBusinessStreamNO",required = true) String srcBusinessStreamNO){
            @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
        try {
            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);
            }
            return error(-1, "认证失败!");
            JSONObject jsonObject = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,prescriptionCode);
//            if(b){
            return write(200, "获取信息成功!", "data", jsonObject);
//            }
//            return error(-1, "认证失败!");
        }catch (Exception e) {
            error(e);
            return error(-1, "认证失败!");
            return error(-1, e.getMessage());
        }
    }
@ -1940,8 +1941,29 @@ public class DoctorController extends BaseController {
            return write(200, "获取信息成功!", "data", b);
        }catch (Exception e) {
            error(e);
            return error(-1, "获取信息失败!");
            return error(-1, e.getMessage());
        }
    }
    /**
     * 验证签名( ( 带多服务器负载均衡) )
     */
    @ApiOperation("验证签名")
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/verifySignOnMultiServer", method = RequestMethod.GET)
    public String verifySignOnMultiServer(
            @RequestParam(value = "strSignData",required = true) String strSignData,
            @RequestParam(value = "strCertData",required = true) String strCertData,
            @RequestParam(value = "strOriginalData",required = true) String strOriginalData){
            try {
                boolean b = doctorInfoService.verifySignOnMultiServer(strSignData,strCertData,strOriginalData);
                return write(200, "获取信息成功!", "data", b);
            }catch (Exception e) {
                error(e);
                return error(-1, e.getMessage());
            }
    }
}

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

@ -9,6 +9,8 @@ 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.service.third.jw.JwPrescriptionService;
import com.yihu.wlyy.service.third.jw.JwSignService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -35,6 +37,8 @@ public class PrescriptionInfoController extends BaseController{
    private PrescriptionService prescriptionService;
    @Autowired
    private PrescriptionPayService prescriptionPayService;
    @Autowired
    private JwPrescriptionService jwPrescriptionService;
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
@ -270,4 +274,17 @@ public class PrescriptionInfoController extends BaseController{
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPrescriptionDurgDict", method = RequestMethod.GET)
    @ApiOperation(value = "获取基卫的药品字典")
    public String getPrescriptionDurgDict(
            @RequestParam(required = true,name = "dictName") @ApiParam(value = "字典名称", name = "dictName",required = true)  String dictName
    ){
        try {
            return write(200, "操作成功!", "data",jwPrescriptionService.getDictForI(dictName));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -1094,8 +1094,9 @@ public class ConsultController extends WeixinBaseController {
            json.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(prescriptionCode));//续方药品信息
            json.put("symptoms",consult1.getSymptoms());//咨询类型--- 1高血压,2糖尿病
            json.put("jwCode",prescription.getJwCode());//基位处方code
            json.put("code",prescription.getCode());//续方code
            return write(200, "查询成功!", "list", json);
            return write(200, "查询成功!", "data", json);
        }catch (Exception e){
            error(e);
            return error(-1, "查询失败!");

+ 39 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/PatientSignFamilyServiceController.java

@ -0,0 +1,39 @@
package com.yihu.wlyy.web.patient.sign;
import com.yihu.wlyy.entity.service.ServiceItem;
import com.yihu.wlyy.service.app.sign.SignFamilyServiceService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * Created by chenweida on 2017/8/8.
 */
@RestController
@Api(description = "患者签约服务")
@RequestMapping("/patient/sign/service")
public class PatientSignFamilyServiceController extends BaseController {
    @Autowired
    private SignFamilyServiceService signFamilyServiceService;
    @RequestMapping(value = "/getPatientService", method = RequestMethod.GET)
    @ApiOperation("根据患者code获取患者的服务")
    public String getPatientService(
            @RequestParam(required = false, value = "patientCode") @ApiParam(required = false, value = "患者code", name = "patientCode") String patientCode
    ) {
        try {
            List<ServiceItem> serviceItems = signFamilyServiceService.getPatientServiceItem(patientCode, null);
            return write(200, "请求成功", "data", serviceItems);
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
}

+ 27 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -7,6 +7,7 @@ import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.message.SMSDao;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.reservation.PatientReservationService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
@ -494,6 +495,31 @@ public class BookingController extends WeixinBaseController {
        }
    }*/
    @Autowired
    SMSService smsService;
    @RequestMapping(value = "testSMS", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("测试短信")
    public String testSMS(@ApiParam(name = "msg") @RequestParam(value = "msg", required = true) String msg)
    {
        String re = "";
        try {
            //发送短信消息,调用总部发送信息的接口
            JSONObject resultJson = smsService.sendMsg("13559207522", msg);
            if (resultJson != null && resultJson.getInt("result") != 0) {
                re = "短信提醒失败!(原因:" + resultJson.getString("description") + ")";
            }
            re = "短信发送成功!";
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
            re = ex.getMessage();
        }
        return re;
    }
    @RequestMapping(value = "CreateOrderByDoctor", method = RequestMethod.POST)
    @ResponseBody
@ -537,9 +563,7 @@ public class BookingController extends WeixinBaseController {
                            obj.getDeptName() + obj.getDoctorName() + "医生的号源。您可直接前往医院就诊。";
                    //发送短信消息,调用总部发送信息的接口
                    String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, patientPhone), "GBK");
                    System.out.print(result);
                    JSONObject resultJson = toJson(result);
                    JSONObject resultJson = smsService.sendMsg(patientPhone,msg);
                    if (resultJson != null && resultJson.getInt("result") != 0) {
                        des = "短信提醒失败!(原因:"+resultJson.getString("description")+")";
                    }

+ 2 - 2
patient-co/patient-co-wlyy/src/main/resources/config/fdfs_client.conf

@ -9,7 +9,7 @@ http.secret_key = FastDFS1234567890
#tracker_server = 172.19.103.54:22122
#-------------测试环境---------------#
#tracker_server = 172.19.103.54:22122
tracker_server = 172.19.103.54:22122
#-------------正式环境---------------#
tracker_server = 192.168.0.239:22122
#tracker_server = 192.168.0.239:22122

+ 1 - 1
pom.xml

@ -30,7 +30,7 @@
        <version.spring-data-commons>1.8.0.RELEASE</version.spring-data-commons>
        <version.spring-data-keyvalue>1.1.2.RELEASE</version.spring-data-keyvalue>
        <version.spring-data-redis>1.7.2.RELEASE</version.spring-data-redis>
        <version.swagger>2.4.0</version.swagger>
        <version.swagger>2.7.0</version.swagger>
        <version.poi>3.15-beta1</version.poi>
        <version.hibernate>4.3.5.Final</version.hibernate>
        <version.hibernate-validator>5.0.3.Final</version.hibernate-validator>