Browse Source

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

huangwenjie 7 years ago
parent
commit
3aa023a059
70 changed files with 3286 additions and 653 deletions
  1. 88 0
      common/common-entity/src/main/java/com/yihu/mm/entity/patient/Report.java
  2. 42 0
      common/common-entity/src/main/java/com/yihu/mm/entity/patient/ReportDetail.java
  3. 39 10
      common/common-entity/src/main/java/com/yihu/mm/entity/questionnaire/MedicineAnswerLog.java
  4. 165 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcClientDetails.java
  5. 146 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcHttpLog.java
  6. 96 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcToken.java
  7. 108 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcTokenLog.java
  8. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  9. 5 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java
  10. 5 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java
  11. 70 28
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java
  12. 32 0
      patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java
  13. 3 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Doctor.java
  14. 8 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Patient.java
  15. 5 8
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java
  16. 5 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/user_list_js.jsp
  17. 20 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/user_modify.jsp
  18. 31 8
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/user_modify_js.jsp
  19. 7 4
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  20. 3 3
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  21. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/MvcConfig.java
  22. 64 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  23. 2 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  24. 128 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/GateWayInterceptor.java
  25. 0 141
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/UserInterceptor.java
  26. 14 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcClientDetailsDao.java
  27. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcHttpLogDao.java
  28. 21 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcTokenDao.java
  29. 11 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcTokenLogDao.java
  30. 13 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalService.java
  31. 17 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  32. 20 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  33. 24 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  34. 10 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionNoticesService.java
  35. 1 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  36. 44 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java
  37. 7 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java
  38. 19 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcClientDetailsService.java
  39. 83 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcTokenService.java
  40. 148 44
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PrescriptionExpressagePCService.java
  41. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java
  42. 0 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemData.java
  43. 83 67
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java
  44. 219 219
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/PCLoginController.java
  45. 39 40
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/device/DeviceController.java
  46. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  47. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java
  48. 10 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  49. 11 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionLogController.java
  50. 7 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java
  51. 52 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcHospitalController.java
  52. 105 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcMessageController.java
  53. 177 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcTokenController.java
  54. 78 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcUserController.java
  55. 21 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/DoctorLoginModel.java
  56. 317 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/DoctorModel.java
  57. 43 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/GcTokenModel.java
  58. 172 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/HospitalModel.java
  59. 73 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/LoginModel.java
  60. 82 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/PatientModel.java
  61. 91 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/BaseResultModel.java
  62. 65 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultBatchModel.java
  63. 23 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultListModel.java
  64. 31 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultOneModel.java
  65. 52 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultPageListModel.java
  66. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java
  67. 7 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionLogController.java
  68. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application.yml
  69. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/fuwuxiangqing_banner.png
  70. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/zhongyitijian_banner.png

+ 88 - 0
common/common-entity/src/main/java/com/yihu/mm/entity/patient/Report.java

@ -0,0 +1,88 @@
package com.yihu.mm.entity.patient;
/**
 * 非数据库字段,用于越人接口返回转换
 */
public class Report {
    private String cc_id;//咨询结论编号
    private String ct_id;//咨询编号
    private String cl_id;//结论编号
    private String cc_last;//最终结论
    private String cl_template;//显示模板
    private String cl_type;//分类
    private String cl_sort;//结论排序权重
    private String cl_condition;
    public String getCc_id() {
        return cc_id;
    }
    public void setCc_id(String cc_id) {
        this.cc_id = cc_id;
    }
    public String getCt_id() {
        return ct_id;
    }
    public void setCt_id(String ct_id) {
        this.ct_id = ct_id;
    }
    public String getCl_id() {
        return cl_id;
    }
    public void setCl_id(String cl_id) {
        this.cl_id = cl_id;
    }
    public String getCc_last() {
        return cc_last;
    }
    public void setCc_last(String cc_last) {
        this.cc_last = cc_last;
    }
    public String getCl_template() {
        return cl_template;
    }
    public void setCl_template(String cl_template) {
        this.cl_template = cl_template;
    }
    public String getCl_type() {
        return cl_type;
    }
    public void setCl_type(String cl_type) {
        this.cl_type = cl_type;
    }
    public String getCl_sort() {
        return cl_sort;
    }
    public void setCl_sort(String cl_sort) {
        this.cl_sort = cl_sort;
    }
    public String getCl_condition() {
        return cl_condition;
    }
    public void setCl_condition(String cl_condition) {
        this.cl_condition = cl_condition;
    }
}

+ 42 - 0
common/common-entity/src/main/java/com/yihu/mm/entity/patient/ReportDetail.java

@ -0,0 +1,42 @@
package com.yihu.mm.entity.patient;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 非数据库字段,用于越人接口返回数据的转换
 */
public class ReportDetail {
    private List<Map<String,Object>> conclusion = new ArrayList<>();
    private List<Map<String,Object>> nature = new ArrayList<>();
    private Map<String,Object> userinfo = new HashMap<>();
    public List<Map<String, Object>> getConclusion() {
        return conclusion;
    }
    public void setConclusion(List<Map<String, Object>> conclusion) {
        this.conclusion = conclusion;
    }
    public List<Map<String, Object>> getNature() {
        return nature;
    }
    public void setNature(List<Map<String, Object>> nature) {
        this.nature = nature;
    }
    public Map<String, Object> getUserinfo() {
        return userinfo;
    }
    public void setUserinfo(Map<String, Object> userinfo) {
        this.userinfo = userinfo;
    }
}

+ 39 - 10
common/common-entity/src/main/java/com/yihu/mm/entity/questionnaire/MedicineAnswerLog.java

@ -9,6 +9,8 @@ import java.util.Date;
/**
 * Created by Administrator on 2017/8/9.
 * 越人api文档都是给string类型....但是真正返回的是number....注意了..
 * 可能有很多字段,越人接口有返回,但是对单个接口不容易取值,暂时没有存储
 */
@Entity
@Table(name = "wlyy_medicine_anwser_log")
@ -17,11 +19,14 @@ public class MedicineAnswerLog extends IdEntity {
    private String patientCode; //客户code
    private String tpId;    //试卷编号
    private String tpName; //试卷名称
    private Date createTime;    //创建时间
    private String pbType;  //问卷类型
    private String answer;    //居民答案
    private String pbId;//试题编号
    private Date createTime;    //创建时间
    private String problems;    //问题的集合
    private String ctId;//咨询编号
    private String question;//问题描述
    private String opti;//问题选项
    private String type;//选项
    public String getPatientCode() {
        return patientCode;
@ -56,14 +61,6 @@ public class MedicineAnswerLog extends IdEntity {
        this.createTime = createTime;
    }
    public String getProblems() {
        return problems;
    }
    public void setProblems(String problems) {
        this.problems = problems;
    }
    public String getPbType() {
        return pbType;
    }
@ -87,4 +84,36 @@ public class MedicineAnswerLog extends IdEntity {
    public void setCtId(String ctId) {
        this.ctId = ctId;
    }
    public String getAnswer() {
        return answer;
    }
    public void setAnswer(String answer) {
        this.answer = answer;
    }
    public String getQuestion() {
        return question;
    }
    public void setQuestion(String question) {
        this.question = question;
    }
    public String getOpti() {
        return opti;
    }
    public void setOpti(String opti) {
        this.opti = opti;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
}

+ 165 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcClientDetails.java

@ -0,0 +1,165 @@
package com.yihu.wlyy.entity.gateway;
import com.yihu.wlyy.entity.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
/**
 * GtClientDetails entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gc_client_details")
public class GcClientDetails extends IdEntity implements java.io.Serializable {
    // Fields
    private String appId;
    private String appSecret;
    private String appUri;
    private Date creatieTime;
    private String creatieUser;
    private String createUserName;
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    private String remark;
    private Integer del;
    // Constructors
    /**
     * default constructor
     */
    public GcClientDetails() {
    }
    /**
     * full constructor
     */
    public GcClientDetails(String appId, String appSecret, String appUri,
                           Timestamp creatieTime, String creatieUser, String createUserName,
                           Timestamp updateTime, String updateUser, String updateUserName,
                           String remark, Integer del) {
        this.appId = appId;
        this.appSecret = appSecret;
        this.appUri = appUri;
        this.creatieTime = creatieTime;
        this.creatieUser = creatieUser;
        this.createUserName = createUserName;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.updateUserName = updateUserName;
        this.remark = remark;
        this.del = del;
    }
    @Column(name = "app_id", length = 100)
    public String getAppId() {
        return this.appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    @Column(name = "app_secret", length = 100)
    public String getAppSecret() {
        return this.appSecret;
    }
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }
    @Column(name = "app_uri", length = 256)
    public String getAppUri() {
        return this.appUri;
    }
    public void setAppUri(String appUri) {
        this.appUri = appUri;
    }
    @Column(name = "creatie_time", length = 0)
    public Date getCreatieTime() {
        return this.creatieTime;
    }
    public void setCreatieTime(Date creatieTime) {
        this.creatieTime = creatieTime;
    }
    @Column(name = "creatie_user", length = 100)
    public String getCreatieUser() {
        return this.creatieUser;
    }
    public void setCreatieUser(String creatieUser) {
        this.creatieUser = creatieUser;
    }
    @Column(name = "create_user_name", length = 20)
    public String getCreateUserName() {
        return this.createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Column(name = "update_time", length = 0)
    public Date getUpdateTime() {
        return this.updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Column(name = "update_user")
    public String getUpdateUser() {
        return this.updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 100)
    public String getUpdateUserName() {
        return this.updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Column(name = "remark", length = 20)
    public String getRemark() {
        return this.remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "del")
    public Integer getDel() {
        return this.del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 146 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcHttpLog.java

@ -0,0 +1,146 @@
package com.yihu.wlyy.entity.gateway;
import com.yihu.wlyy.entity.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
/**
 * GcHttpLog entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gc_http_log")
public class GcHttpLog extends IdEntity implements java.io.Serializable {
    // Fields
    private String token;
    private String ip;
    private String method;
    private String input;
    private String output;
    private Date createTime;
    private Integer flag = 1;
    private String message;
    // Constructors
    /**
     * default constructor
     */
    public GcHttpLog() {
    }
    /**
     * full constructor
     */
    public GcHttpLog(String token, String ip, String method, String input,
                     String output, Timestamp createTime) {
        this.token = token;
        this.ip = ip;
        this.method = method;
        this.input = input;
        this.output = output;
        this.createTime = createTime;
    }
    @Column(name = "token")
    public String getToken() {
        return this.token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    @Column(name = "ip", length = 100)
    public String getIp() {
        return this.ip;
    }
    public void setIp(String ip) {
        this.ip = ip;
    }
    @Column(name = "method")
    public String getMethod() {
        return this.method;
    }
    public void setMethod(String method) {
        this.method = method;
    }
    @Column(name = "input")
    public String getInput() {
        return this.input;
    }
    public void setInput(String input) {
        this.input = input;
    }
    @Column(name = "output")
    public String getOutput() {
        return this.output;
    }
    public void setOutput(String output) {
        this.output = output;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getFlag() {
        return flag;
    }
    public void setFlag(Integer flag) {
        this.flag = flag;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public enum flagEm {
        success(1),
        error(1)
        ;
        flagEm(Integer code) {
            this.code = code;
        }
        private Integer code;
        public Integer getCode() {
            return code;
        }
        public void setCode(Integer code) {
            this.code = code;
        }
    }
}

+ 96 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcToken.java

@ -0,0 +1,96 @@
package com.yihu.wlyy.entity.gateway;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
/**
 * GtToken entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gc_token")
public class GcToken extends IdEntity implements java.io.Serializable {
    // Fields
    private String appid;
    private String accesstoken;
    private Date createTime;
    private Date outTime;
    private Integer del;
    // Constructors
    /**
     * default constructor
     */
    public GcToken() {
    }
    /**
     * full constructor
     */
    public GcToken(String appid, String accesstoken, Date createTime,
                   Date outTime, Integer del) {
        this.appid = appid;
        this.accesstoken = accesstoken;
        this.createTime = createTime;
        this.outTime = outTime;
        this.del = del;
    }
    @Column(name = "appid", length = 200)
    public String getAppid() {
        return this.appid;
    }
    public void setAppid(String appid) {
        this.appid = appid;
    }
    @Column(name = "accesstoken")
    public String getAccesstoken() {
        return accesstoken;
    }
    public void setAccesstoken(String accesstoken) {
        this.accesstoken = accesstoken;
    }
    @Column(name = "create_time", length = 0)
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "out_time", length = 0)
    public Date getOutTime() {
        return this.outTime;
    }
    public void setOutTime(Date outTime) {
        this.outTime = outTime;
    }
    @Column(name = "del")
    public Integer getDel() {
        return this.del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 108 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/gateway/GcTokenLog.java

@ -0,0 +1,108 @@
package com.yihu.wlyy.entity.gateway;
import com.yihu.wlyy.entity.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
/**
 * GcTokenLog entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gc_token_log")
public class GcTokenLog extends IdEntity implements java.io.Serializable {
    // Fields
    private String ip;
    private String appIp;
    private String accesstoken;
    private Integer flag; //获取1 成功 0失败
    private String message;
    private Date createTime;
    // Constructors
    /**
     * default constructor
     */
    public GcTokenLog() {
    }
    /**
     * full constructor
     */
    public GcTokenLog(String ip, String appIp, String tokenId, Integer flag,
                      String message, Timestamp createTime) {
        this.ip = ip;
        this.appIp = appIp;
        this.flag = flag;
        this.message = message;
        this.createTime = createTime;
    }
    @Column(name = "ip")
    public String getIp() {
        return this.ip;
    }
    public void setIp(String ip) {
        this.ip = ip;
    }
    @Column(name = "app_ip")
    public String getAppIp() {
        return this.appIp;
    }
    public void setAppIp(String appIp) {
        this.appIp = appIp;
    }
    @Column(name = "accesstoken")
    public String getAccesstoken() {
        return accesstoken;
    }
    public void setAccesstoken(String accesstoken) {
        this.accesstoken = accesstoken;
    }
    @Column(name = "flag")
    public Integer getFlag() {
        return this.flag;
    }
    public void setFlag(Integer flag) {
        this.flag = flag;
    }
    @Column(name = "message", length = 2000)
    public String getMessage() {
        return this.message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    @Column(name = "create_time", length = 0)
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java

@ -46,7 +46,7 @@ public class Message extends IdEntity {
	private String tzType;//体征类别
	private String tzCode;//体征code
	private Integer sex;//患者性别
	private String relationCode;//业务关联code,type=6时为咨询code
	private String relationCode;//业务关联code,type=6时为咨询code,type=7时为续方code type=8时为续方表code
	private String prescriptionStatus;//type=6续方审核状态 0待审核,1审核通过,2审核失败|type=7续方状态 0待取药,1已取药
	public String getCode() {

+ 5 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/Prescription.java

@ -37,7 +37,11 @@ public class Prescription extends IdEntity {
    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 医生审核(CA)通过)审核中,
                                                // 20药师审核中,21.药师审核失败,30 开方中/药师审核成功,31.开方失败/预结算失败,
                                                // (40开方完成/待支付 ,41 支付失败 )待支付,  50 支付成功/待配药,(60配药成功/待配送)等待领药,
                                                // (61配送失败62分配健管师 65配送中,69配送到服务站)配送中,(100配送到患者手中/已完成)已完成',
    private String doctor;                   //开处方的医生code 关联 wlyy_doctor
    private String doctorName;               //医生名称
    private Long adminTeamId;             //患者签约的行政团队

+ 5 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java

@ -124,7 +124,11 @@ public class PrescriptionLog extends IdEntity {
    private String code;                    //业务流程
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private Date createTime;               //处方创建时间
    private Integer status;                 //状态 (-3 支付过期 -2 患者自己取消 -1 审核不通过 , 0 待审核, 2调整中 10 审核通过/开方中  , 20开方完成/待支付, 21 支付失败 , 30 支付成功/待配药 , 40配药成功/待配送  41配送失败 42分配健管师 45配送中   49配送到服务站  100配送到患者手中/已完成)
    private Integer status;                 //状态 (-3 支付过期 -2 患者自己取消 )续方取消,-1 审核不通过 ,
                                               // (0 待审核, 2调整中,3调整成功, 4调整失败 ,10 医生审核(CA)通过)审核中,
                                            // 20药师审核中,21.药师审核失败,30 开方中/药师审核成功,31.开方失败/预结算失败,
                                            // (40开方完成/待支付 ,41 支付失败 )待支付,  50 支付成功/待配药,(60配药成功/待配送)等待领药,
                                            // (61配送失败62分配健管师 65配送中,69配送到服务站)配送中,(100配送到患者手中/已完成)已完成',
    private Integer type;                   //类型: 1智业对接 2易联众对接  3创建处方 4 审核  5付款 6 配送 7完成
    private String userCode;                  //医生或者患者code

+ 70 - 28
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/controller/medicine/PhysicalExaminationController.java

@ -1,24 +1,30 @@
package com.yihu.mm.controller.medicine;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.mm.controller.BaseController;
import com.yihu.mm.entity.patient.ExamReport;
import com.yihu.mm.entity.patient.PatientExam;
import com.yihu.mm.entity.patient.Report;
import com.yihu.mm.entity.patient.ReportDetail;
import com.yihu.mm.entity.questionnaire.MedicineAnswerLog;
import com.yihu.mm.service.*;
import com.yihu.mm.util.JSONUtil;
import com.yihu.wlyy.entity.patient.Patient;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/medicine/physicalExamination")
@ -97,8 +103,28 @@ public class PhysicalExaminationController extends BaseController {
        String _pb_id = recordset.get("pb_id").toString();//越人api问题,  我们数据库保存的居民答案的pb_id是这边返回下一题的pb_id
        //查找居民是否已经答过该试题
        MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, _pb_id,ct_id);
        jsonQuestion.put("answer",(answer==null?"":answer.getProblems()));
        MedicineAnswerLog medicineAnswerLog = medicineAnswerLogService.findAnswer(patientCode, examCode, _pb_id,ct_id);
        String answer="";
        if(medicineAnswerLog!=null){
            answer = medicineAnswerLog.getAnswer().replace("\"","\\\"");
        }else{
            medicineAnswerLog = new MedicineAnswerLog();
            medicineAnswerLog.setPatientCode(patientCode);
            medicineAnswerLog.setTpId(examCode);
            medicineAnswerLog.setPbId(_pb_id);
            medicineAnswerLog.setCtId(ct_id);
            medicineAnswerLog.setCreateTime(new Date());
        }
        //获取题目 ,选项, 题目类型 ,并重新保存    --->>防止题目选择不同的答案,下个问题也跟着不一样
        String tb_title =  recordset.getString("tb_title");   //题目
        String option = recordset.getString("pb_alternative");//备选答案
        String type = recordset.get("i_multiselect").toString();//单选多选
        medicineAnswerLog.setType(type);
        medicineAnswerLog.setQuestion(tb_title);
        medicineAnswerLog.setOpti(option);
        medicineAnswerLogService.save(medicineAnswerLog);
        jsonQuestion.put("answer",answer);
        return jsonQuestion.toString();
    }
@ -108,53 +134,69 @@ public class PhysicalExaminationController extends BaseController {
    @ResponseBody
    public String handleExam(@ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id,
                               @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id,
                                @ApiParam(name = "i_multiselect", value = "试题类型(0单选 ,1多选)", required = true)@RequestParam(required = true, name = "i_multiselect") String i_multiselect,
                                @ApiParam(name = "type", value = "试题类型(0单选 ,1多选)", required = true)@RequestParam(required = true, name = "type") String type,
                               @ApiParam(name = "dc_answer", value = "问题答案", required = true)@RequestParam(required = true, name = "dc_answer") String dc_answer,
                             @ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode,
                             @ApiParam(name = "isLast", value = "是否是最后一题(0否 ,1是)", required = true)@RequestParam(required = false, name = "isLast") String isLast){
                             @ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode){
        PatientExam patientExam = patientExamService.findByPatientAndTpId(patientCode, examCode,ct_id);
        String tpName = patientExam.getTpName();
        String result = physicalExaminationService.handleExam(examCode, pb_id, dc_answer, ct_id);
        //将答案保存/更新到自己数据库
        MedicineAnswerLog answer = medicineAnswerLogService.findAnswer(patientCode, examCode, pb_id, ct_id);
        if(answer==null){//新增
            answer = new MedicineAnswerLog();
            answer.setCreateTime(new Date());
            answer.setPatientCode(patientCode);
            answer.setPbId(pb_id);
            answer.setTpId(examCode);
            answer.setTpName(tpName);
            answer.setCtId(ct_id);
        }
        answer.setPbType(String.valueOf(i_multiselect));
        answer.setProblems(dc_answer);
        answer.setType(String.valueOf(type));
        answer.setAnswer(dc_answer);
        medicineAnswerLogService.save(answer);
        return result;
    }
    @ApiOperation(value = "四诊资料采集")
    @RequestMapping(value = "/dillphoneimgdata",produces="application/json;charset=UTF-8")
    @RequestMapping(value = "/dillphoneimgdata", method = RequestMethod.POST,produces="application/json;charset=UTF-8")
    @ResponseBody
    public String dillphoneimgdata(@ApiParam(name = "at_id", value = "文件id", required = true)@RequestParam(required = true, name = "at_id") String at_id,
                             @ApiParam(name = "answer", value = "问题答案,文件名称", required = true)@RequestParam(required = true, name = "answer") String answer,
    public String dillphoneimgdata(@RequestParam MultipartFile file,
                              @ApiParam(name = "type", value = "1.脸型  2.舌像  3.声音", required = true)@RequestParam(required = true, name = "type") String type,
                             @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){
        String result = physicalExaminationService.dillphoneimgdata(at_id, answer, type, ct_id);
        String uploadAttachment = physicalExaminationService.uploadAttachment(file);
        String at_id = null;
        String at_realname=null;
        JSONObject uploadResult = new JSONObject(uploadAttachment);
        String status = uploadResult.get("status").toString();
        if("200".equals(status)){
            JSONObject recordset = uploadResult.getJSONObject("recordset");
            at_id =  recordset.get("at_id").toString();
            at_realname = (String) recordset.get("at_realname");
        }else{
            return write(500,"提交失败","exception",uploadResult.get("status").toString());
        }
        String result = physicalExaminationService.dillphoneimgdata(at_id, at_realname, type, ct_id);
        return result;
    }
    @ApiOperation(value = "查看报告单")
    @RequestMapping(value = "/findconconhealth",produces="application/json;charset=UTF-8")
    @RequestMapping(value = "/showDetail",produces="application/json;charset=UTF-8")
    @ResponseBody
    public String showDetail(@ApiParam(name = "patientCode", value = "居民code", required = false)@RequestParam(required = true, name = "patientCode") String patientCode,
            @ApiParam(name = "ct_id", value = "咨询编号", required = false)@RequestParam(required = false, name = "ct_id") String ct_id){
        ExamReport examReport = examReportService.showDetail(patientCode, ct_id);
        Map<String,Object> respon = new HashMap<String,Object>();
        if(null!=examReport){
            String report = examReport.getReport();
            String reportDetail = examReport.getReportDetail();
            List<Report> reports = null;
            ReportDetail reportDetail1 = null;
            ObjectMapper objm = new ObjectMapper();
            JavaType javaType = objm.getTypeFactory().constructParametricType(List.class, Report.class);
            try {
                reports=(List<Report>)objm.readValue(report,javaType);
                reportDetail1 = (ReportDetail) JSONUtil.JSONToObj(reportDetail, ReportDetail.class);
            } catch (Exception e) {
                e.printStackTrace();
            }
            respon.put("report",reports);
            respon.put("reportDetail",reportDetail1);
            return write(200,"查询成功","recordset",respon);
        }
        return write(200,"查询成功","recordset",examReport);
        return write(-200,"未查询到数据");
    }
}

+ 32 - 0
patient-co-customization/patient-co-modern-medicine/src/main/java/com/yihu/mm/service/PhysicalExaminationService.java

@ -7,8 +7,15 @@ import com.yihu.wlyy.entity.patient.Patient;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -172,4 +179,29 @@ public class PhysicalExaminationService {
        return examReport;
    }
    //查找试卷
    public String uploadAttachment(MultipartFile file) {
        MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
        String fileName = file.getOriginalFilename();
        String filePath =Class.class.getClass().getResource("/").getPath() + "temp/" + System.currentTimeMillis() + fileName;
        File dest = new File(filePath);
        if (!dest.getParentFile().exists()) {
            dest.getParentFile().mkdirs();
        }
        try {
            file.transferTo(dest);
            RestTemplate rest = new RestTemplate();
            FileSystemResource resource = new FileSystemResource(filePath);
            param.add("file", resource);
            String postStr = rest.postForObject(yuerenApi+"/uploadattachment" , param, String.class);
            if (dest.exists() && dest.isFile()) {
                dest.delete();
            }
            return postStr;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "{\"status\":500,\"exception\":\"上传文件出错\"}";
    }
}

+ 3 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Doctor.java

@ -362,6 +362,9 @@ public class Doctor extends IdEntity {
    @Transient
    public String getLevelName() {
    	if(null==level){
			return "";
		}
		// 类型:1专科医生,2全科医生,3健康管理师
		if(1==level){
			levelName = "专科医生";

+ 8 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Patient.java

@ -327,6 +327,10 @@ public class Patient extends IdEntity implements Serializable {
    @Transient
	public String getDiseaseName() {//0健康,1高血压,2糖尿病,3高血压+糖尿病
		if(disease==null){
			this.diseaseName = "";
			return diseaseName;
		}
		if(0==disease) {
			this.diseaseName = "健康";
		}else if(1==disease) {
@ -347,6 +351,10 @@ public class Patient extends IdEntity implements Serializable {
	@Transient
	public String getDiseaseConditionName() {
		if(null==diseaseCondition){
			this.diseaseConditionName = "";
			return diseaseConditionName;
		}
		if(0==diseaseCondition) {
			this.diseaseConditionName = "绿标";
		}else if(1==diseaseCondition) {

+ 5 - 8
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java

@ -135,18 +135,15 @@ public class FamilyMemberService extends BaseService {
        SignFamily sign = contractService.findSignByPatient(p.getCode());
        boolean ssSign = false;
        boolean jtSign = false;
        String doctor = null;
        String doctorName = null;
        map.put("statusName","未签约");
        if (sign != null) {
            doctor = sign.getDoctor();
            doctorName = sign.getDoctorName();
            map.put("statusName","已签约");
            String doctorCode = sign.getDoctor();
            map.put("doctor",doctorCode);
            map.put("doctorName",sign.getDoctorName());
            Doctor doctor = hosDoctorService.getDoctorByCode(doctorCode);
            map.put("doctorMobile",doctor.getMobile());
        }
        map.put("doctor",doctor);
        map.put("doctorName",doctorName);
        Doctor _doctor = hosDoctorService.getDoctorByCode(doctor);
        map.put("doctorMobile",_doctor.getMobile());
        map.put("code", p.getCode());
        map.put("name", p.getName());
        map.put("sex", p.getSex());

+ 5 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/user_list_js.jsp

@ -75,7 +75,11 @@
										return "管理员";
									} else if (Util.isStrEquals(row.type, "2")) {
										return "医生";
									}
									}else if (Util.isStrEquals(row.type, "3")) {
                                        return "客服管理员";
                                    }else if (Util.isStrEquals(row.type, "4")) {
                                        return "普通客服";
                                    }
									return "其他";
								}
							},

+ 20 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/user_modify.jsp

@ -40,6 +40,26 @@
			<input type="text"  id="inp_type" class="required useTitle f-w240 validate-special-char" required-title="用户类型不能为空"  data-attr-scan="type"/>
		</div>
	</div>
	<div id="customer" style="display: none">
		<div class="m-form-group">
			<label class="label_title" style="width:120px">工号</label>
			<div class="l-text-wrapper m-form-control essential">
				<input type="text"  id="inp_jobNo" class="required useTitle f-w240 validate-special-char" required-title="工号不能为空"  data-attr-scan="jobNo"/>
			</div>
		</div>
		<div class="m-form-group">
			<label class="label_title" style="width:120px">座席</label>
			<div class="l-text-wrapper m-form-control essential">
				<input type="text"  id="inp_seat" class="required useTitle f-w240 validate-special-char" required-title="座席不能为空"  data-attr-scan="seat"/>
			</div>
		</div>
		<div class="m-form-group">
			<label class="label_title" style="width:120px">号码</label>
			<div class="l-text-wrapper m-form-control essential">
				<input type="text"  id="inp_phone" class="required useTitle f-w240 validate-special-char" required-title="号码不能为空"  data-attr-scan="phone"/>
			</div>
		</div>
	</div>
	<%--<div class="m-form-group">--%>
		<%--<label class="label_title" style="width:120px">所属角色组</label>--%>
		<%--<div class="l-text-wrapper m-form-control">--%>

+ 31 - 8
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/user_modify_js.jsp

@ -23,6 +23,9 @@
				$name: $('#inp_name'),
				$mobile: $('#inp_mobile'),
				$type: $("#inp_type"),
                $jobNo:$("#inp_jobNo"),
                $seat:$("#inp_seat"),
                $phone:$("#inp_phone"),
				//$roles:$("#inp_roles"),
				$organization: $("#inp_organizationId"),
				init: function () {
@ -35,15 +38,21 @@
						data: [
							{text: '管理员', typeId: '1'},
							{text: '医生', typeId: '2'},
                            {text: '客服管理员', typeId: '3'},
                            {text: '普通客服', typeId: '4'},
							{text: '其他', typeId: '0'}
						],
						initIsTriggerEvent: false,
						valueField: 'typeId',
					});
                    this.$jobNo.ligerTextBox({width: 240});
                    this.$seat.ligerTextBox({width: 240});
                    this.$phone.ligerTextBox({width: 240});
				},
				initForm: function () {
					_this = this;
                    this.bindEvents();
					//修改、查看
					if (isNoEmpty(id) && id != 0) {
						$.ajax({
@ -65,6 +74,9 @@
										code: data.code,
										name: data.name,
										mobile: data.mobile,
                                        jobNo:data.jobNo,
                                        seat:data.seat,
                                        phone:data.phone
									});
									_this.typeBox.selectValue(data.type);
								} else {
@ -89,7 +101,6 @@
						$("#btn_save_close").css("display", "block");
					}
					this.$form.show();
					this.bindEvents();
				},
				//绑定事件
@ -153,13 +164,25 @@
					var self = this;
					$("#btn_save").click(function () {
						var values = self.$form.Fields.getValues();
						if (!validator.validate()) {
							return;
						}
						values.type = self.typeBox.getValue();
						update(values);
					});
                        var values = self.$form.Fields.getValues();
                        if (!validator.validate()) {
                            return;
                        }
                        values.type = self.typeBox.getValue();
                        update(values);
                    });
                    $("#inp_type").change(function () {
                        var val = self.typeBox.getValue();
                        if(val==3||val==4){
                            $("#customer").show();
                        }else{
                            $("#customer").hide();
                        }
                        debugger
                    });
					function update(values) {
						var dataModel = $.DataModel.init();
						var url = "update";

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

@ -6,7 +6,6 @@ import com.yihu.wlyy.service.service.prescription.PrescriptionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@ -170,11 +169,15 @@ public class PrescriptionController extends BaseController{
	@RequestMapping(value = "saveRecipe",method = RequestMethod.POST)
	@ApiOperation("挂号开处方接口,调整处方接口")
	public Result saveRecipe(@ApiParam(name="prescriptionCode",value="续方code",defaultValue = "123")
							 @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode)
							 @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode,
							 @ApiParam(name="jwRegisterType",value="挂号类型",defaultValue = "123")
							 @RequestParam(value = "jwRegisterType",required = true) String jwRegisterType,
							 @ApiParam(name="jwDept",value="基位科室编码",defaultValue = "123")
							 @RequestParam(value = "jwDept",required = true) String jwDept)
	{
		try {
//			String re = prescriptionService.saveRecipe(prescriptionCode);
			String re = "{\"CODE\":\"1\",\"returnData\":[[{\"VISIT_NO\":\"3277875\",\"RECIPE_NO\":\"5477158\"}]],\"byRefParaData\":[{ \"errorMsg\": \"\" }]}";
			String re = prescriptionService.saveRecipe(prescriptionCode,jwRegisterType,jwDept);
//			String re = "{\"CODE\":\"1\",\"returnData\":[[{\"VISIT_NO\":\"3277875\",\"RECIPE_NO\":\"5477158\"}]],\"byRefParaData\":[{ \"errorMsg\": \"\" }]}";
//			String re = prescriptionService.testSaveRecipe();
			return Result.success("挂号开处方接口!",re);

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

@ -534,7 +534,7 @@ public class PrescriptionService extends ZysoftBaseService{
     * @return
     * @throws Exception
     */
    public String saveRecipe(String prescriptionCode)  throws Exception
    public String saveRecipe(String prescriptionCode,String jwRegisterType,String jwDept)  throws Exception
    {
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
@ -550,10 +550,10 @@ public class PrescriptionService extends ZysoftBaseService{
        JSONObject json = new JSONObject();
        json.put("cardNo",prescription.getSsc());// "cardNo": "病人卡号",
        json.put("saveDept",prescription.getJwDeptCode());//开单科室编码
        json.put("saveDept",jwDept);//开单科室编码
        json.put("saveOperator",prescription.getJwDoctorCode());// "saveOperator": "开单人员编码",
        json.put("RATE_TYPE","2");//费别类型编码
        json.put("REGISTER_TYPE",prescription.getJwGisterTypeCode());//挂号类型编码
        json.put("REGISTER_TYPE",jwRegisterType);//挂号类型编码
        List<PrescriptionDiagnosis> prescriptionDiagnosisList = prescriptionDiagnosisDao.findByPrescriptionCode(prescriptionCode);
        json.put("DIAGNOSE_CODE",prescriptionDiagnosisList.get(0).getCode());//"DIAGNOSE_CODE": "诊断编码",
        if(prescriptionDiagnosisList.size()>1){

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

@ -1,8 +1,8 @@
package com.yihu.wlyy.config;
import com.yihu.wlyy.interceptors.DoctorInterceptor;
import com.yihu.wlyy.interceptors.GateWayInterceptor;
import com.yihu.wlyy.interceptors.PatientInterceptor;
import com.yihu.wlyy.interceptors.UserInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,16 +24,16 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
    @Autowired
    private PatientInterceptor patientInterceptor;
    @Autowired
    private UserInterceptor userInterceptor;
    private GateWayInterceptor gateWayInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 多个拦截器组成一个拦截器链
        // addPathPatterns 用于添加拦截规则
        // excludePathPatterns 用户排除拦截
        registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**", "/statistics/province/**", "/statistics/**");
        registry.addInterceptor(gateWayInterceptor).addPathPatterns("/wlyygc/**");
        registry.addInterceptor(doctorInterceptor).addPathPatterns("/doctor/**", "/statistics/province/**", "/statistics/**", "/wlyygc/**");
        registry.addInterceptor(patientInterceptor).addPathPatterns("/patient/**");
        registry.addInterceptor(userInterceptor).addPathPatterns("/user/**");
        super.addInterceptors(registry);
        logger.info("init doctorInterceptor,patientInterceptor");

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

@ -3,12 +3,18 @@ package com.yihu.wlyy.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
import static com.google.common.base.Predicates.or;
import static springfox.documentation.builders.PathSelectors.regex;
@ -19,9 +25,56 @@ public class SwaggerConfig {
    private static final String Doctor_API = "doctor";
    private static final String Patient_API = "patient";
    private static final String Other_API = "other";
    private static final String GateWay_API = "gateway";
    final String userAgent = "{\"id\":用户id,\"uid\":\"用户code\",\"openid\":\"openid\",\"token\":\"token表\",\"lastUid\":\"\",\"platform\":\"1患者APP,2医生APP,3患者微信公众号\"}";
    final String userAgentJson = "{\"id\":int,\"uid\":string,\"openid\":string,\"token\":string,\"lastUid\":string,\"platform\":int}";
    @Bean
    public Docket gatewayAPI() {
        List<Parameter> pars = addToken();
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(GateWay_API)
                .genericModelSubstitutes(DeferredResult.class)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(true)
                .pathMapping("/")
                .select()
                .paths(or(
                        regex("/wlyygc/.*"),
                        regex("/gc/.*")
                ))
                .build()
                .globalOperationParameters(pars)
                .apiInfo(gatewayApiInfo());
    }
    private ApiInfo gatewayApiInfo() {
        ApiInfo apiInfo = new ApiInfo("三师平台API",
                "对外部应用提供功能与数据接口。",
                "1.0",
                "No terms of service",
                "admin@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return apiInfo;
    }
    private List<Parameter> addToken() {
        ParameterBuilder tokenPar = new ParameterBuilder();
        List<Parameter> pars = new ArrayList<Parameter>();
        tokenPar.name("accesstoken").description("accesstoken").modelRef(new ModelRef("string")).parameterType("header").required(false).defaultValue("").build();
        pars.add(tokenPar.build());
        return pars;
    }
    @Bean
    public Docket publicAPI() {
        List<Parameter> pars = addUseragent();
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(Doctor_API)
                .genericModelSubstitutes(DeferredResult.class)
@ -32,9 +85,18 @@ public class SwaggerConfig {
                .paths(or(regex("/doctor/.*"),
                        regex("/PC/.*")))
                .build()
                .globalOperationParameters(pars)
                .apiInfo(publicApiInfo());
    }
    private List<Parameter> addUseragent() {
        ParameterBuilder tokenPar = new ParameterBuilder();
        List<Parameter> pars = new ArrayList<Parameter>();
        tokenPar.name("userAgent").description(userAgentJson).modelRef(new ModelRef("string")).parameterType("header").required(false).defaultValue(userAgent).build();
        pars.add(tokenPar.build());
        return pars;
    }
    private ApiInfo publicApiInfo() {
        ApiInfo apiInfo = new ApiInfo("三师平台API",
                "向PC端,微信、App等应用提供功能与数据接口。",
@ -50,6 +112,7 @@ public class SwaggerConfig {
    @Bean
    public Docket patientAPI() {
        List<Parameter> pars = addUseragent();
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(Patient_API)
                .genericModelSubstitutes(DeferredResult.class)
@ -59,6 +122,7 @@ public class SwaggerConfig {
                .select()
                .paths(PathSelectors.regex("/patient/.*"))
                .build()
                .globalOperationParameters(pars)
                .apiInfo(patientApiInfo());
    }

+ 2 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -115,8 +115,6 @@ public class DoctorInterceptor extends BaseInterceptor {
            Map<String, Token> tempMap = null;
            if (platform == 2) {
                tempMap = SystemData.doctorTokens;
            }else if (platform == 5) {
                tempMap = SystemData.prescriptionPCTokens;
            }else {
                tempMap = SystemData.doctorPCTokens;
            }
@ -128,8 +126,8 @@ public class DoctorInterceptor extends BaseInterceptor {
                    tempMap.put(uid, token);
                }
            }
            //1、患者端,2、医生端app,3、微信公众号wechat,4、医生端pc,5、PC端取药系统
            if (token == null || (token.getPlatform() != 2&&token.getPlatform() != 4&&token.getPlatform() != 5)) {
            //1、患者端,2、医生端app,3、微信公众号wechat,4、医生端pc,或者 PC端取药系统  或者对外系统
            if (token == null || (token.getPlatform() != 2&&token.getPlatform() != 4)) {
                // 未登录
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                flag = false;

+ 128 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/GateWayInterceptor.java

@ -0,0 +1,128 @@
package com.yihu.wlyy.interceptors;
/**
 * Created by chenweida on 2017/8/17.
 */
import com.yihu.wlyy.entity.gateway.GcHttpLog;
import com.yihu.wlyy.entity.gateway.GcToken;
import com.yihu.wlyy.repository.gateway.GcHttpLogDao;
import com.yihu.wlyy.repository.gateway.GcTokenDao;
import com.yihu.wlyy.util.NetworkUtil;
import com.yihu.wlyy.web.gateway.vo.base.BaseResultModel;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
/**
 * 对外的请求拦截
 */
@Component
public class GateWayInterceptor extends BaseInterceptor {
    private Logger logger = LoggerFactory.getLogger(GateWayInterceptor.class);
    @Autowired
    private GcHttpLogDao httpLogDao;
    @Autowired
    private GcTokenDao tokenDao;
    /**
     * preHandle:预处理回调方法
     *
     * @param request
     * @param response
     * @param handler
     * @return
     * @throws Exception
     */
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String token = request.getParameter("accesstoken");
        String ip = NetworkUtil.getIpAddress(request);
        try {
            GcToken gcToken = tokenDao.findByToken(token);
            if (gcToken == null) {
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, token, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.codeEm.token_no_power.getMessage());
                //没权限
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.codeEm.token_no_power.getCode(), BaseResultModel.codeEm.token_no_power.getMessage());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
            }
            if (gcToken.getDel() == null || gcToken.getDel() == 0) {
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, token, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.codeEm.token_out_effect.getMessage());
                //token无效
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.codeEm.token_out_effect.getCode(), BaseResultModel.codeEm.token_out_effect.getMessage());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
            }
            if (System.currentTimeMillis() > gcToken.getOutTime().getTime()) {
                saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, token, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), BaseResultModel.codeEm.token_out_time.getMessage());
                //token过期
                BaseResultModel baseResultModel = new BaseResultModel(BaseResultModel.codeEm.token_out_time.getCode(), BaseResultModel.codeEm.token_out_time.getMessage());
                response.getOutputStream().write(JSONObject.fromObject(baseResultModel).toString().getBytes());
            }
        } catch (Exception e) {
            saveHttpLog(ip, JSONObject.fromObject(request.getParameterMap()).toString(), null, token, request.getRequestURI(), GcHttpLog.flagEm.error.getCode(), e.getMessage());
            return false;
        }
        return true;
    }
    /**
     * 后处理回调方法
     *
     * @param request
     * @param response
     * @param handler
     * @param modelAndView
     * @throws Exception
     */
    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        //保存成功之后的日志
        String token = request.getParameter("token");
        String ip = NetworkUtil.getIpAddress(request);
        saveHttpLog(ip,
                JSONObject.fromObject(request.getParameterMap()).toString(),
                JSONObject.fromObject(modelAndView.getModelMap()).toString(),
                token,
                request.getRequestURI(),
                GcHttpLog.flagEm.success.getCode(),
                null);
    }
    /**
     * 整个请求处理完毕回调方法
     *
     * @param request
     * @param response
     * @param handler
     * @param ex
     * @throws Exception
     */
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
    }
    @Transactional
    public void saveHttpLog(String ip, String input, String output, String token, String method, Integer flag, String message) {
        GcHttpLog gcHttpLog = new GcHttpLog();
        gcHttpLog.setCreateTime(new Date());
        gcHttpLog.setIp(ip);
        gcHttpLog.setInput(input);
        gcHttpLog.setOutput(output);
        gcHttpLog.setToken(token);
        gcHttpLog.setMethod(method);
        gcHttpLog.setFlag(flag);
        httpLogDao.save(gcHttpLog);
    }
}

+ 0 - 141
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/UserInterceptor.java

@ -1,141 +0,0 @@
package com.yihu.wlyy.interceptors;
import java.lang.reflect.Method;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
/**
 * 公共方法,权限简单校验
 * @author George
 *
 */
@Component
public class UserInterceptor extends BaseInterceptor {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		try {
			request.setCharacterEncoding("UTF-8");
			request.setAttribute("log-start", new Date().getTime());
			response.setCharacterEncoding("UTF-8");
			JSONObject json = getAgent(request);
			if (json == null) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				return false;
			}
			// 获取用户token
			String tokenStr = json.has("token") ? json.getString("token") : "";
			String uid = json.has("uid") ? json.getString("uid") : "";
			String imei = json.has("imei") ? json.getString("imei") : "";
			String openid = json.has("openid") ? json.getString("openid") : "";
			if (StringUtils.isEmpty(imei)) {
				imei = openid;
			}
			Token token = null;
			if (SystemData.doctorTokens.containsKey(uid)) {
				token = SystemData.doctorTokens.get(uid);
			} else if (SystemData.patientTokens.containsKey(uid)) {
				token = SystemData.patientTokens.get(uid);
			} else if (SystemData.wxPatientTokens.containsKey(uid)) {
				token = SystemData.wxPatientTokens.get(uid);
			}
			if (token == null) {
				token = tokenDao.findByToken(tokenStr);
				if (token != null) {
					switch (token.getPlatform()) {
					case 1:
						SystemData.patientTokens.put(uid, token);
						break;
					case 2:
						SystemData.doctorTokens.put(uid, token);
						break;
					case 3:
						SystemData.wxPatientTokens.put(uid, token);
						break;
					}
				}
			}
			if (token == null) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				return false;
			} else {
				if (token.getTimeout().getTime() < new Date().getTime()) {
					// 登录超时
					response.getOutputStream().write(error(SystemConf.LOGIN_TIMEOUT, "登录超时,请重新登录").getBytes());
					return false;
				} else if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(uid, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
					// 别处登录
					response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
					return false;
				} else {
					// 一天只更新一次
					if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
						// 今天未更新,则更新缓存
						token.setCzrq(new Date());
						// 更新内存
						SystemData.doctorTokens.put(uid, token);
						// 更新数据库
						tokenDao.save(token);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return true;
	}
	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
		long start = (long) request.getAttribute("log-start");
		long end = new Date().getTime();
		Class cls = ((HandlerMethod) handler).getBeanType();
		RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
		Method method = ((HandlerMethod) handler).getMethod();
		RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
		String url = "";
		String urlCls = "";
		String urlMth = "";
		if (clsRm.value() != null && clsRm.value().length > 0) {
			urlCls = clsRm.value()[0];
		}
		if (mthRm.value() != null && mthRm.value().length > 0) {
			urlMth = mthRm.value()[0];
		}
		if (StringUtils.isNotEmpty(urlCls)) {
			url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
		}
		if (StringUtils.isNotEmpty(urlMth)) {
			url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
		}
		url = url.replace("\\", "/").replace("//", "/");
		JSONObject json = getAgent(request);
		String uid = json.has("uid") ? json.getString("uid") : "";
		InterfaceCallLogs.info(end - start, url, uid, new JSONObject(request.getParameterMap()).toString());
	}
	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
	}
}

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcClientDetailsDao.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.repository.gateway;
import com.yihu.wlyy.entity.gateway.GcClientDetails;
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/17.
 */
public interface GcClientDetailsDao extends PagingAndSortingRepository<GcClientDetails, Long>, JpaSpecificationExecutor<GcClientDetails> {
    @Query("from GcClientDetails where appId=?1 and del=1")
    GcClientDetails findByAppid(String appid);
}

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcHttpLogDao.java

@ -0,0 +1,12 @@
package com.yihu.wlyy.repository.gateway;
import com.yihu.wlyy.entity.gateway.GcHttpLog;
import com.yihu.wlyy.entity.httpLog.HttpLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcHttpLogDao extends PagingAndSortingRepository<GcHttpLog, Long>, JpaSpecificationExecutor<GcHttpLog> {
}

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcTokenDao.java

@ -0,0 +1,21 @@
package com.yihu.wlyy.repository.gateway;
import com.yihu.wlyy.entity.gateway.GcClientDetails;
import com.yihu.wlyy.entity.gateway.GcToken;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcTokenDao extends PagingAndSortingRepository<GcToken, Long>, JpaSpecificationExecutor<GcToken> {
    @Query("update GcToken g set g.del=0 where g.appid=?1 and g.del=1")
    @Modifying
    void updateDel(String appid);
    @Query("from GcToken where token=?1")
    GcToken findByToken(String token);
}

+ 11 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/gateway/GcTokenLogDao.java

@ -0,0 +1,11 @@
package com.yihu.wlyy.repository.gateway;
import com.yihu.wlyy.entity.gateway.GcTokenLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcTokenLogDao extends PagingAndSortingRepository<GcTokenLog, Long>, JpaSpecificationExecutor<GcTokenLog> {
}

+ 13 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalService.java

@ -85,16 +85,18 @@ public class HospitalService extends BaseService {
     * @param province
     * @param city
     * @param town
     * @param key
     * @param hospitalName
     * @param page
     * @param pagesize
     * @return
     */
    public List<Hospital> getHospitals(int type, String province, String city, String town, String key, int page, int pagesize) {
        String sql = "select * from dm_hospital where exists (select * from wlyy_doctor where wlyy_doctor.hospital = dm_hospital.code) and level = ? ";
    public List<Hospital> getHospitals(Integer type, String province, String city, String town, String hospitalName,String hospitalId, int page, int pagesize) {
        String sql = "select * from dm_hospital where exists (select * from wlyy_doctor where wlyy_doctor.hospital = dm_hospital.code) ";
        List<Object> args = new ArrayList<>();
        args.add(type);
        if (type != null ) {
            sql += " and level = ? ";
            args.add(type);
        }
        if (StringUtils.isNotEmpty(province)) {
            sql += " and province = ? ";
@ -108,11 +110,14 @@ public class HospitalService extends BaseService {
            sql += " and town = ? ";
            args.add(town);
        }
        if (StringUtils.isNotEmpty(key)) {
        if (StringUtils.isNotEmpty(hospitalName)) {
            sql += " and name like ? ";
            args.add("%" + key + "%");
            args.add("%" + hospitalName + "%");
        }
        if (StringUtils.isNotEmpty(hospitalId)) {
            sql += " and code = ? ";
            args.add(hospitalId);
        }
        sql += " limit " + (page * pagesize) + "," + pagesize;
        List<Hospital> hosList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Hospital.class));

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

@ -127,6 +127,7 @@ public class PatientPrescriptionPayService extends BaseService {
     * @return
     */
    public JSONObject dispatch(String prescriptionCode, String orgCode) throws Exception {
        LOGGER.info("========================>" + "prescriptionCode "+prescriptionCode+" orgCode" +orgCode);
        JSONObject result = new JSONObject();
        List manage = new ArrayList();
        List types = new ArrayList();
@ -252,6 +253,7 @@ public class PatientPrescriptionPayService extends BaseService {
     * @return
     */
    public Map recipeReturnUrl(HttpServletRequest request, HttpServletResponse response, String accessToken) throws Exception {
        LOGGER.debug("=================================> "+"start");
        Map resultMap = new HashMap();
        Prescription prescription = null;
        int flag = 0;
@ -350,6 +352,7 @@ public class PatientPrescriptionPayService extends BaseService {
            String billNo = "201708111044012018301";//待结算费用单据号
            String insuranceAmount = "1542";//医保支付金额
            String outChargeNo = request.getParameter("outChargeNo");//接入应用业务流水号
            LOGGER.debug("=================================> "+outChargeNo);
            String selfPayAmount = "0";//自付金额
            String tradeStatus = "0";//交易状态
@ -376,7 +379,7 @@ public class PatientPrescriptionPayService extends BaseService {
            String exceedAmount = "0";//超封顶线金额
            String accountBalance = "284125";//个人账户余额
            String healthBalance = "7133";//健康账户余额
            LOGGER.debug("=================================> "+"111111111111111111111");
            prescriptionPay.setBillNo(billNo);//待结算费用单据号
            prescriptionPay.setInsuranceAmount(Integer.parseInt(insuranceAmount));//医保支付金额
            prescriptionPay.setSelfPayAmount(Integer.parseInt(selfPayAmount));//自付金额
@ -403,7 +406,7 @@ public class PatientPrescriptionPayService extends BaseService {
            prescriptionPay.setExceedAmount(Integer.parseInt(exceedAmount));//超封顶线金额
            prescriptionPay.setAccountBalance(Integer.parseInt(accountBalance));//个人账户余额
            prescriptionPay.setHealthBalance(Integer.parseInt(healthBalance));//健康账户余额
            LOGGER.debug("=================================> "+"2222222222222222222222");
            //        保存数据库更改记录
            payDao.save(prescriptionPay);
@ -413,6 +416,7 @@ public class PatientPrescriptionPayService extends BaseService {
            prescription = prescriptionDao.findByCode(prescriptionCode);
            PrescriptionExpressage expressage = expressageDao.findByPrescriptionPay(prescriptionCode);
            if ("0".equals(tradeStatus)) {
                LOGGER.debug("=================================> "+"333333333333333333333333333");
                //支付成功返回续方code给前端
                resultMap.put("prescriptionCode",prescriptionCode);
                prescriptionPay.setTradeStatus("1");//交易状态 成功1 失败0
@ -430,11 +434,12 @@ public class PatientPrescriptionPayService extends BaseService {
                    int type = message.getType();
                    String title = message.getTitle();
                    String content = message.getContent();
                    pushMsgTask.put(receiver, "3", title, content, "");
                    pushMsgTask.put(receiver, "8", title, content, "");
                    message.setOver("1");//操作结束
                    message.setState(1);//已发送
                    message.setCzrq(new Date());
                    messageDao.save(message);
                    LOGGER.debug("=================================> "+"4444444444444444444444444");
                }
                //支付成功发起结算
                jwPrescriptionService.executeSickSettle(prescriptionCode);
@ -647,6 +652,12 @@ public class PatientPrescriptionPayService extends BaseService {
     */
    @Transactional
    public Map charge(int type, String addressJson, String orgCode, String prescriptionCode, int totalAmount, String people, String accessToken, String returnUrl) throws Exception {
        LOGGER.info("=================> ");
        LOGGER.info("type "+type);
        LOGGER.info("addressJson "+addressJson);
        LOGGER.info("orgCode "+orgCode);
        LOGGER.info("prescriptionCode "+prescriptionCode);
        LOGGER.info("people "+people);
        Map resultMap = new HashMap();
        //获取机构映射
        HospitalMapping hos = mappingDao.findByCode(orgCode);
@ -802,9 +813,9 @@ public class PatientPrescriptionPayService extends BaseService {
                message.setSenderName("SYSTEM");//发送者
                message.setTitle("新增系统消息");
                SimpleDateFormat format = new SimpleDateFormat("MM月dd日");
                String content = format.format(new Date()) + "新增1个签约居民待分配健管师,目前共" + amount + "人待处理";
                String content = format.format(new Date()) + "新增1个续方订单待分配配送员,目前共" + amount + "人待处理";
                message.setContent(content);
                message.setType(3);//分配健管师
                message.setType(8);//分配健管师
                message.setPlatform(2);//消息平台,1微信端/患者端,2医生APP端
                message.setState(0);//消息状态,1已发送,0待发送,-1发送失败
                message.setRead(1);//查看状态,1未读,0已读
@ -961,6 +972,7 @@ public class PatientPrescriptionPayService extends BaseService {
        }
        resultMap.put("outChargeNo", uuid);
        resultMap.put("payUrl", result);
        resultMap.put("status", "200");
        return resultMap;
    }

+ 20 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -1,14 +1,9 @@
package com.yihu.wlyy.service.app.prescription;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDispensaryCode;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.entity.patient.prescription.*;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDispensaryCodeDao;
import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.QrcodeUtil;
@ -44,6 +39,12 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    private PrescriptionDao prescriptionDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    @Autowired
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    private static Object obj = new Object();
    private static Object obj2 = new Object();
@ -233,14 +234,11 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    @Transactional
    public PrescriptionDispensaryCode scanQrcode(String code) throws Exception{
    public PrescriptionDispensaryCode scanQrcode(String code,String userCode) throws Exception{
        PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.findByCodeAndIsUse(code,0);
        if(prescriptionDispensaryCode!=null){
            prescriptionDispensaryCode.setIsUse(1);
            prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
        if(prescriptionDispensaryCode!=null){
            Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
            if(prescription.getDispensaryType()==3){
                //健管师配送
@ -248,8 +246,17 @@ public class PrescriptionDispensaryCodeService extends BaseService {
                messageDao.updatePreScriptionMessage(prescription.getCode(), "1", 7);
            }
        }else{
            throw new Exception("二维码输入错误或者已过期!");
            throw new Exception("取药码错误!");
        }
        Integer status =  prescriptionExpressageService.expressage(code, userCode);
        if (status == -1) {
            throw new Exception("取药码错误!");
        } else if (status == -2) {
            throw new Exception("编码已使用!");
        } else if (status == -3) {
            throw new Exception("编码类型错误!");
        }
        return prescriptionDispensaryCode;
    }

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

@ -190,7 +190,7 @@ public class PrescriptionInfoService extends BaseService {
                params.add(patient);
                //查询已经审核通过的,否则查询所有
                if ("2".equals(type)) {
                    sqlBuffer.append(" AND p.status >=10 ");
                    sqlBuffer.append(" AND p.status >="+PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
                }
                if (StringUtils.isNotBlank(startDate)) {
                    sqlBuffer.append(" AND p.create_time >= ?");
@ -211,6 +211,13 @@ public class PrescriptionInfoService extends BaseService {
                    String code = (String) map.get("code");
                    map.put("patient", p.getCode());
                    map.put("patientName", p.getName());
                    StringBuffer isAdjustSql = new StringBuffer("SELECT a.id FROM wlyy_prescription_adjust a WHERE a.prescription_code = ? ");
                    List<Map<String,Object>> adjusts = jdbcTemplate.queryForList(isAdjustSql.toString(),new Object[]{code});
                    if(adjusts!=null&&adjusts.size()>0){
                        map.put("isAdjust", "1");
                    }else{
                        map.put("isAdjust", "0");
                    }
                    map.put("prescriptionInfo", prescriptionDiagnosisService.getPrescriptionInfo(code));
                    map.put("prescriptionDt", prescriptionDiagnosisService.getPrescriptionDiagnosis(code));
                }
@ -307,8 +314,8 @@ public class PrescriptionInfoService extends BaseService {
        }
        if (prescription != null && prescription.getStatus() == PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue()) {
            Long s = (prescription.getCreateTime().getTime() - new Date().getTime()) / 1000;
        if (prescription!=null&&reviewed != null && prescription.getStatus() == PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue()&&reviewed.getReviewedTime()!=null) {
            Long s = (new Date().getTime()-reviewed.getReviewedTime().getTime()) / 1000;
            //rs.put("time",s);
            if (s > 172800) {
                prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue());
@ -365,7 +372,7 @@ public class PrescriptionInfoService extends BaseService {
    public int upLoadPrescriotionState(String state, Prescription p, PrescriptionReviewed reviewed) throws Exception {
        //医生审核通过,发起开方及预结算
        if ("1".equals(state)) {
            String rs = jwPrescriptionService.saveRecipe(p.getCode());
            String rs = jwPrescriptionService.saveRecipe(p.getCode(),p.getJwGisterTypeCode(),p.getJwDeptCode());
            com.alibaba.fastjson.JSONObject respone = com.alibaba.fastjson.JSONObject.parseObject(rs);
            int st = respone.getInteger("status");
            com.alibaba.fastjson.JSONObject data = respone.getJSONObject("data");
@ -386,7 +393,7 @@ public class PrescriptionInfoService extends BaseService {
                prescriptionDao.save(p);
                //审核通过模板消息
                sendRMess(code, 1);
                sendRMess(p.getCode(), 1);
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(p.getConsult(), "1", 6);
@ -400,7 +407,7 @@ public class PrescriptionInfoService extends BaseService {
                p.setPrescribeTime(new Date());
                prescriptionDao.save(p);
                //审核不通过模板消息
                sendRMess(code, 0);
                sendRMess(p.getCode(), 0);
                return 0;
            }
        }
@ -530,7 +537,7 @@ public class PrescriptionInfoService extends BaseService {
                p.setReviewedTime(new Date());
                reviewed.setReason(reason);
                reviewed.setReviewedTime(new Date());
                reviewed.setStatus(PrescriptionReviewed.PrescriptionReviewedStatus.del.getValue());
                reviewed.setStatus(PrescriptionReviewed.PrescriptionReviewedStatus.reviewed_fail.getValue());
                //修改系统的续方消息的审核状态
                messageDao.updatePreScriptionMessage(p.getConsult(), "2", 6);
@ -821,10 +828,10 @@ public class PrescriptionInfoService extends BaseService {
        List<Map<String, Object>> states = new ArrayList<>();
        Map<String, Object> map0 = new HashMap<>();
        map0.put("name", "续方申请通过");
        map0.put("code", PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
        states.add(map0);
//        Map<String, Object> map0 = new HashMap<>();
//        map0.put("name", "续方申请通过");
//        map0.put("code", PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
//        states.add(map0);
        Map<String, Object> map1 = new HashMap<>();
        map1.put("name", "订单已支付");
@ -1162,4 +1169,10 @@ public class PrescriptionInfoService extends BaseService {
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString());
        return new JSONArray(rs);
    }
    public JSONArray getPhysicMinDose(String code) {
        StringBuffer sql = new StringBuffer("SELECT t.min_dose AS minDose,t.physic_code AS physicCode FROM zy_iv_physic_dict t WHERE t.physic_code = ?");
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString(),new Object[]{code});
        return new JSONArray(rs);
    }
}

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

@ -14,6 +14,8 @@ import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
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.stereotype.Service;
@ -33,6 +35,7 @@ public class PrescriptionNoticesService extends BaseService {
    private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Autowired
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    private static final Logger LOGGER = LoggerFactory.getLogger(PrescriptionNoticesService.class);
    /**
@ -46,6 +49,13 @@ public class PrescriptionNoticesService extends BaseService {
     * @param url       带参数的模板跳转链接
     */
    public void sendMessages(String patient, String doctName, String ordenTime, int type, int status, String url) throws Exception {
        LOGGER.info("=======================> sendMessages start!!");
        LOGGER.debug("patient "+patient);
        LOGGER.debug("doctName "+doctName);
        LOGGER.debug("ordenTime "+ordenTime);
        LOGGER.debug("type "+type);
        LOGGER.debug("status "+status);
        LOGGER.debug("url "+ url);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        JSONArray jsonArray = null;
@ -57,7 +67,6 @@ public class PrescriptionNoticesService extends BaseService {
        JSONObject sendJson = new JSONObject();
        String first = "";
        String remark = "";
        if (type == 1) {
            switch (status) {
                case 0:

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

@ -110,8 +110,7 @@ public class PrescriptionService extends BaseService {
                try {
//                    String dispensaryCode = prescriptionDispensaryCodeDao.getCodeByPrescriptionCodeAndType(code,1);
                    StringBuffer url = new StringBuffer();
                    url.append(wechat_base_url);
                    url.append("wx/prescription/html/code-detail.html?prescriptionCode=").append(code);
                    url.append("/wx/prescription/html/code-detail.html?prescriptionCode=").append(code);
                    url.append("&openid=").append(patient.getOpenid());
                    url.append("&toUser=").append(patient.getCode());
                    url.append("&toName=").append(patient.getName());

+ 44 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/SMSService.java

@ -177,7 +177,51 @@ public class SMSService extends BaseService {
        }
        return "ok";
    }
    /**
     * 外部短信调用 发送短信验证码接口
     *
     * @param mobile 手机号
     * @param type   消息类型:11 外部接口调用
     * @return
     * @throws Exception
     */
    public String sendWithContent(String mobile, String ip, int type, String content) throws Exception {
        // 同一ip一天不允许超过10条短信
        String today = DateUtil.getStringDateShort();
        Date begin = DateUtil.strToDate(today + " 00:00:00", DateUtil.YYYY_MM_DD_HH_MM_SS);
        Date end = DateUtil.strToDate(today + " 23:59:59", DateUtil.YYYY_MM_DD_HH_MM_SS);
        // }
        // 一天的短信数不允许超过10条
        int count = smsDao.countByMobile(mobile, begin, end);
        if (count >= SystemConf.MAX_SMS_MOBILE) {
            return "当前手机号:[" + mobile + "]今天最多发送" + SystemConf.MAX_SMS_MOBILE + "条短信!";
        }
        // 保存短信发送记录
        SMS sms = new SMS();
        Date date = new Date();
        // 延后5分钟
        sms.setContent(content);
        sms.setDeadline(DateUtil.getNextMin(date, type == 10 ? 30 : 5));
        sms.setCzrq(date);
        sms.setMobile(mobile);
        sms.setIp(ip);
        sms.setType(type);
        sms.setStatus(1);
        // 调用总部发送信息的接口
        String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(sms.getContent(), mobile), "GBK");
        JSONObject json = toJson(result);
        if (json == null) {
            // 发送失败
            throw new Exception("短信发送失败!");
        } else if (json.getInt("result") != 0) {
            return json.getString("description");
        } else {
            //发送成功,保存到数据库
            smsDao.save(sms);
        }
        return "ok";
    }
    /**
     * 发送短信
     *

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

@ -64,8 +64,6 @@ public class TokenService extends BaseService {
			SystemData.wxPatientTokens.put(user, token);
		}else if(platform == 4){
			SystemData.doctorPCTokens.put(user,token);
		}else if(platform == 5){
			SystemData.prescriptionPCTokens.put(user,token);
		}
		return token;
	}
@ -125,5 +123,11 @@ public class TokenService extends BaseService {
	public Token findWxToken(String patient) {
		return tokenDao.findByPatient(patient, 3);
	}
	/**
	 * 查询doctor的微信token标识
	 * @param user
	 */
	public Token findDoctorToken(String user) {
		return tokenDao.findByPatient(user, 4);
	}
}

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcClientDetailsService.java

@ -0,0 +1,19 @@
package com.yihu.wlyy.service.gateway;
import com.yihu.wlyy.entity.gateway.GcClientDetails;
import com.yihu.wlyy.repository.gateway.GcClientDetailsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by chenweida on 2017/8/17.
 */
@Service
public class GcClientDetailsService {
    @Autowired
    private GcClientDetailsDao gtClientDetailsDao;
    public GcClientDetails findByAppId(String appid) {
        return gtClientDetailsDao.findByAppid(appid);
    }
}

+ 83 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/gateway/GcTokenService.java

@ -0,0 +1,83 @@
package com.yihu.wlyy.service.gateway;
import com.yihu.wlyy.entity.gateway.GcToken;
import com.yihu.wlyy.entity.gateway.GcTokenLog;
import com.yihu.wlyy.repository.gateway.GcTokenDao;
import com.yihu.wlyy.repository.gateway.GcTokenLogDao;
import com.yihu.wlyy.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.UUID;
/**
 * Created by chenweida on 2017/8/17.
 */
@Service
public class GcTokenService {
    @Autowired
    private GcTokenLogDao tokenLogDao;
    @Autowired
    private GcTokenDao tokenDao;
    /**
     * 根据appid生成token
     *
     * @param appid
     * @param appSecret
     * @return
     */
    @Transactional
    public GcToken createToken(String appid, String appSecret, String ip) {
        try {
            //把该用户之前有效的token设置为无效
            tokenDao.updateDel(appid);
            //创新新的appId
            Date date = new Date();
            String token = UUID.randomUUID().toString();
            GcToken gc = new GcToken();
            gc.setAppid(appid);
            gc.setCreateTime(date);
            //2小时过期
            gc.setOutTime(DateUtil.getNextMin(date, 120));
            gc.setAccesstoken(token);
            gc.setDel(1);
            tokenDao.save(gc);
            //保存日志
            GcTokenLog gcTokenLog = new GcTokenLog();
            gcTokenLog.setAppIp(appid);
            gcTokenLog.setCreateTime(new Date());
            gcTokenLog.setAppIp(ip);
            gcTokenLog.setMessage("创建token");
            gcTokenLog.setAccesstoken(token);
            gcTokenLog.setFlag(1);
            tokenLogDao.save(gcTokenLog);
            return gc;
        } catch (Exception e) {
            //保存失败日志
            GcTokenLog gcTokenLog = new GcTokenLog();
            gcTokenLog.setAppIp(appid);
            gcTokenLog.setCreateTime(new Date());
            gcTokenLog.setAppIp(ip);
            gcTokenLog.setMessage("创建token");
            gcTokenLog.setFlag(0);
            tokenLogDao.save(gcTokenLog);
        }
        return null;
    }
    /**
     * 根据token获取GcToken对象
     * @param token
     * @return
     */
    public GcToken getToken(String token) {
        return tokenDao.findByToken(token);
    }
}

+ 148 - 44
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/pc/prescription/PrescriptionExpressagePCService.java

@ -11,8 +11,10 @@ import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.service.app.prescription.PrescriptionNoticesService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.RoleService;
import com.yihu.wlyy.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -49,13 +51,12 @@ public class PrescriptionExpressagePCService extends BaseService {
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    private PrescriptionNoticesService prescriptionNoticesService;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private DoctorDao doctorDao;
    @Transactional
    public JSONObject getMedicine(String code,String userCode) throws Exception{
        JSONObject jsonObject = new JSONObject();
@ -155,6 +156,7 @@ public class PrescriptionExpressagePCService extends BaseService {
                        break;
                    }
                    default:{
                        jsonObject.put("status",-3);
                        PrescriptionLog prescriptionLog = new PrescriptionLog();
                        prescriptionLog.setCode(UUID.randomUUID().toString());
                        prescriptionLog.setPrescriptionCode(result.get("prescriptionCode").toString());
@ -183,6 +185,7 @@ public class PrescriptionExpressagePCService extends BaseService {
                prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
                prescriptionLog.setRemark("PC端取药码输入错误!");
                prescriptionLogDao.save(prescriptionLog);
            }
            return jsonObject;
@ -196,57 +199,158 @@ public class PrescriptionExpressagePCService extends BaseService {
        //更新二维码(isUse)
        PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(code);
        prescriptionDispensaryCode.setIsUse(1);
        prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
        //更新处方状态
        //判断二维码是居民取药码还是健管师取药码
//        prescriptionDispensaryCode.setIsUse(1);
//        prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
//        //更新处方状态
//        //判断二维码是居民取药码还是健管师取药码
        Prescription prescription =  prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        if(prescriptionDispensaryCode.getType()==1){//居民取药码
//        if(prescriptionDispensaryCode.getType()==1){//居民取药码
//
//            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
//        }else if(prescriptionDispensaryCode.getType()==2){
//            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
//        }
//        prescriptionDao.save(prescription);
//
//        //处方日志
//        PrescriptionLog prescriptionLog = new PrescriptionLog();
//        prescriptionLog.setCode(UUID.randomUUID().toString());
//        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
//        prescriptionLog.setCreateTime(new Date());
//        PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode("e707487f063540e1b6d581b16bb8fb12");
//        if(prescriptionDispensaryCode.getType()==1){//居民取药码
//
//            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
//            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.finish.getValue());
//            prescriptionLog.setUserCode(prescription.getPatient());
//            prescriptionLog.setUserName(prescription.getPatientName());
//            prescriptionLog.setUserType(1);
//        }else if(prescriptionDispensaryCode.getType()==2){
//            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
//            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
//            prescriptionLog.setUserCode(prescriptionExpressage.getExpressageCode());
//            prescriptionLog.setUserName(prescriptionExpressage.getExpressageName());
//            prescriptionLog.setUserType(2);
//            //发送模板消息通知患者药品开始配送
//
//        }
//        prescriptionLog.setFlag(1);
//        prescriptionLog.setHospital(prescriptionExpressage.getHospitalCode());
//        prescriptionLog.setHospitalName(prescriptionExpressage.getHospitalName());
//        prescriptionLogDao.save(prescriptionLog);
////        prescriptionLog.setType();
////        prescriptionLogDao
//        if(prescriptionDispensaryCode.getType()==2){
//            Patient patient = patientDao.findByCode(prescription.getPatient());
//            String url="prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
//                    "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName() ;
//        }
//        prescriptionExpressage.setExpressageTime(new Date());
//        Doctor doctor = doctorDao.findByCode(userCode);
//        prescriptionExpressage.setHospitalDoctorCode(userCode);
//        prescriptionExpressage.setHospitalDoctor(doctor.getName());
//        prescriptionExpressage.setFetchingMedicineTime(new Date());
//        prescriptionExpressageDao.save(prescriptionExpressage);
            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        }else if(prescriptionDispensaryCode.getType()==2){
            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        switch (prescriptionDispensaryCode.getType()) {
            case 1: {
                //判断是1 居民取药码
                dispensaryCode_1(userCode, prescriptionDispensaryCode);
                break;
            }
            case 2: {
                //判断是2 配送员(健管师)取药码
                dispensaryCode_2(userCode,prescription.getPatient(), prescriptionDispensaryCode);
                break;
            }
            default: {
                PrescriptionLog prescriptionLog = new PrescriptionLog();
                prescriptionLog.setCode(UUID.randomUUID().toString());
                prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
                prescriptionLog.setCreateTime(new Date());
                prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
                prescriptionLog.setFlag(1);
                prescriptionLog.setUserCode(userCode);
                prescriptionLog.setUserType(2);
                prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error.getValue());
                prescriptionLog.setRemark("编码类型错误");
                prescriptionLogDao.save(prescriptionLog);
            }
        }
        prescriptionDao.save(prescription);
    }
        //处方日志
    /**
     * 1 居民取药码 业务
     *
     * @param userCode
     * @param prescriptionDispensaryCode
     * @return
     */
    public void dispensaryCode_1(String userCode, PrescriptionDispensaryCode prescriptionDispensaryCode) {
        //修改处方状态为完成
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.finish.getValue());
        prescriptionLog.setCreateTime(new Date());
        PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode("e707487f063540e1b6d581b16bb8fb12");
        if(prescriptionDispensaryCode.getType()==1){//居民取药码
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.finish.getValue());
            prescriptionLog.setUserCode(prescription.getPatient());
            prescriptionLog.setUserName(prescription.getPatientName());
            prescriptionLog.setUserType(1);
        }else if(prescriptionDispensaryCode.getType()==2){
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
            prescriptionLog.setUserCode(prescriptionExpressage.getExpressageCode());
            prescriptionLog.setUserName(prescriptionExpressage.getExpressageName());
            prescriptionLog.setUserType(2);
            //发送模板消息通知患者药品开始配送
        }
        prescriptionLog.setFlag(1);
        prescriptionLog.setHospital(prescriptionExpressage.getHospitalCode());
        prescriptionLog.setHospitalName(prescriptionExpressage.getHospitalName());
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserType(2);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
        prescriptionLogDao.save(prescriptionLog);
//        prescriptionLog.setType();
//        prescriptionLogDao
        if(prescriptionDispensaryCode.getType()==2){
            Patient patient = patientDao.findByCode(prescription.getPatient());
            String url="prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
                    "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName() ;
        }
        prescriptionExpressage.setExpressageTime(new Date());
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
    }
    /**
     * 配送员(健管师)取药码 业务
     *
     * @param userCode
     * @param prescriptionDispensaryCode
     * @return
     */
    public void dispensaryCode_2(String userCode,String patientCode, PrescriptionDispensaryCode prescriptionDispensaryCode) throws Exception {
        //获取配送的医生信息
        Doctor doctor = doctorDao.findByCode(userCode);
        prescriptionExpressage.setHospitalDoctorCode(userCode);
        prescriptionExpressage.setHospitalDoctor(doctor.getName());
        prescriptionExpressage.setFetchingMedicineTime(new Date());
        prescriptionExpressageDao.save(prescriptionExpressage);
        //修改处方状态为配送中
        Prescription prescription = prescriptionDao.findByCode(prescriptionDispensaryCode.getPrescriptionCode());
        Date expressageing = new Date();
        prescription.setExpressageTime(expressageing);
        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        //得到patient
        Patient patient = patientDao.findByCode(prescription.getPatient());
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage.getValue());
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserName(doctor.getName());
        prescriptionLog.setUserType(2);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
        prescriptionLogDao.save(prescriptionLog);
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        //发送模板消息通知患者药品开始配送
        String url = "prescription/html/order_tracking.html?openid=" + patient.getOpenid() + "" +
                "&code=" + prescriptionDispensaryCode.getPrescriptionCode() + "&toUser=" + patient.getCode() + "&toName=" + patient.getName();
        prescriptionNoticesService.sendMessages(patientCode, doctor.getName(), DateUtil.dateToStrLong(expressageing), 3, 0, url);
    }
}

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

@ -123,12 +123,14 @@ public class JwPrescriptionService {
     * @return
     * @throws Exception
     */
    public String saveRecipe(String prescriptionCode){
    public String saveRecipe(String prescriptionCode,String jwRegisterType,String jwDept){
        String response = null;
        try {
            String url = jwUrl + "/third/prescription/saveRecipe";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("prescriptionCode", prescriptionCode));
            params.add(new BasicNameValuePair("jwRegisterType", jwRegisterType));
            params.add(new BasicNameValuePair("jwDept", jwDept));
            response = httpClientUtil.post(url, params, "UTF-8");
            return response;

+ 0 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemData.java

@ -15,6 +15,4 @@ public class SystemData {
	public static Map<String, Token> patientTokens = new HashMap<String, Token>();
	// 患者公众号验证信息
	public static Map<String, Token> wxPatientTokens = new HashMap<String, Token>();
	// PC端取药系统验证信息
	public static Map<String, Token> prescriptionPCTokens = new HashMap<String, Token>();
}

+ 83 - 67
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java

@ -17,6 +17,7 @@ import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.patchca.color.SingleColorFactory;
@ -74,7 +75,7 @@ public class LoginController extends BaseController {
     *
     * @return
     */
    @RequestMapping(value = "public_key",method = {RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "public_key", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public String publicKey() {
        try {
@ -96,22 +97,20 @@ public class LoginController extends BaseController {
    /**
     * 医生登录接口
     *
     *  @param mobile  手机号
     * @param captcha 短信验证码
     * @param idcard  身份证号
     * @param platform  // 1患者端,2医生端app,3微信公众号wechat,4IM医生端pc,5PC端取药系统
     * @param mobile   手机号
     * @param captcha  短信验证码
     * @param platform // 1患者端,2医生端app,3微信公众号wechat,4 IM医生端pc, PC端取药系统
     * @param password 密码
     * @return
     */
    @RequestMapping(value = "doctor",method = RequestMethod.POST)
    @RequestMapping(value = "doctor", method = RequestMethod.POST)
    @ResponseBody
    public String doctor(@RequestParam(required = false) String mobile,
                         @RequestParam(required = false) String captcha,
                         @RequestParam(required = false) String idcard,
                         @RequestParam(required = false) Integer platform,
                         @RequestParam(required = false) String password) {
    public String doctor(@ApiParam(required = false, name = "mobile", value = "手机号") @RequestParam(required = false, value = "mobile") String mobile,
                         @ApiParam(required = false, name = "captcha", value = "短信验证码") @RequestParam(required = false) String captcha,
                         @ApiParam(required = false, name = "platform", value = "医生端pc,取药系统 或者对外系统") @RequestParam(required = false) Integer platform,
                         @ApiParam(required = false, name = "password", value = "密码") @RequestParam(required = false) String password) {
        String errorMessage;
        LoginLog loginLog=new LoginLog();
        LoginLog loginLog = new LoginLog();
        loginLog.setCreateTime(new Date());
        loginLog.setPhone(mobile);
        loginLog.setType("2");
@ -119,31 +118,38 @@ public class LoginController extends BaseController {
        loginLog.setAppVersion(super.getAppVersion());
        try {
            if (StringUtils.isEmpty(getIMEI())) {
                errorMessage="获取手机IMEI码失败!";
                errorMessage = "获取手机IMEI码失败!";
                loginLog.setErrorMessage(errorMessage);
                loginLogService.saveLog(loginLog);
                return error(-1, errorMessage);
            }
            if(platform==null){
            if (platform == null) {
                platform = 2;//默认为医生app端
            }
            //身份证登录
            if(StringUtils.isNoneEmpty(mobile)&&StringUtils.isNoneEmpty(password)){
            if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(password)) {
                password = RSAUtils.getInstance(doctorService).decryptString(password);
                password=StringUtils.reverse(password);
                Doctor doctor=doctorService.findDoctorByMobile(mobile);
                password = StringUtils.reverse(password);
                Doctor doctor = doctorService.findDoctorByMobile(mobile);
                loginLog.setLoginType("2");
                if(doctor==null){
                    errorMessage="该号码未注册!";
                if (doctor == null) {
                    errorMessage = "该号码未注册!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1,errorMessage);
                    return error(-1, errorMessage);
                }
                loginLog.setUserCode(doctor.getCode());
                String loginPassword= MD5.GetMD5Code(password+doctor.getSalt());
                if(loginPassword.equals(doctor.getPassword())){
                    // 用户校验通过,生成token
                    Token token = tokenService.newToken(doctor.getCode(), getIMEI(), platform);
                String loginPassword = MD5.GetMD5Code(password + doctor.getSalt());
                if (loginPassword.equals(doctor.getPassword())) {
                    Token token = tokenService.findDoctorToken(doctor.getCode());
                    if (token != null && platform == 4) {
                        //pc版本要做单点登陆 所以如果platform =4 并且 token存在直接返回之前的token
                    } else {
                        // 用户校验通过,生成token
                        token = tokenService.newToken(doctor.getCode(), getIMEI(), platform);
                    }
                    loginLog.setTokenId(token.getId());
                    loginLog.setType("1");
                    Map<String, Object> map = new HashMap<>();
@ -158,52 +164,62 @@ public class LoginController extends BaseController {
                    //获取医生角色和区域权限
                    List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(doctor.getCode());
                    map.put("userRole", roleMap);
                    if("10".equals(doctor.getLevel())&&roleMap.size()==0){
                        errorMessage="改用户没有管理员权限";
                    if ("10" .equals(doctor.getLevel()) && roleMap.size() == 0) {
                        errorMessage = "改用户没有管理员权限";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);
                    }
                    loginLogService.saveLog(loginLog);
                    return write(200, "登录成功", "data", map);
                }else{
                    errorMessage="密码错误,登录失败";
                } else {
                    errorMessage = "密码错误,登录失败";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                }
            }
            if(StringUtils.isNoneEmpty(mobile)&&StringUtils.isNoneEmpty(captcha)){
            if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(captcha)) {
                // 对验证码进行校验
                int res = smsService.check(mobile, 5, captcha);
                switch (res) {
                    case -2:{
                        errorMessage="验证码已过期!";
                    case -2: {
                        errorMessage = "验证码已过期!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);}
                    case -1:{
                        errorMessage="请输入正确的验证码!";
                        return error(-1, errorMessage);
                    }
                    case -1: {
                        errorMessage = "请输入正确的验证码!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);}
                    case 0:{
                        errorMessage="验证码无效!";
                        return error(-1, errorMessage);
                    }
                    case 0: {
                        errorMessage = "验证码无效!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);}
                        return error(-1, errorMessage);
                    }
                }
                Doctor doctor = doctorService.findDoctorByMobile(mobile);
                loginLog.setLoginType("1");
                if (doctor == null) {
                     errorMessage="该手机号未注册,请确认!";
                    errorMessage = "该手机号未注册,请确认!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else {
                    loginLog.setUserCode(doctor.getCode());
                    // 用户校验通过,生成token
                    Token token = tokenService.newToken(doctor.getCode(), getIMEI(), platform);
                    Token token = tokenService.findDoctorToken(doctor.getCode());
                    if (token != null && platform == 4) {
                        //pc版本要做单点登陆 所以如果platform =4 并且 token存在直接返回之前的token
                    } else {
                        // 用户校验通过,生成token
                        token = tokenService.newToken(doctor.getCode(), getIMEI(), platform);
                    }
                    loginLog.setTokenId(token.getId());
                    loginLog.setType("1");
                    Map<String, Object> map = new HashMap<>();
@ -218,8 +234,8 @@ public class LoginController extends BaseController {
                    //获取医生角色和区域权限
                    List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(doctor.getCode());
                    map.put("userRole", roleMap);
                    if("10".equals(doctor.getLevel())&&roleMap.size()==0){
                        errorMessage="改用户没有管理员权限";
                    if ("10" .equals(doctor.getLevel()) && roleMap.size() == 0) {
                        errorMessage = "改用户没有管理员权限";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);
@ -228,10 +244,10 @@ public class LoginController extends BaseController {
                    return write(200, "登录成功", "data", map);
                }
            }
            errorMessage="登录信息不完整,请重新输入!";
            errorMessage = "登录信息不完整,请重新输入!";
            loginLog.setErrorMessage(errorMessage);
            loginLogService.saveLog(loginLog);
            return error(-1,errorMessage);
            return error(-1, errorMessage);
        } catch (Exception e) {
            loginLog.setErrorMessage(e.getMessage());
            loginLogService.saveLog(loginLog);
@ -250,14 +266,14 @@ public class LoginController extends BaseController {
     * @param newpwd  新密码
     * @return
     */
    @RequestMapping(value = "forgetpwd",method = RequestMethod.POST)
    @RequestMapping(value = "forgetpwd", method = RequestMethod.POST)
    @ResponseBody
    public String forgetpwd(int type,
                            @RequestParam(required = false) String idcard,
                            @RequestParam(required = false) String mobile,
                            @RequestParam(required = false) String captchaToken,
                            @RequestParam(required = false)String captcha,
                            @RequestParam(required = false)String patient,
                            @RequestParam(required = false) String captcha,
                            @RequestParam(required = false) String patient,
                            String newpwd) {
        try {
            //String ct = request.getSession().getAttribute("captchaToken").toString();
@ -278,13 +294,13 @@ public class LoginController extends BaseController {
            if (type == 2) {
                // 医生端
                    Doctor doctor = doctorService.findDoctorByMobile(mobile);
                    String password = RSAUtils.getInstance(doctorService).decryptString(newpwd);
                    password=StringUtils.reverse(password);
                    password=MD5.GetMD5Code(password+doctor.getSalt());
                    doctor.setPassword(password);
                    doctorService.updateDoctorPwd(doctor);
                    return success("操作成功!");
                Doctor doctor = doctorService.findDoctorByMobile(mobile);
                String password = RSAUtils.getInstance(doctorService).decryptString(newpwd);
                password = StringUtils.reverse(password);
                password = MD5.GetMD5Code(password + doctor.getSalt());
                doctor.setPassword(password);
                doctorService.updateDoctorPwd(doctor);
                return success("操作成功!");
            } else {
                // 患者端
                Patient patientTemp = patientService.findByIdcard(idcard);
@ -292,8 +308,8 @@ public class LoginController extends BaseController {
                    return error(-1, "操作失败:此用户未注册");
                } else {
                    String password = RSAUtils.getInstance(doctorService).decryptString(newpwd);
                    password=StringUtils.reverse(password);
                    password=MD5.GetMD5Code(password+patientTemp.getSalt());
                    password = StringUtils.reverse(password);
                    password = MD5.GetMD5Code(password + patientTemp.getSalt());
                    patientTemp.setPassword(password);
                    patientService.updatePatientPwd(patientTemp);
                    return success("操作成功!");
@ -311,7 +327,7 @@ public class LoginController extends BaseController {
     * @param type 1患者,2医生,3微信公众号
     * @return
     */
    @RequestMapping(value = "exit",method = {RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "exit", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public String logout(int type) {
        try {
@ -323,7 +339,7 @@ public class LoginController extends BaseController {
        }
    }
    @RequestMapping(value = "/third/login",method = {RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "/third/login", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public String thirdLogin(
            @RequestParam(value = "id") int id,
@ -385,7 +401,7 @@ public class LoginController extends BaseController {
     * @param response
     * @throws IOException
     */
    @RequestMapping(value="pcrimg",method = {RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "pcrimg", method = {RequestMethod.POST, RequestMethod.GET})
    public void crimg(HttpServletRequest request, HttpServletResponse response) throws IOException {
        ConfigurableCaptchaService cs = new ConfigurableCaptchaService();
        cs.setColorFactory(new SingleColorFactory(new Color(25, 60, 170)));
@ -432,25 +448,25 @@ public class LoginController extends BaseController {
     * @param mobile 登录手机号
     * @return
     */
    @RequestMapping(value = "checkmobile",method = RequestMethod.POST)
    @RequestMapping(value = "checkmobile", method = RequestMethod.POST)
    @ResponseBody
    public String checkmobile(@RequestParam(required = true,value = "mobile",defaultValue = "0")String mobile,
                              @RequestParam(required = true,value = "type",defaultValue = "0") int type) {
    public String checkmobile(@RequestParam(required = true, value = "mobile", defaultValue = "0") String mobile,
                              @RequestParam(required = true, value = "type", defaultValue = "0") int type) {
        try {
            if(type==0){//患者端
            if (type == 0) {//患者端
                List<Patient> temp = patientService.findByMobile(mobile);
                if (temp != null&&temp.size()>0) {
                if (temp != null && temp.size() > 0) {
                    // 设置身份证号
                    return write(200, "手机号码已经被注册!");
                }
                return error(-1, "该手机号未被注册!");
            }else if(type==1){
            } else if (type == 1) {
                Doctor doctor = doctorService.findDoctorByMobile(mobile);
                if(doctor!=null){
                if (doctor != null) {
                    return write(200, "手机号码已经被注册!");
                }
                return error(-1, "该手机号未被注册!");
            }else{
            } else {
                return error(1, "错误的请求类型!");
            }
        } catch (Exception e) {

+ 219 - 219
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/PCLoginController.java

@ -1,228 +1,228 @@
package com.yihu.wlyy.web.common.account;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.login.LoginLog;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.repository.security.TokenDao;
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.common.account.RoleService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.service.common.login.LoginLogService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.patchca.color.SingleColorFactory;
import org.patchca.filter.predefined.*;
import org.patchca.service.ConfigurableCaptchaService;
import org.patchca.utils.encoder.EncoderHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.awt.*;
import java.io.IOException;
import java.util.*;
import java.util.List;
//package com.yihu.wlyy.web.common.account;
//
//import com.yihu.wlyy.entity.doctor.profile.Doctor;
//import com.yihu.wlyy.entity.login.LoginLog;
//import com.yihu.wlyy.entity.patient.Patient;
//import com.yihu.wlyy.entity.security.Token;
//import com.yihu.wlyy.repository.security.TokenDao;
//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.common.account.RoleService;
//import com.yihu.wlyy.service.common.account.TokenService;
//import com.yihu.wlyy.service.common.login.LoginLogService;
//import com.yihu.wlyy.util.DateUtil;
//import com.yihu.wlyy.util.MD5;
//import com.yihu.wlyy.util.RSAUtils;
//import com.yihu.wlyy.util.SystemData;
//import com.yihu.wlyy.web.BaseController;
//import io.swagger.annotations.Api;
/**
 * @author calvin
 */
@Controller
@RequestMapping(value = "/loginPC", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "健康师登录取药系统")
public class PCLoginController extends BaseController {
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private TokenService tokenService;
    @Autowired
    private SMSService smsService;
    @Autowired
    public TokenDao tokenDao;
    @Autowired
    private RoleService roleService;
    @Autowired
    private LoginLogService loginLogService;
    /**
     *
     * @param mobile 手机号
     * @param captcha 短信验证码
     * @param platform  1、患者端,2、医生端app,3、微信公众号wechat,4、医生端pc,5PC端取药系统
     * @param password 密码
     * @return
     */
    @RequestMapping(value = "doctor",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ResponseBody
    public String doctor(@ApiParam(required = false, name = "mobile", value = "手机号") @RequestParam(required = false,value = "mobile") String mobile,
                         @ApiParam(required = false, name = "captcha", value = "短信验证码") @RequestParam(required = false) String captcha,
                         @ApiParam(required = false, name = "platform", value = "医生端pc") @RequestParam(required = false,defaultValue = "5") Integer platform,
                         @ApiParam(required = false, name = "password", value = "密码") @RequestParam(required = false) String password) {
        String errorMessage;
        LoginLog loginLog=new LoginLog();
        loginLog.setCreateTime(new Date());
        loginLog.setPhone(mobile);
        loginLog.setType("2");
        loginLog.setUserType("2");
        loginLog.setAppVersion(super.getAppVersion());
        try {
            if(platform==null){
                platform = 5;//默认为医生app端
            }
            //身份证登录
            if(StringUtils.isNoneEmpty(mobile)&&StringUtils.isNoneEmpty(password)){
                password = RSAUtils.getInstance(doctorService).decryptString(password);
                password=StringUtils.reverse(password);
                Doctor doctor=doctorService.findDoctorByMobile(mobile);
                loginLog.setLoginType("2");
                if(doctor==null){
                    errorMessage="该号码未注册!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1,errorMessage);
                }
                loginLog.setUserCode(doctor.getCode());
                String loginPassword= MD5.GetMD5Code(password+doctor.getSalt());
                if(loginPassword.equals(doctor.getPassword())){
                    //使用i健康系统账号体系,只有健康师有权限登录取药系统
                    if(doctor.getLevel()!=3){
                        loginLog.setType("2");
                        errorMessage="该用户角色没有登录权限!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);
                    }
                    // 用户校验通过,生成token
                    Token token = tokenService.newToken(doctor.getCode(), "pc", platform);
                    loginLog.setTokenId(token.getId());
                    loginLog.setType("1");
                    Map<String, Object> map = new HashMap<>();
                    map.put("id", doctor.getId());
                    map.put("uid", doctor.getCode());
                    map.put("token", token.getToken());
                    map.put("name", doctor.getName());
                    map.put("hospital", doctor.getHospital());
                    map.put("photo", doctor.getPhoto());
                    // 设置医生类型:1专科医生,2全科医生,3健康管理师
                    map.put("doctorType", doctor.getLevel());
                    //获取医生角色和区域权限
//                    List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(doctor.getCode());
//                    map.put("userRole", roleMap);
//                    if("10".equals(doctor.getLevel())&&roleMap.size()==0){
//                        errorMessage="该用户没有管理员权限";
//import io.swagger.annotations.ApiParam;
//import org.apache.commons.lang3.StringUtils;
//import org.json.JSONObject;
//import org.patchca.color.SingleColorFactory;
//import org.patchca.filter.predefined.*;
//import org.patchca.service.ConfigurableCaptchaService;
//import org.patchca.utils.encoder.EncoderHelper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.MediaType;
//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 javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.awt.*;
//import java.io.IOException;
//import java.util.*;
//import java.util.List;
//
////import io.swagger.annotations.Api;
//
///**
// * @author calvin
// */
//@Controller
//@RequestMapping(value = "/loginPC", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//@Api(description = "健康师登录取药系统")
//public class PCLoginController extends BaseController {
//
//    @Autowired
//    private DoctorService doctorService;
//
//    @Autowired
//    private TokenService tokenService;
//
//    @Autowired
//    private SMSService smsService;
//
//    @Autowired
//    public TokenDao tokenDao;
//
//    @Autowired
//    private RoleService roleService;
//    @Autowired
//    private LoginLogService loginLogService;
//
//    /**
//     *
//     * @param mobile 手机号
//     * @param captcha 短信验证码
//     * @param platform  1、患者端,2、医生端app,3、微信公众号wechat,4、医生端pc,5PC端取药系统
//     * @param password 密码
//     * @return
//     */
//    @RequestMapping(value = "doctor",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    @ResponseBody
//    public String doctor(@ApiParam(required = false, name = "mobile", value = "手机号") @RequestParam(required = false,value = "mobile") String mobile,
//                         @ApiParam(required = false, name = "captcha", value = "短信验证码") @RequestParam(required = false) String captcha,
//                         @ApiParam(required = false, name = "platform", value = "医生端pc") @RequestParam(required = false,defaultValue = "4") Integer platform,
//                         @ApiParam(required = false, name = "password", value = "密码") @RequestParam(required = false) String password) {
//
//        String errorMessage;
//        LoginLog loginLog=new LoginLog();
//        loginLog.setCreateTime(new Date());
//        loginLog.setPhone(mobile);
//        loginLog.setType("2");
//        loginLog.setUserType("2");
//        loginLog.setAppVersion(super.getAppVersion());
//        try {
//            if(platform==null){
//                platform = 4;//默认为医生app端
//            }
//            //身份证登录
//            if(StringUtils.isNoneEmpty(mobile)&&StringUtils.isNoneEmpty(password)){
//                password = RSAUtils.getInstance(doctorService).decryptString(password);
//                password=StringUtils.reverse(password);
//                Doctor doctor=doctorService.findDoctorByMobile(mobile);
//                loginLog.setLoginType("2");
//                if(doctor==null){
//                    errorMessage="该号码未注册!";
//                    loginLog.setErrorMessage(errorMessage);
//                    loginLogService.saveLog(loginLog);
//                    return error(-1,errorMessage);
//                }
//                loginLog.setUserCode(doctor.getCode());
//                String loginPassword= MD5.GetMD5Code(password+doctor.getSalt());
//                if(loginPassword.equals(doctor.getPassword())){
//                    //使用i健康系统账号体系,只有健康师有权限登录取药系统
//                    if(doctor.getLevel()!=3){
//                        loginLog.setType("2");
//                        errorMessage="该用户角色没有登录权限!";
//                        loginLog.setErrorMessage(errorMessage);
//                        loginLogService.saveLog(loginLog);
//                        return error(-1, errorMessage);
//                    }
                    loginLogService.saveLog(loginLog);
                    return write(200, "登录成功", "data", map);
                }else{
                    errorMessage="密码错误,登录失败";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                }
            }
            if(StringUtils.isNoneEmpty(mobile)&&StringUtils.isNoneEmpty(captcha)){
                // 对验证码进行校验
                int res = smsService.check(mobile, 5, captcha);
                switch (res) {
                    case -2:{
                        errorMessage="验证码已过期!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);}
                    case -1:{
                        errorMessage="请输入正确的验证码!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);}
                    case 0:{
                        errorMessage="验证码无效!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);}
                }
                Doctor doctor = doctorService.findDoctorByMobile(mobile);
                loginLog.setLoginType("1");
                if (doctor == null) {
                    errorMessage="该手机号未注册,请确认!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else {
                    loginLog.setUserCode(doctor.getCode());
                    //使用i健康系统账号体系,只有健康师有权限登录取药系统
                    if(doctor.getLevel()!=3){
                        loginLog.setType("2");
                        errorMessage="该用户角色没有登录权限!";
                        loginLog.setErrorMessage(errorMessage);
                        loginLogService.saveLog(loginLog);
                        return error(-1, errorMessage);
                    }
                    // 用户校验通过,生成token
                    Token token = tokenService.newToken(doctor.getCode(), "pc", platform);
                    loginLog.setTokenId(token.getId());
                    loginLog.setType("1");
                    Map<String, Object> map = new HashMap<>();
                    map.put("id", doctor.getId());
                    map.put("uid", doctor.getCode());
                    map.put("token", token.getToken());
                    map.put("name", doctor.getName());
                    map.put("hospital", doctor.getHospital());
                    map.put("photo", doctor.getPhoto());
                    // 设置医生类型:1专科医生,2全科医生,3健康管理师
                    map.put("doctorType", doctor.getLevel());
                    //获取医生角色和区域权限
//                    List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(doctor.getCode());
//                    map.put("userRole", roleMap);
//                    if("10".equals(doctor.getLevel())&&roleMap.size()==0){
//                        errorMessage="改用户没有管理员权限";
//
//
//                    // 用户校验通过,生成token
//                    Token token = tokenService.newToken(doctor.getCode(), "pc", platform);
//                    loginLog.setTokenId(token.getId());
//                    loginLog.setType("1");
//                    Map<String, Object> map = new HashMap<>();
//                    map.put("id", doctor.getId());
//                    map.put("uid", doctor.getCode());
//                    map.put("token", token.getToken());
//                    map.put("name", doctor.getName());
//                    map.put("hospital", doctor.getHospital());
//                    map.put("photo", doctor.getPhoto());
//                    // 设置医生类型:1专科医生,2全科医生,3健康管理师
//                    map.put("doctorType", doctor.getLevel());
//                    //获取医生角色和区域权限
////                    List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(doctor.getCode());
////                    map.put("userRole", roleMap);
////                    if("10".equals(doctor.getLevel())&&roleMap.size()==0){
////                        errorMessage="该用户没有管理员权限";
////                        loginLog.setErrorMessage(errorMessage);
////                        loginLogService.saveLog(loginLog);
////                        return error(-1, errorMessage);
////                    }
//                    loginLogService.saveLog(loginLog);
//                    return write(200, "登录成功", "data", map);
//                }else{
//                    errorMessage="密码错误,登录失败";
//                    loginLog.setErrorMessage(errorMessage);
//                    loginLogService.saveLog(loginLog);
//                    return error(-1, errorMessage);
//                }
//            }
//            if(StringUtils.isNoneEmpty(mobile)&&StringUtils.isNoneEmpty(captcha)){
//                // 对验证码进行校验
//                int res = smsService.check(mobile, 5, captcha);
//                switch (res) {
//                    case -2:{
//                        errorMessage="验证码已过期!";
//                        loginLog.setErrorMessage(errorMessage);
//                        loginLogService.saveLog(loginLog);
//                        return error(-1, errorMessage);}
//                    case -1:{
//                        errorMessage="请输入正确的验证码!";
//                        loginLog.setErrorMessage(errorMessage);
//                        loginLogService.saveLog(loginLog);
//                        return error(-1, errorMessage);}
//                    case 0:{
//                        errorMessage="验证码无效!";
//                        loginLog.setErrorMessage(errorMessage);
//                        loginLogService.saveLog(loginLog);
//                        return error(-1, errorMessage);}
//                }
//                Doctor doctor = doctorService.findDoctorByMobile(mobile);
//                loginLog.setLoginType("1");
//                if (doctor == null) {
//                    errorMessage="该手机号未注册,请确认!";
//                    loginLog.setErrorMessage(errorMessage);
//                    loginLogService.saveLog(loginLog);
//                    return error(-1, errorMessage);
//                } else {
//                    loginLog.setUserCode(doctor.getCode());
//
//                    //使用i健康系统账号体系,只有健康师有权限登录取药系统
//                    if(doctor.getLevel()!=3){
//                        loginLog.setType("2");
//                        errorMessage="该用户角色没有登录权限!";
//                        loginLog.setErrorMessage(errorMessage);
//                        loginLogService.saveLog(loginLog);
//                        return error(-1, errorMessage);
//                    }
                    loginLogService.saveLog(loginLog);
                    return write(200, "登录成功", "data", map);
                }
            }
            errorMessage="登录信息不完整,请重新输入!";
            loginLog.setErrorMessage(errorMessage);
            loginLogService.saveLog(loginLog);
            return error(-1,errorMessage);
        } catch (Exception e) {
            loginLog.setErrorMessage(e.getMessage());
            loginLogService.saveLog(loginLog);
            error(e);
            return error(-1, "系统异常,登录失败");
        }
    }
}
//
//                    // 用户校验通过,生成token
//                    Token token = tokenService.newToken(doctor.getCode(), "pc", platform);
//                    loginLog.setTokenId(token.getId());
//                    loginLog.setType("1");
//                    Map<String, Object> map = new HashMap<>();
//                    map.put("id", doctor.getId());
//                    map.put("uid", doctor.getCode());
//                    map.put("token", token.getToken());
//                    map.put("name", doctor.getName());
//                    map.put("hospital", doctor.getHospital());
//                    map.put("photo", doctor.getPhoto());
//                    // 设置医生类型:1专科医生,2全科医生,3健康管理师
//                    map.put("doctorType", doctor.getLevel());
//                    //获取医生角色和区域权限
////                    List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(doctor.getCode());
////                    map.put("userRole", roleMap);
////                    if("10".equals(doctor.getLevel())&&roleMap.size()==0){
////                        errorMessage="改用户没有管理员权限";
////                        loginLog.setErrorMessage(errorMessage);
////                        loginLogService.saveLog(loginLog);
////                        return error(-1, errorMessage);
////                    }
//                    loginLogService.saveLog(loginLog);
//                    return write(200, "登录成功", "data", map);
//                }
//            }
//            errorMessage="登录信息不完整,请重新输入!";
//            loginLog.setErrorMessage(errorMessage);
//            loginLogService.saveLog(loginLog);
//            return error(-1,errorMessage);
//        } catch (Exception e) {
//            loginLog.setErrorMessage(e.getMessage());
//            loginLogService.saveLog(loginLog);
//            error(e);
//            return error(-1, "系统异常,登录失败");
//        }
//    }
//}

+ 39 - 40
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/device/DeviceController.java

@ -17,50 +17,49 @@ import java.util.List;
@RequestMapping(value = "/common/device", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "设备管理")
public class DeviceController extends BaseController {
	
	@Autowired
	private DeviceService deviceService;
    @Autowired
    private DeviceService deviceService;
	@ApiOperation("获取设备分类")
	@RequestMapping(value = "DeviceCategory",method = RequestMethod.POST)
	@ResponseBody
	public String getDeviceCategory() {
		try {
			List<DeviceCategory> list = deviceService.findAllCategory();
			return write(200,"获取设备分类成功!","data",list);
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, "获取设备分类失败!");
		}
	}
    @ApiOperation("获取设备分类")
    @RequestMapping(value = "DeviceCategory", method = RequestMethod.POST)
    @ResponseBody
    public String getDeviceCategory() {
        try {
            List<DeviceCategory> list = deviceService.findAllCategory();
            return write(200, "获取设备分类成功!", "data", list);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, "获取设备分类失败!");
        }
    }
	@ApiOperation("获取设备列表")
	@RequestMapping(value = "DeviceList",method = RequestMethod.POST)
	@ResponseBody
	public String getDeviceList(@ApiParam(name="category_code",value="设备类型代码",defaultValue = "1")
								 @RequestParam(value="category_code",required = true) String categoryCode) {
		try {
			List<Device> list = deviceService.findDeviceByCategory(categoryCode);
			return write(200,"获取设备列表成功!","data",list);
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, "获取设备列表失败!");
		}
	}
    @ApiOperation("获取设备列表")
    @RequestMapping(value = "DeviceList", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public String getDeviceList(@ApiParam(name = "category_code", value = "设备类型代码", defaultValue = "1")
                                @RequestParam(value = "category_code", required = true) String categoryCode) {
        try {
            List<Device> list = deviceService.findDeviceByCategory(categoryCode);
            return write(200, "获取设备列表成功!", "data", list);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, "获取设备列表失败!");
        }
    }
	@ApiOperation("获取设备信息")
	@RequestMapping(value = "DeviceInfo",method = RequestMethod.POST)
	@ResponseBody
	public String getDeviceInfo(@ApiParam(name="id",value="设备ID",defaultValue = "19")
									   @RequestParam(value="id",required = true) String id) {
		try {
			Device device = deviceService.findById(id);
    @ApiOperation("获取设备信息")
    @RequestMapping(value = "DeviceInfo", method = RequestMethod.POST)
    @ResponseBody
    public String getDeviceInfo(@ApiParam(name = "id", value = "设备ID", defaultValue = "19")
                                @RequestParam(value = "id", required = true) String id) {
        try {
            Device device = deviceService.findById(id);
			return write(200, "查询成功", "data", device);
		} catch (Exception ex) {
			return invalidUserException(ex, -1, ex.getMessage());
		}
	}
            return write(200, "查询成功", "data", device);
        } catch (Exception ex) {
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }
}

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

@ -292,7 +292,7 @@ public class DoctorController extends BaseController {
            page = page >= 1 ? page - 1 : 0;
            List<Hospital> hos = hospitalService.getHospitals(type, province, city, town, key, page, pagesize);
            List<Hospital> hos = hospitalService.getHospitals(type, province, city, town, key,null, page, pagesize);
            return write(200, "查询成功", "data", hos);
        } catch (Exception e) {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java

@ -171,7 +171,7 @@ public class PrescriptionCodeController extends BaseController{
    public String scanQrcode(
            @RequestParam(value = "code",required = true) String code){
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.scanQrcode(code);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.scanQrcode(code,getUID());
            return write(200, "扫码成功!", "data", prescriptionDispensaryCode);
        } catch (Exception e) {
            error(e);

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

@ -453,5 +453,14 @@ public class PrescriptionInfoController extends BaseController {
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPhysicMinDose", method = RequestMethod.GET)
    @ApiOperation(value = "获取药品最小用量")
    public String getPhysicMinDose(String code) {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getPhysicMinDose(code));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
}

+ 11 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionLogController.java

@ -96,6 +96,7 @@ public class PrescriptionLogController extends BaseController {
            for (int i = 0; i < expressageLogs.size(); i++) {
                PrescriptionExpressageLog prescriptionExpressageLog = expressageLogs.get(i);
                PrescriptionLog prescriptionLog = new PrescriptionLog();
                prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
                prescriptionLog.setCreateTime(prescriptionExpressageLog.getCreateTime());
                prescriptionLog.setHospital(prescriptionExpressageLog.getAcceptHospital());
                prescriptionLog.setHospitalName(prescriptionExpressageLog.getAcceptHospitalName());
@ -105,7 +106,7 @@ public class PrescriptionLogController extends BaseController {
            }
            //排序
            //排序
            expressageLogs.sort((o1, o2) -> {
            prescriptionLogs.sort((o1, o2) -> {
                long map1value = o1.getCreateTime().getTime();
                long map2value = o2.getCreateTime().getTime();
@ -117,20 +118,20 @@ public class PrescriptionLogController extends BaseController {
                    return 0;
                }
            });
            if (prescriptionLogs != null) {
            if (prescriptionLogs != null && prescriptionLogs.size() > 0) {
                JSONArray ja = new JSONArray();
                    prescriptionLogs.stream().forEach(one -> {
                        JSONObject jo = new JSONObject();
                        jo.put("createTime", DateUtil.dateToStrLong(one.getCreateTime()));
                        jo.put("statusName", one.getStatusName());
                        ja.put(jo);
                });
                for (int i = 0; i < prescriptionLogs.size(); i++) {
                    PrescriptionLog one = prescriptionLogs.get(i);
                    JSONObject jo = new JSONObject();
                    jo.put("createTime", DateUtil.dateToStrLong(one.getCreateTime()));
                    jo.put("statusName", one.getStatusName());
                    ja.put(jo);
                }
                return write(200, "获取处方流程成功", "data", ja);
            } else {
                return error(-1, "获取失败");
            }
        } catch (Exception e) {
        } catch (Exception e){
            e.printStackTrace();
            return error(-1, "获取失败");
        }

+ 7 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescriptionPC/PrescriptionExpressagePCController.java

@ -29,6 +29,10 @@ public class PrescriptionExpressagePCController extends BaseController {
        try{
            JSONObject jSONObject = prescriptionExpressagePCService.getMedicine(code,getUID());
//            jSONObject.toString().replace("\\","");
            Integer status = jSONObject.getInteger("status");
            if(status==-3||status==-100){
                return error(-1, "获取信息失败!");
            }
            return write(200, "获取信息成功!", "data", jSONObject);
        }catch (Exception e) {
            error(e);
@ -41,11 +45,11 @@ public class PrescriptionExpressagePCController extends BaseController {
    public String fetchingMedicine(
            @ApiParam(required = true, name = "code", value = "二维码(居民取药码、健管师取药码)") @RequestParam(value = "code", required = true) String code){
        try {
            prescriptionExpressagePCService.fetchingMedicine(code, getUID());
            return write(200, "更改成功!");
            prescriptionExpressagePCService.fetchingMedicine(code, getUID());//xh1D2017031503333
            return write(200, "操作成功!");
        }catch (Exception e) {
            error(e);
            return error(-1, "更改失败!");
            return error(-1, "操作失败!");
        }
    }
}

+ 52 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcHospitalController.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.web.gateway.controller;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.service.app.hospital.HospitalService;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.gateway.vo.HospitalModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
@RestController
@RequestMapping("/wlyygc/hospital")
@Api(description = "医院相关服务,医院,科室")
public class GcHospitalController {
    @Autowired
    private HospitalService hospitalService;
    @RequestMapping(value = "/", method = RequestMethod.GET)
    @ApiOperation("获取医院列表")
    public ResultPageListModel<HospitalModel> doctor(
            @ApiParam(name = "provinceId", value = "省(国标编码 35000)", required = false) @RequestParam(value = "provinceId", required = false) String provinceId,
            @ApiParam(name = "cityId", value = "市(国标编码 350200)", required = false) @RequestParam(value = "provinceId", required = false) String cityId,
            @ApiParam(name = "townId", value = "区(国标编码 350206)", required = false) @RequestParam(value = "townId", required = false) String townId,
            @ApiParam(name = "hospitalId", value = "机构id", required = false) @RequestParam(value = "hospitalId", required = false) String hospitalId,
            @ApiParam(name = "hospitalName", value = "机构名称(支持模糊查询)", required = false) @RequestParam(value = "hospitalName", required = false) String hospitalName,
            @ApiParam(name = "page", value = "当前页(1开始)", required = false) @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页大小", required = false) @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize
    ) {
        List<Hospital> hospitals = hospitalService.getHospitals(null, provinceId, cityId, townId, hospitalName, hospitalId, page, pageSize);
        List<HospitalModel> hospitalModels = new ArrayList<>();
        for (Hospital hospital : hospitals) {
            HospitalModel hospitalModel = new HospitalModel();
            BeanUtils.copyProperties(hospital, hospitalModel);
            hospitalModels.add(hospitalModel);
        }
        return new ResultPageListModel(page, pageSize, hospitalModels);
    }
}

+ 105 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcMessageController.java

@ -0,0 +1,105 @@
package com.yihu.wlyy.web.gateway.controller;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.NetworkUtil;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.gateway.vo.PatientModel;
import com.yihu.wlyy.web.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultBatchModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
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 javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
@RestController
@RequestMapping("/wlyygc/message")
@Api(description = "消息相关服务,包括短信,微信模板")
public class GcMessageController {
    private Logger logger= LoggerFactory.getLogger(GcMessageController.class);
    @Autowired
    private WeiXinTempMsgSendUtils weiXinTempMsgSendUtils;
    @Autowired
    private PatientService patientService;
    @Autowired
    private SMSService smsService;
    @RequestMapping(value = "/sendWXTemplate", method = RequestMethod.POST)
    @ApiOperation("给患者发送微信模板消息")
    public ResultBatchModel sendWXTemplate(
            @ApiParam(name = "codes", value = "患者code(多个逗号分割)", required = true) @RequestParam(value = "codes", required = true) String codes,
            @ApiParam(name = "templateId", value = "微信模板Id", required = true) @RequestParam(value = "templateId", required = true) String templateId,
            @ApiParam(name = "teampolateJson", value = "微信模板内容json格式", required = true) @RequestParam(value = "teampolateJson", required = true) String teampolateJson,
            @ApiParam(name = "url", value = "模板跳转的url", required = true) @RequestParam(value = "url", required = true) String url
    ) {
        Integer success = 0;
        Integer error = 0;
        List<String> errorLiust = new ArrayList<>();
        String[] codeArr = codes.split(",");
        for (String code : codeArr) {
            try {
                Patient patient = patientService.findByCode(code);
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(teampolateJson));
                success++;
            } catch (Exception e) {
                logger.error("code "+code+"send Template error:"+e.getMessage());
                error++;
                errorLiust.add(code);
            }
        }
        return new ResultBatchModel(success, error, errorLiust);
    }
    @RequestMapping(value = "/sendMobileMessage", method = RequestMethod.POST)
    @ApiOperation("给手机号码发送短信消息")
    public ResultBatchModel sendMobileMessage(
            @ApiParam(name = "mobiles", value = "电话号码(批量逗号分割)", required = true) @RequestParam(value = "mobiles", required = true) String mobiles,
            @ApiParam(name = "content", value = "消息内容", required = true) @RequestParam(value = "content", required = true) String content,
            HttpServletRequest request
    ) {
        // 获取ip地址
        Integer success = 0;
        Integer error = 0;
        List<String> errorLiust = new ArrayList<>();
        try {
            String ip = NetworkUtil.getIpAddress(request);
            String[] mobileArr = mobiles.split(",");
            for (String mobile : mobileArr) {
                try {
                    smsService.sendWithContent(mobile, ip, 11, content);
                    success++;
                } catch (Exception e) {
                    logger.error("mobile "+mobile+"send message error:"+e.getMessage());
                    error++;
                    errorLiust.add(mobile);
                }
            }
            return new ResultBatchModel(success, error, errorLiust);
        } catch (Exception e) {
            return new ResultBatchModel(BaseResultModel.codeEm.error_no_ip.getCode(), "获取IP失败", success, error, errorLiust);
        }
    }
}

+ 177 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcTokenController.java

@ -0,0 +1,177 @@
package com.yihu.wlyy.web.gateway.controller;
import com.fasterxml.jackson.databind.deser.Deserializers;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.gateway.GcClientDetails;
import com.yihu.wlyy.entity.gateway.GcToken;
import com.yihu.wlyy.entity.login.LoginLog;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.service.common.login.LoginLogService;
import com.yihu.wlyy.service.gateway.GcClientDetailsService;
import com.yihu.wlyy.service.gateway.GcTokenService;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.NetworkUtil;
import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.web.gateway.vo.GcTokenModel;
import com.yihu.wlyy.web.gateway.vo.LoginModel;
import com.yihu.wlyy.web.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
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 javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/17.
 * 对外的网关
 */
@RestController
@RequestMapping("/gc")
@Api(description = "token相关服务")
public class GcTokenController {
    @Autowired
    private GcTokenService gcTokenService;
    @Autowired
    private GcClientDetailsService clientDetailsService;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private TokenService tokenService;
    @Autowired
    private LoginLogService loginLogService;
    @ApiOperation("获取accesstoken")
    @RequestMapping(value = "accesstoken", method = RequestMethod.GET)
    public ResultOneModel<GcTokenModel> getToken(
            @ApiParam(name = "appid", value = "appid", required = true) @RequestParam(required = true, value = "appid") String appid,
            @ApiParam(name = "appSecret", value = "appSecret", required = true) @RequestParam(required = true, value = "appSecret") String appSecret,
            HttpServletRequest request) {
        //得到用户
        GcClientDetails clientDetails = clientDetailsService.findByAppId(appid);
        if (clientDetails == null) {
            ResultOneModel resultOneModel = new ResultOneModel(null);
            resultOneModel.setCode(BaseResultModel.codeEm.error_Appid.getCode());
            resultOneModel.setMessage(BaseResultModel.codeEm.error_Appid.getMessage());
            return resultOneModel;
        }
        //判断appSecret
        if (appSecret.equals(clientDetails.getAppSecret())) {
            ResultOneModel resultOneModel = new ResultOneModel(null);
            resultOneModel.setCode(BaseResultModel.codeEm.error_AppSecret.getCode());
            resultOneModel.setMessage(BaseResultModel.codeEm.error_AppSecret.getMessage());
            return resultOneModel;
        }
        //生成token
        GcToken gcToken = null;
        try {
            gcToken = gcTokenService.createToken(appid, appSecret, NetworkUtil.getIpAddress(request));
        } catch (IOException e) {
            e.printStackTrace();
        }
        GcTokenModel gcTokenModel = new GcTokenModel();
        BeanUtils.copyProperties(gcToken, gcTokenModel);
        return new ResultOneModel(gcTokenModel);
    }
    /**
     * 医生端要传  userAgent:{"id":4816,"uid":"xh1D2017031503333","token":"5d68d84dbb79996efba31192856139a4","platform":4,"imei":"05948CE4F079E998306CFCCF86A5A77F"}
     * @param imei
     * @param account
     * @param platform
     * @param password
     * @return
     */
    @RequestMapping(value = "/doctor/login", method = RequestMethod.GET)
    @ApiOperation("医生端登陆")
    public ResultOneModel<LoginModel> doctorLogin(
            @ApiParam(required = false, name = "imei", value = "imei号") @RequestParam(required = true, value = "imei") String imei,
            @ApiParam(required = false, name = "account", value = "手机号/身份证") @RequestParam(required = false, value = "account") String account,
            @ApiParam(required = false, name = "platform", value = "医生端pc,取药系统 或者对外系统") @RequestParam(required = false, defaultValue = "4") Integer platform,
            @ApiParam(required = false, name = "password", value = "密码") @RequestParam(required = false) String password) {
        String errorMessage;
        LoginLog loginLog = new LoginLog();
        loginLog.setCreateTime(new Date());
        loginLog.setPhone(account);
        loginLog.setType("2");
        loginLog.setUserType("2");
        try {
            if (StringUtils.isEmpty(imei)) {
                errorMessage = "获取IMEI码失败!";
                loginLog.setErrorMessage(errorMessage);
                loginLogService.saveLog(loginLog);
                return new ResultOneModel<>(BaseResultModel.codeEm.login_IMEI_error.getCode(), BaseResultModel.codeEm.login_IMEI_error.getMessage());
            }
            if (platform == null) {
                platform = 2;//默认为医生app端
            }
            //身份证登录
            if (StringUtils.isNoneEmpty(account) && StringUtils.isNoneEmpty(password)) {
                password = RSAUtils.getInstance(doctorService).decryptString(password);
                password = StringUtils.reverse(password);
                //根据电话号码找
                Doctor doctor = doctorService.findDoctorByMobile(account);
                if (doctor == null) {
                    //如果电话号码找不到 根据身份证找
                    doctor = doctorService.findbyIdCard(account);
                }
                loginLog.setLoginType("2");
                if (doctor == null) {
                    errorMessage = "该号码未注册!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return new ResultOneModel<>(BaseResultModel.codeEm.login_account_error.getCode(), BaseResultModel.codeEm.login_account_error.getMessage());
                }
                loginLog.setUserCode(doctor.getCode());
                String loginPassword = MD5.GetMD5Code(password + doctor.getSalt());
                if (loginPassword.equals(doctor.getPassword())) {
                    Token token = tokenService.findDoctorToken(doctor.getCode());
                    if (token != null && platform == 4) {
                        //pc版本要做单点登陆 所以如果platform =4 并且 token存在直接返回之前的token
                    } else {
                        // 用户校验通过,生成token
                        token = tokenService.newToken(doctor.getCode(), imei, platform);
                    }
                    loginLog.setTokenId(token.getId());
                    loginLog.setType("1");
                    LoginModel loginModel = new LoginModel();
                    loginModel.setDoctorCode(doctor.getCode());
                    loginModel.setDoctorName(doctor.getName());
                    loginModel.setToken(token.getToken());
                    loginModel.setDoctorPhoto(doctor.getPhoto());
                    loginModel.setDoctorType(doctor.getLevel());
                    loginLogService.saveLog(loginLog);
                    return new ResultOneModel<>(loginModel);
                } else {
                    errorMessage = "密码错误,登录失败";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return new ResultOneModel<>(BaseResultModel.codeEm.login_password_error.getCode(), BaseResultModel.codeEm.login_password_error.getMessage());
                }
            }
            return new ResultOneModel<>(BaseResultModel.codeEm.error_params.getCode(), BaseResultModel.codeEm.error_params.getMessage());
        } catch (Exception e) {
            loginLog.setErrorMessage(e.getMessage());
            loginLogService.saveLog(loginLog);
            return new ResultOneModel<>(BaseResultModel.codeEm.login_system_error.getCode(), BaseResultModel.codeEm.login_system_error.getMessage());
        }
    }
}

+ 78 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcUserController.java

@ -0,0 +1,78 @@
package com.yihu.wlyy.web.gateway.controller;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.login.LoginLog;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.security.Token;
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.common.account.RoleService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.service.common.login.LoginLogService;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.web.common.account.LoginController;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.gateway.vo.LoginModel;
import com.yihu.wlyy.web.gateway.vo.PatientModel;
import com.yihu.wlyy.web.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
/**
 * Created by chenweida on 2017/8/17.
 */
@RestController
@RequestMapping("/wlyygc/user")
@Api(description = "用户相关服务")
public class GcUserController {
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private PatientService patientService;
    @Autowired
    private TokenService tokenService;
    @Autowired
    private LoginLogService loginLogService;
    @RequestMapping(value = "/doctor", method = RequestMethod.GET)
    @ApiOperation("根据医生code查询医生信息")
    public ResultOneModel<DoctorModel> doctor(
            @ApiParam(name = "code", value = "医生code", required = true) @RequestParam(value = "code", required = true) String code
    ) {
        Doctor doctor = doctorService.findDoctorByCode(code);
        DoctorModel doctorModel = new DoctorModel();
        BeanUtils.copyProperties(doctor, doctorModel);
        return new ResultOneModel(doctorModel);
    }
    @RequestMapping(value = "/patient", method = RequestMethod.GET)
    @ApiOperation("根据患者code查询患者信息")
    public ResultOneModel<DoctorModel> patient(
            @ApiParam(name = "code", value = "患者code", required = true) @RequestParam(value = "code", required = true) String code
    ) {
        Patient patient = patientService.findByCode(code);
        PatientModel patientModel = new PatientModel();
        BeanUtils.copyProperties(patient, patientModel);
        return new ResultOneModel(patientModel);
    }
}

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/DoctorLoginModel.java

@ -0,0 +1,21 @@
package com.yihu.wlyy.web.gateway.vo;
import io.swagger.annotations.ApiModel;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel(description = "医生登陆model")
public class DoctorLoginModel {
    private Long id;
    private String uid;
    private String token;
    private String name;
    private String hospital;
    private String photo;
    private String doctorType;
    private List<Map<String, String>> roleMap;
}

+ 317 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/DoctorModel.java

@ -0,0 +1,317 @@
package com.yihu.wlyy.web.gateway.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel(description ="医生实体")
public class DoctorModel {
    @ApiModelProperty(value = "主键", required = false, access = "response")
    private String code;        // 业务主键
    @ApiModelProperty(value = "姓名", required = false, access = "response")
    private String name;        //姓名
    @ApiModelProperty(value = "性别(1男,2女)", required = false, access = "response")
    private Integer sex;        // 性别(1男,2女)
    @ApiModelProperty(value = "生日", required = false, access = "response")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date birthday;      //生日
    @ApiModelProperty(value = "头像http地址", required = false, access = "response")
    private String photo;       //头像http地址
    @ApiModelProperty(value = "手机号", required = false, access = "response")
    private String mobile;      //手机号
    @ApiModelProperty(value = "省code", required = false, access = "response")
    private String province;    //省code
    @ApiModelProperty(value = "市code", required = false, access = "response")
    private String city;         //市code
    @ApiModelProperty(value = "区县code", required = false, access = "response")
    private String town;         //区县code
    @ApiModelProperty(value = "省名称", required = false, access = "response")
    private String provinceName;//省名称
    @ApiModelProperty(value = "市名称", required = false, access = "response")
    private String cityName;    //市名称
    @ApiModelProperty(value = "区县名称", required = false, access = "response")
    private String townName;    //区县名称
    @ApiModelProperty(value = "医院代码", required = false, access = "response")
    private String hospital;        // 医院代码
    @ApiModelProperty(value = "医院名称", required = false, access = "response")
    private String hospitalName;    //医院名称
    @ApiModelProperty(value = "科室代码", required = false, access = "response")
    private String dept;            // 科室代码
    @ApiModelProperty(value = "科室名称", required = false, access = "response")
    private String deptName;        //可是名称
    @ApiModelProperty(value = "职称代码", required = false, access = "response")
    private String job;             // 职称代码
    @ApiModelProperty(value = "职称名", required = false, access = "response")
    private String jobName;         // 职称名
    @ApiModelProperty(value = "医生专长", required = false, access = "response")
    private String expertise;       // 医生专长
    @ApiModelProperty(value = "医生介绍", required = false, access = "response")
    private String introduce;       // 医生介绍
    @ApiModelProperty(value = "1专科医生,2全科医生,3健康管理师", required = false, access = "response")
    private Integer level;          // 类型:1专科医生,2全科医生,3健康管理师
    @ApiModelProperty(value = "资格是否认证通过,1是,0否", required = false, access = "response")
    private Integer iscertified;   // 资格是否认证通过,1是,0否
    @ApiModelProperty(value = "二维码", required = false, access = "response")
    private String qrcode;          // 二维码
    @ApiModelProperty(value = "身份证号", required = false, access = "response")
    private String idcard;          //身份证号
    @ApiModelProperty(value = "是否是名医", required = false, access = "response")
    private Integer isFamous;       //是否是名医 1是  0或者空不是
    @ApiModelProperty(value = "评分", required = false, access = "response")
    private Double evaluateScore;//评分
    @ApiModelProperty(value = "审方密码", required = false, access = "response")
    private String checkPassword;   //审方密码
    @ApiModelProperty(value = "审方密码的盐", required = false, access = "response")
    private String checkSalt;       //审方密码的盐
    @ApiModelProperty(value = "CA证书过期时间", required = false, access = "response")
    private Date certifiedOvertime; //CA证书过期时间
    @ApiModelProperty(value = "CA证书编号", required = false, access = "response")
    private String certificateNum;     //CA证书编号
    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 Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public String getJobName() {
        return jobName;
    }
    public void setJobName(String jobName) {
        this.jobName = jobName;
    }
    public String getExpertise() {
        return expertise;
    }
    public void setExpertise(String expertise) {
        this.expertise = expertise;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
    public Integer getIscertified() {
        return iscertified;
    }
    public void setIscertified(Integer iscertified) {
        this.iscertified = iscertified;
    }
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public Integer getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(Integer isFamous) {
        this.isFamous = isFamous;
    }
    public Double getEvaluateScore() {
        return evaluateScore;
    }
    public void setEvaluateScore(Double evaluateScore) {
        this.evaluateScore = evaluateScore;
    }
    public String getCheckPassword() {
        return checkPassword;
    }
    public void setCheckPassword(String checkPassword) {
        this.checkPassword = checkPassword;
    }
    public String getCheckSalt() {
        return checkSalt;
    }
    public void setCheckSalt(String checkSalt) {
        this.checkSalt = checkSalt;
    }
    public Date getCertifiedOvertime() {
        return certifiedOvertime;
    }
    public void setCertifiedOvertime(Date certifiedOvertime) {
        this.certifiedOvertime = certifiedOvertime;
    }
    public String getCertificateNum() {
        return certificateNum;
    }
    public void setCertificateNum(String certificateNum) {
        this.certificateNum = certificateNum;
    }
}

+ 43 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/GcTokenModel.java

@ -0,0 +1,43 @@
package com.yihu.wlyy.web.gateway.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel(description = "")
public class GcTokenModel {
    @ApiModelProperty(value = "请求凭证", required = false, access = "response")
    private String accesstoken;
    @ApiModelProperty(value = "创建时间", required = false, access = "response")
    private Date createTime;
    @ApiModelProperty(value = "过期时间", required = false, access = "response")
    private Date outTime;
    public String getAccesstoken() {
        return accesstoken;
    }
    public void setAccesstoken(String accesstoken) {
        this.accesstoken = accesstoken;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getOutTime() {
        return outTime;
    }
    public void setOutTime(Date outTime) {
        this.outTime = outTime;
    }
}

+ 172 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/HospitalModel.java

@ -0,0 +1,172 @@
package com.yihu.wlyy.web.gateway.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel(description ="医生实体")
public class HospitalModel {
    @ApiModelProperty(value = "医院編碼", required = false, access = "response")
    private String code;            // 医院編碼
    @ApiModelProperty(value = "医院名稱", required = false, access = "response")
    private String name;            // 医院名稱
    @ApiModelProperty(value = "作废标志", required = false, access = "response")
    private String del;             // 作废标志
    @ApiModelProperty(value = "省份标志", required = false, access = "response")
    private String province;        //省份标志
    @ApiModelProperty(value = "省份名称", required = false, access = "response")
    private String provinceName;    //省份名称
    @ApiModelProperty(value = "城市标志", required = false, access = "response")
    private String city;            //城市标志
    @ApiModelProperty(value = "城市名称", required = false, access = "response")
    private String cityName;        //城市名称
    @ApiModelProperty(value = "区县标志", required = false, access = "response")
    private String town;            //区县标志
    @ApiModelProperty(value = "区县名称", required = false, access = "response")
    private String townName;        //区县名称
    @ApiModelProperty(value = "级别,1医院,2社区医院", required = false, access = "response")
    private Integer level;          //级别,1医院,2社区医院
    @ApiModelProperty(value = "医院详细地址", required = false, access = "response")
    private String address;         //医院详细地址
    @ApiModelProperty(value = "医院简介", required = false, access = "response")
    private String intro;           //医院简介
    @ApiModelProperty(value = "医院图片", required = false, access = "response")
    private String photo;           //医院图片
    @ApiModelProperty(value = "街道编码", required = false, access = "response")
    private String roadCode;        //街道编码
    @ApiModelProperty(value = "中心/站点", required = false, access = "response")
    private String centerSite;      //中心/站点
    @ApiModelProperty(value = "联系电话", required = false, access = "response")
    private String phone;            //联系电话
    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 getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getIntro() {
        return intro;
    }
    public void setIntro(String intro) {
        this.intro = intro;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getRoadCode() {
        return roadCode;
    }
    public void setRoadCode(String roadCode) {
        this.roadCode = roadCode;
    }
    public String getCenterSite() {
        return centerSite;
    }
    public void setCenterSite(String centerSite) {
        this.centerSite = centerSite;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
}

+ 73 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/LoginModel.java

@ -0,0 +1,73 @@
package com.yihu.wlyy.web.gateway.vo;
import com.yihu.wlyy.web.gateway.vo.base.BaseResultModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel(description = "登陆实体类")
public class LoginModel extends BaseResultModel {
    @ApiModelProperty(value = "医生code", required = false, access = "response")
    private String doctorCode;
    @ApiModelProperty(value = "登陆凭证", required = false, access = "response")
    private String token;
    @ApiModelProperty(value = "医生名称", required = false, access = "response")
    private String doctorName;
    @ApiModelProperty(value = "医院編碼", required = false, access = "response")
    private String hospital;
    @ApiModelProperty(value = "医生头像", required = false, access = "response")
    private String doctorPhoto;
    @ApiModelProperty(value = "医生类型:1专科医生,2全科医生,3健康管理师", required = false, access = "response")
    private Integer doctorType;
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getToken() {
        return token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getDoctorPhoto() {
        return doctorPhoto;
    }
    public void setDoctorPhoto(String doctorPhoto) {
        this.doctorPhoto = doctorPhoto;
    }
    public Integer getDoctorType() {
        return doctorType;
    }
    public void setDoctorType(Integer doctorType) {
        this.doctorType = doctorType;
    }
}

+ 82 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/PatientModel.java

@ -0,0 +1,82 @@
package com.yihu.wlyy.web.gateway.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel(description ="患者实体")
public class PatientModel {
    // 业务主键
    @ApiModelProperty(value = "业务主键", required = false, access = "response")
    private String code;
    // 身份证号
    @ApiModelProperty(value = "身份证号", required = false, access = "response")
    private String idcard;
    // 姓名
    @ApiModelProperty(value = "姓名", required = false, access = "response")
    private String name;
    // 生日
    @ApiModelProperty(value = "生日", required = false, access = "response")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date birthday;
    // 性別,1男,2女
    @ApiModelProperty(value = "性別,1男,2女", required = false, access = "response")
    private Integer sex;
    // 手機號
    @ApiModelProperty(value = "手機號", required = false, access = "response")
    private String mobile;
    // 聯繫電話
    @ApiModelProperty(value = "聯繫電話", required = false, access = "response")
    private String phone;
    // 社保卡號
    @ApiModelProperty(value = "社保卡號", required = false, access = "response")
    private String ssc;
    // 頭像HTTP地址
    @ApiModelProperty(value = "頭像HTTP地址", required = false, access = "response")
    private String photo;
    // 省代碼
    @ApiModelProperty(value = "省代碼", required = false, access = "response")
    private String province;
    // 城市代碼
    @ApiModelProperty(value = "城市代碼", required = false, access = "response")
    private String city;
    // 區縣代碼
    @ApiModelProperty(value = "區縣代碼", required = false, access = "response")
    private String town;
    // 街道代码
    @ApiModelProperty(value = "街道代码", required = false, access = "response")
    private String street;
    // 省名
    @ApiModelProperty(value = "省名", required = false, access = "response")
    private String provinceName;
    // 市名
    @ApiModelProperty(value = "市名", required = false, access = "response")
    private String cityName;
    // 區縣名
    @ApiModelProperty(value = "區縣名", required = false, access = "response")
    private String townName;
    // 街道名称
    @ApiModelProperty(value = "街道名称", required = false, access = "response")
    private String streetName;
    // 地址
    @ApiModelProperty(value = "地址", required = false, access = "response")
    private String address;
    // 居委会字段id
    @ApiModelProperty(value = "居委会字段id", required = false, access = "response")
    private String sickVillage;
    // 居委会字段名称
    @ApiModelProperty(value = "居委会字段名称", required = false, access = "response")
    private String sickVillageName;
    //	是否绑定电子社保卡
    @ApiModelProperty(value = "是否绑定电子社保卡", required = false, access = "response")
    private Integer sicardStatus;
    //	绑定电子社保卡时间
    @ApiModelProperty(value = "绑定电子社保卡时间", required = false, access = "response")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date sicardTime;
}

+ 91 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/BaseResultModel.java

@ -0,0 +1,91 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel("返回实体")
public class BaseResultModel {
    @ApiModelProperty(value = "状态", required = false, access = "response")
    protected Integer code = codeEm.success.getCode();
    @ApiModelProperty(value = "信息", required = false, access = "response")
    protected String message = "成功";
    public Integer getCode() {
        return code;
    }
    public void setCode(Integer code) {
        this.code = code;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public enum codeEm {
        success(10000, "请求成功"),//请求成功
        error_Appid(-9000, "appid不存在"),//appid不存在
        error_AppSecret(-9001, "AppSecret不存在"),//AppSecret不存在
        token_out_effect(-9002, "无效的token"),//token无效
        token_no_power(-9003, "用户没权限"),// 没权限 包括未授权 或者uri错误
        token_out_time(-9004, "oken已过期"),//token无效
        error_params(-10000, "请求失败 参数错误"),//请求失败 参数错误
        error_no_ip(-10010, "请求失败,获取IP失败"),//请求失败,获取IP失败
        login_system_error(-10020, "系统异常"),
        login_account_error(-20010, "账号不存在"),
        login_password_error(-20020, "密码错误"),
        login_IMEI_error(-20030, "获取imei失败");
        ;
        codeEm(Integer code, String message) {
            this.code = code;
            this.message = message;
        }
        private Integer code;
        private String message;
        public Integer getCode() {
            return code;
        }
        public void setCode(Integer code) {
            this.code = code;
        }
        public String getMessage() {
            return message;
        }
        public void setMessage(String message) {
            this.message = message;
        }
    }
    public BaseResultModel() {
    }
    public BaseResultModel(String message) {
        this.message = message;
    }
    public BaseResultModel(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}

+ 65 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultBatchModel.java

@ -0,0 +1,65 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel("返回实体")
public class ResultBatchModel extends BaseResultModel {
    @ApiModelProperty(value = "成功数目", required = false, access = "response")
    private Integer successNum = 0;
    @ApiModelProperty(value = "失败数目", required = false, access = "response")
    private Integer errorNum = 0;
    @ApiModelProperty(value = "失败List", required = false, access = "response")
    private List<String> errorList = new ArrayList<>();
    public ResultBatchModel(Integer success, Integer error, List<String> errorList) {
        this.successNum = success;
        this.errorNum = error;
        this.errorList = errorList;
    }
    public ResultBatchModel(Integer code, String message, Integer success, Integer error, List<String> errorList) {
        super(code, message);
        this.successNum = success;
        this.errorNum = error;
        this.errorList = errorList;
    }
    public ResultBatchModel() {
    }
    public Integer getSuccessNum() {
        return successNum;
    }
    public void setSuccessNum(Integer successNum) {
        this.successNum = successNum;
    }
    public Integer getErrorNum() {
        return errorNum;
    }
    public void setErrorNum(Integer errorNum) {
        this.errorNum = errorNum;
    }
    public List<String> getErrorList() {
        return errorList;
    }
    public void setErrorList(List<String> errorList) {
        this.errorList = errorList;
    }
}

+ 23 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultListModel.java

@ -0,0 +1,23 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
public class ResultListModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private List<T> result;
    public List<T> getResult() {
        return result;
    }
    public void setResult(List<T> result) {
        this.result = result;
    }
}

+ 31 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultOneModel.java

@ -0,0 +1,31 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 * 对外放回的实体
 */
@ApiModel("返回的实体类")
public class ResultOneModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private T result;
    public T getResult() {
        return result;
    }
    public void setResult(T result) {
        this.result = result;
    }
    public ResultOneModel(T result) {
        this.result = result;
    }
    public ResultOneModel(Integer code, String message) {
        super(code, message);
    }
}

+ 52 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultPageListModel.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.web.gateway.vo.base;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
public class ResultPageListModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "当前页", required = false, access = "response")
    private Integer page;
    @ApiModelProperty(value = "每页大小", required = false, access = "response")
    private Integer pageSize;
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private List<T> result;
    public List<T> getResult() {
        return result;
    }
    public void setResult(List<T> result) {
        this.result = result;
    }
    public Integer getPage() {
        return page;
    }
    public void setPage(Integer page) {
        this.page = page;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
    public ResultPageListModel(Integer page, Integer pageSize, List<T> result) {
        this.page = page;
        this.pageSize = pageSize;
        this.result = result;
    }
    public ResultPageListModel() {
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionInfoController.java

@ -130,7 +130,7 @@ public class PatientPrescriptionInfoController extends BaseController {
    public String isAuthentication(@RequestParam(required = true,value="doctorCode")@ApiParam(required = true,name="doctorCode",value="医生的code")String doctorCode){
        try {
            //0de6a26a62dd11e69faffa163e8aee56
            JSONObject data = doctorInfoService.isAuthentication(getRepUID());
            JSONObject data = doctorInfoService.isAuthentication(doctorCode);
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
            error(e);

+ 7 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionLogController.java

@ -61,15 +61,17 @@ public class PatientPrescriptionLogController extends BaseController {
            for (int i = 0; i < expressageLogs.size(); i++) {
                PrescriptionExpressageLog prescriptionExpressageLog = expressageLogs.get(i);
                PrescriptionLog prescriptionLog = new PrescriptionLog();
                prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressage2hospital.getValue());
                prescriptionLog.setCreateTime(prescriptionExpressageLog.getCreateTime());
                prescriptionLog.setHospital(prescriptionExpressageLog.getAcceptHospital());
                prescriptionLog.setHospitalName(prescriptionExpressageLog.getAcceptHospitalName());
                prescriptionLog.setUserCode(prescriptionExpressageLog.getAcceptUser());
                prescriptionLog.setUserName(prescriptionExpressageLog.getAcceptUserName());
                prescriptionLogs.add(prescriptionLog);
            }
            //排序
            expressageLogs.sort((o1, o2) -> {
            prescriptionLogs.sort((o1, o2) -> {
                long map1value = o1.getCreateTime().getTime();
                long map2value = o2.getCreateTime().getTime();
@ -81,15 +83,15 @@ public class PatientPrescriptionLogController extends BaseController {
                    return 0;
                }
            });
            if (prescriptionLogs != null) {
            if (prescriptionLogs != null && prescriptionLogs.size() > 0) {
                JSONArray ja = new JSONArray();
                prescriptionLogs.stream().forEach(one -> {
                for (int i = 0; i < prescriptionLogs.size(); i++) {
                    PrescriptionLog one = prescriptionLogs.get(i);
                    JSONObject jo = new JSONObject();
                    jo.put("createTime", DateUtil.dateToStrLong(one.getCreateTime()));
                    jo.put("statusName", one.getStatusName());
                    ja.put(jo);
                });
                }
                return write(200, "获取处方流程成功", "data", ja);
            } else {
                return error(-1, "获取失败");

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/application.yml

@ -456,7 +456,7 @@ images:
sign:
  check_upload: http://172.19.103.87:8011/wlyy_service
  check_upload: http://172.19.103.88:8011/wlyy_service
quartz:

BIN
patient-co/patient-co-wlyy/src/main/webapp/images/fuwuxiangqing_banner.png


BIN
patient-co/patient-co-wlyy/src/main/webapp/images/zhongyitijian_banner.png