فهرست منبع

增加saasId,以及医院,医生实体类等

chenyongxing 8 سال پیش
والد
کامیت
adc254f7e3
22فایلهای تغییر یافته به همراه576 افزوده شده و 45 حذف شده
  1. 7 7
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wlyy/agreement/WlyyAgreementContants.java
  2. 3 3
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/MWxWechat.java
  3. 5 4
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/WxContants.java
  4. 5 3
      common/common-swagger/src/main/java/com/yihu/jw/config/SwaggerConfig.java
  5. 6 0
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WechatService.java
  6. 1 1
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyySignFamilyDao.java
  7. 15 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/DoctorDao.java
  8. 15 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/HospitalDao.java
  9. 6 1
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/patient/AdvertisementDao.java
  10. 11 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/agreement/WlyyAgreementKpi.java
  11. 10 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/agreement/WlyyAgreementKpiLog.java
  12. 10 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/agreement/WlyySignFamily.java
  13. 95 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/doctor/BaseOrgHospital.java
  14. 247 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/doctor/Doctors.java
  15. 1 1
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/patient/WlyyAdvertisement.java
  16. 14 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiLogService.java
  17. 22 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiService.java
  18. 22 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementService.java
  19. 14 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyySignFamilyService.java
  20. 21 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/DoctorService.java
  21. 20 0
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/HospitalService.java
  22. 26 25
      svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/patient/AdvertisementService.java

+ 7 - 7
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wlyy/agreement/WlyyAgreementContants.java

@ -14,6 +14,12 @@ public class WlyyAgreementContants {
        public static final String api_queryPage="queryPage";
        public static final String api_getList="getList";
        public static final String message_success_update="agreement update success";
        public static final String message_success_delete="agreement delete success";
        public static final String message_success_find="agreement find success";
        public static final String message_success_create="agreement create success";
        public static final String message_success_find_functions="agreement find success";
        public static final String message_fail_code_is_null="code is null";
        public static final String message_fail_name_is_null="name is null";
        public static final String message_fail_price_is_null="price is null";
@ -22,13 +28,7 @@ public class WlyyAgreementContants {
        public static final String message_fail_status_is_null="status is null";
        public static final String message_fail_id_is_null="id is null";
        public static final String message_fail_code_exist="code exist";
        public static final String message_success_update="agreement update success";
        public static final String message_success_delete="agreement delete success";
        public static final String message_success_find="agreement find success";
        public static final String message_success_create="agreement create success";
        public static final String message_success_find_functions="agreement find success";
        public static final String message_fail_saasId_is_null="saasId is null";
    }
    //协议模块常量

+ 3 - 3
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/MWxWechat.java

@ -14,7 +14,7 @@ public class MWxWechat {
    private String token;//token
    private String encodingAesKey;//加密密钥
    private Integer encType;//加密方式  0:明文模式   1:兼容模式   2:安全模式
    private String status;//'类型 -1 已删除 0待审核 1审核通过 2 审核不通过'
    private Integer status;//'类型 -1 已删除 0待审核 1审核通过 2 审核不通过'
    private String type;//'1:服务号 2 订阅号
    private String appId;//'微信app_id'
    private String appSecret;//'微信app_secret'
@ -83,11 +83,11 @@ public class MWxWechat {
        this.encType = encType;
    }
    public String getStatus() {
    public Integer getStatus() {
        return status;
    }
    public void setStatus(String status) {
    public void setStatus(Integer status) {
        this.status = status;
    }

+ 5 - 4
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/WxContants.java

@ -94,15 +94,16 @@ public class WxContants {
        public static final String message_success_delete="wechat delete success";
        public static final String message_fail_code_is_null="code is null";
        public static final String message_fail_code_no_exist="code no exist";
        public static final String message_fail_code_no_exist="code not exist";
        public static final String message_fail_appSecret_is_null="appSecret is null";
        public static final String message_fail_appId_exist="wechat appId exist";
        public static final String message_fail_status_is_null="status is null";
        public static final String message_fail_type_is_null="type is null";
        public static final String message_fail_appId_is_null="appId is null";
        public static final String message_fail_name_is_null="name is null";
        public static final String message_fail_wxWechat_is_no_exist="wxWechat is no exist";//微信配置不存在
        public static final String message_fail_wxWechat_is_no_exist="wxWechat is not exist";//微信配置不存在
        public static final String message_fail_id_is_null="id is null";
        public static final String message_fail_saasId_is_null="saasId is null";
    }
    //微信图文消息
    public static class WxGraphicMessage {
@ -122,10 +123,10 @@ public class WxContants {
        public static final String message_success_find_functions="wxGraphicMessage find success";
        public static final String message_success_delete="wxGraphicMessage delete success";
        public static final String message_fail_code_is_null="code is null";
        public static final String message_fail_code_no_exist="code no exist";
        public static final String message_fail_code_no_exist="code not exist";
        public static final String message_fail_code_exist="code exist";
        public static final String message_fail_status_is_null="status is null";
        public static final String message_fail_title_is_null="title is null";
        public static final String message_fail_wxGraphicMessage_is_no_exist="wxGraphicMessage is no exist";
        public static final String message_fail_wxGraphicMessage_is_no_exist="wxGraphicMessage is not exist";
    }
}

+ 5 - 3
common/common-swagger/src/main/java/com/yihu/jw/config/SwaggerConfig.java

@ -2,6 +2,7 @@ package com.yihu.jw.config;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.restmodel.wlyy.patient.WlyyPatientContants;
import com.yihu.jw.restmodel.wx.WxContants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -67,9 +68,10 @@ public class SwaggerConfig {
                .select()
                .paths(or(
                        regex("/" + WlyyAgreementContants.Agreement.api_common + "/.*")
                        ,regex("/"+ WlyyAgreementContants.AgreementKpi.api_common+"/.*")
                        ,regex("/"+ WlyyAgreementContants.AgreementKpiLog.api_common+"/.*")
                        ,regex("/"+ WlyyAgreementContants.SignFamily.api_common+"/.*")
                        , regex("/" + WlyyAgreementContants.AgreementKpi.api_common + "/.*")
                        , regex("/" + WlyyAgreementContants.AgreementKpiLog.api_common + "/.*")
                        , regex("/" + WlyyAgreementContants.SignFamily.api_common + "/.*")
                        , regex("/" + WlyyPatientContants.Advertisement.api_common + "/.*")
                ))
                .build()
                .apiInfo(wlyyApiInfo());

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/wx/service/WechatService.java

@ -27,6 +27,9 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        if (StringUtils.isEmpty(wechat.getCode())) {
            throw new ApiException(WxContants.Wechat.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getSaasId())) {
            throw new ApiException(WxContants.Wechat.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getStatus())) {
            throw new ApiException(WxContants.Wechat.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
@ -59,6 +62,9 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        if (StringUtils.isEmpty(wechat.getCode())) {
            throw new ApiException(WxContants.Wechat.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getSaasId())) {
            throw new ApiException(WxContants.Wechat.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getStatus())) {
            throw new ApiException(WxContants.Wechat.message_fail_status_is_null, CommonContants.common_error_params_code);
        }

+ 1 - 1
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/agreement/WlyySignFamilyDao.java

@ -15,6 +15,6 @@ public interface WlyySignFamilyDao  extends PagingAndSortingRepository<WlyySignF
    @Query("from WlyySignFamily w where w.code = ?1")
    WlyySignFamily findByCode(String code);
    @Query("from WlyySignFamily w where w.patientCode = ?1 and w.status = ?2")
    @Query("from WlyySignFamily w where w.patient = ?1 and w.status = ?2")
    List<WlyySignFamily> findByPatientCode(String patientCode, Integer status);
}

+ 15 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/DoctorDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.wlyy.dao.doctor;
import com.yihu.jw.wlyy.entity.doctor.Doctors;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
public interface DoctorDao extends PagingAndSortingRepository<Doctors, Long>, JpaSpecificationExecutor<Doctors> {
    @Query("from Doctors d where d.code = ?1 and d.status !=-1")
    Doctors findByCode(String code);
}

+ 15 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/doctor/HospitalDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.wlyy.dao.doctor;
import com.yihu.jw.wlyy.entity.doctor.BaseOrgHospital;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
public interface HospitalDao extends PagingAndSortingRepository<BaseOrgHospital, Long>, JpaSpecificationExecutor<BaseOrgHospital> {
    @Query("from BaseOrgHospital w where w.code = ?1")
    BaseOrgHospital findByCode(String code);
}

+ 6 - 1
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/dao/patient/AdvertisementDao.java

@ -18,6 +18,11 @@ public interface AdvertisementDao extends PagingAndSortingRepository<WlyyAdverti
    @Query("from WlyyAdvertisement w where w.id=?1 and w.status !=-1")
    WlyyAdvertisement findById(Long id);
    @Query("from WlyyAdvertisement w where w.code=?1 and w.status !=-1")
    //根据saasCode查询广告
    @Query("from WlyyAdvertisement w where w.saasId=?1 and w.status !=-1 order by w.sort")
    List<WlyyAdvertisement> getListBySaasCode(String saasCode);
    //查询默认广告
    @Query("from WlyyAdvertisement w where w.saasId is null and w.status !=-1 order by w.sort")
    List<WlyyAdvertisement> getDefaultList();
}

+ 11 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/agreement/WlyyAgreementKpi.java

@ -16,6 +16,7 @@ import java.util.Date;
@Table(name = "wlyy_agreement_kpi")
public class WlyyAgreementKpi extends IdEntity {
    private String code;//业务code
    private String saasId;//saasId
    private String agreementCode;//套餐代码
    private String kpiName;//服务项名称
    private String type;//服务项类型
@ -27,6 +28,16 @@ public class WlyyAgreementKpi extends IdEntity {
    private String createUser;
    private Date updaateTime;
    @Column(name="saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name="agreement_code")
    public String getAgreementCode() {
        return agreementCode;
    }

+ 10 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/agreement/WlyyAgreementKpiLog.java

@ -18,6 +18,7 @@ public class WlyyAgreementKpiLog extends IdEntity {
    private static final long serialVersionUID = -3196907595969778396L;
    private String code;//业务code
    private String saasId;
    private String patientCode;//患者code
    private String signCode;
    private String kpiCode;
@ -36,6 +37,15 @@ public class WlyyAgreementKpiLog extends IdEntity {
        this.code = code;
    }
    @Column(name="saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "patient_code")
    public String getPatientCode() {
        return patientCode;

+ 10 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/agreement/WlyySignFamily.java

@ -17,6 +17,7 @@ public class WlyySignFamily extends IdEntity{
    private static final long serialVersionUID = -6759565631854462880L;
    private String code;//业务code
    private String saasId;
    private int type;//签约类型:1三师签约,2家庭签约
    private String patient;//患者标识
    private String openid;//患者微信公众号openid
@ -73,6 +74,15 @@ public class WlyySignFamily extends IdEntity{
        this.code = code;
    }
    @Column(name="saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "type")
    public int getType() {
        return type;

+ 95 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/doctor/BaseOrgHospital.java

@ -0,0 +1,95 @@
package com.yihu.jw.wlyy.entity.doctor;
import com.yihu.jw.base.model.base.IdEntity;
import javax.persistence.*;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
@Entity
@Table(name = "base_org_hospital")
public class BaseOrgHospital extends IdEntity{
    private static final long serialVersionUID = 5463913446686402252L;
    private String code;//业务code
    private String orgCode;//
    private String roadCode;
    private String centerSite;
    private String ascriptionType;
    private String levelId;
    private String levelName;
    
    
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    
    @Column(name = "org_code")
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    
    @Column(name = "road_code")
    public String getRoadCode() {
        return roadCode;
    }
    public void setRoadCode(String roadCode) {
        this.roadCode = roadCode;
    }
    
    @Column(name = "center_site")
    public String getCenterSite() {
        return centerSite;
    }
    public void setCenterSite(String centerSite) {
        this.centerSite = centerSite;
    }
    
    @Column(name = "ascription_type")
    public String getAscriptionType() {
        return ascriptionType;
    }
    public void setAscriptionType(String ascriptionType) {
        this.ascriptionType = ascriptionType;
    }
    
    @Column(name = "level_id")
    public String getLevelId() {
        return levelId;
    }
    public void setLevelId(String levelId) {
        this.levelId = levelId;
    }
    
    @Column(name = "level_name")
    public String getLevelName() {
        return levelName;
    }
    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }
}

+ 247 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/doctor/Doctors.java

@ -0,0 +1,247 @@
package com.yihu.jw.wlyy.entity.doctor;
import com.yihu.jw.base.model.base.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import java.util.Date;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
@Entity
public class Doctors extends IdEntity{
    private static final long serialVersionUID = 3138130150854187709L;
    private String userId;//云平台用户ID
    private String code;//业务code
    private String name;//姓名
    private String pyCode;//姓名首字母
    private String sex;//性别(1男,2女)
    private String photo;//医生头像
    private String skill;//医生专长
    private String workPortal;//医生门户首页
    private String email;//邮箱
    private String phone;//联系电话
    private String secondPhone;//备用电话
    private String familyTel;//家庭电话(固)
    private String officeTel;//办公电话(固)
    private String introduction;//简介
    private String jxzc;//教学职称
    private String lczc;//临床职称
    private String xlzc;//学历职称
    private String xzzc;//行政职称
    private Integer status;//状态:-1 删除 0 禁用 1可用
    private Date createTime;//
    private Date updateTime;
    @Column(name = "user_id")
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    @Column(name = "code")
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name = "py_code")
    public String getPyCode() {
        return pyCode;
    }
    public void setPyCode(String pyCode) {
        this.pyCode = pyCode;
    }
    
    @Column(name = "sex")
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    
    @Column(name = "photo")
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    
    @Column(name = "skill")
    public String getSkill() {
        return skill;
    }
    public void setSkill(String skill) {
        this.skill = skill;
    }
    
    @Column(name = "work_portal")
    public String getWorkPortal() {
        return workPortal;
    }
    public void setWorkPortal(String workPortal) {
        this.workPortal = workPortal;
    }
    
    @Column(name = "email")
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    
    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
    @Column(name = "second_phone")
    public String getSecondPhone() {
        return secondPhone;
    }
    public void setSecondPhone(String secondPhone) {
        this.secondPhone = secondPhone;
    }
    
    @Column(name = "family_tel")
    public String getFamilyTel() {
        return familyTel;
    }
    public void setFamilyTel(String familyTel) {
        this.familyTel = familyTel;
    }
    
    @Column(name = "office_tel")
    public String getOfficeTel() {
        return officeTel;
    }
    public void setOfficeTel(String officeTel) {
        this.officeTel = officeTel;
    }
    
    @Column(name = "introduction")
    public String getIntroduction() {
        return introduction;
    }
    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }
    
    @Column(name = "jxzc")
    public String getJxzc() {
        return jxzc;
    }
    public void setJxzc(String jxzc) {
        this.jxzc = jxzc;
    }
    
    @Column(name = "lczc")
    public String getLczc() {
        return lczc;
    }
    public void setLczc(String lczc) {
        this.lczc = lczc;
    }
    
    @Column(name = "xlzc")
    public String getXlzc() {
        return xlzc;
    }
    public void setXlzc(String xlzc) {
        this.xlzc = xlzc;
    }
    
    @Column(name = "xzzc")
    public String getXzzc() {
        return xzzc;
    }
    public void setXzzc(String xzzc) {
        this.xzzc = xzzc;
    }
    
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
    @Column(name = "update_time")
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 1 - 1
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/entity/patient/WlyyAdvertisement.java

@ -17,7 +17,7 @@ public class WlyyAdvertisement extends IdEntity implements Serializable {
    private static final long serialVersionUID = 1497635003375865515L;
    private String code;//业务code
    private String saasId;
    private String saasId;//0,为默认广告
    private String name;//名称
    private String picture;//展示的图片
    private String url;//链接

+ 14 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiLogService.java

@ -1,6 +1,9 @@
package com.yihu.jw.wlyy.service.agreement;
import com.yihu.jw.base.model.Saas;
import com.yihu.jw.base.service.SaasService;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
@ -22,8 +25,19 @@ public class WlyyAgreementKpiLogService extends BaseJpaService<WlyyAgreementKpiL
    @Autowired
    private WlyyAgreementKpiLogDao wlyyAgreementKpiLogDao;
    @Autowired
    private SaasService saasService;
    @Transient
    public WlyyAgreementKpiLog create(WlyyAgreementKpiLog wlyyAgreementKpiLog) {
        String saasId = wlyyAgreementKpiLog.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        Saas saas = saasService.findByCode(saasId);
        if(saas==null){
            throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreementKpiLog.getPatientCode())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_patientCode_is_null, CommonContants.common_error_params_code);
        }

+ 22 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementKpiService.java

@ -1,6 +1,9 @@
package com.yihu.jw.wlyy.service.agreement;
import com.yihu.jw.base.model.Saas;
import com.yihu.jw.base.service.SaasService;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
@ -26,11 +29,22 @@ public class WlyyAgreementKpiService extends BaseJpaService<WlyyAgreementKpi, Wl
    @Autowired
    private WlyyAgreementService wlyyAgreementService;
    @Autowired
    private SaasService saasService;
    @Transient
    public WlyyAgreementKpi create(WlyyAgreementKpi wlyyAgreementKpi) {
        if (StringUtils.isEmpty(wlyyAgreementKpi.getCode())) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyyAgreementKpi.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        Saas saas = saasService.findByCode(saasId);
        if(saas==null){
            throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        }
        //判断agreement是否存在
        String agreementCode = wlyyAgreementKpi.getAgreementCode();
        if (StringUtils.isEmpty(agreementCode)) {
@ -62,6 +76,14 @@ public class WlyyAgreementKpiService extends BaseJpaService<WlyyAgreementKpi, Wl
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyAgreementContants.AgreementKpi.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyyAgreementKpi.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        Saas saas = saasService.findByCode(saasId);
        if(saas==null){
            throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        }
        //判断agreement是否存在
        String agreementCode = wlyyAgreementKpi.getAgreementCode();
        if (StringUtils.isEmpty(agreementCode)) {

+ 22 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyyAgreementService.java

@ -1,6 +1,9 @@
package com.yihu.jw.wlyy.service.agreement;
import com.yihu.jw.base.model.Saas;
import com.yihu.jw.base.service.SaasService;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
@ -22,11 +25,22 @@ public class WlyyAgreementService extends BaseJpaService<WlyyAgreement, WlyyAgre
    @Autowired
    private WlyyAgreementDao wlyyAgreementDao;
    @Autowired
    private SaasService saasService;
    @Transient
    public WlyyAgreement create(WlyyAgreement wlyyAgreement) {
        if (StringUtils.isEmpty(wlyyAgreement.getCode())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyyAgreement.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        Saas saas = saasService.findByCode(saasId);
        if(saas==null){
            throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getName())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
@ -49,6 +63,14 @@ public class WlyyAgreementService extends BaseJpaService<WlyyAgreement, WlyyAgre
        if (StringUtils.isEmpty(code)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyyAgreement.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        Saas saas = saasService.findByCode(saasId);
        if(saas==null){
            throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyyAgreement.getName())) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_name_is_null, CommonContants.common_error_params_code);
        }

+ 14 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/agreement/WlyySignFamilyService.java

@ -1,6 +1,9 @@
package com.yihu.jw.wlyy.service.agreement;
import com.yihu.jw.base.model.Saas;
import com.yihu.jw.base.service.SaasService;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
@ -28,6 +31,9 @@ public class WlyySignFamilyService extends BaseJpaService<WlyySignFamily, WlyySi
    @Autowired
    private WlyyAgreementService wlyyAgreementService;
    @Autowired
    private SaasService saasService;
    @Transient
    public WlyySignFamily create(WlyySignFamily wlyySignFamily) throws ParseException {
        boolean b = canSaveOrUpdate(wlyySignFamily);
@ -54,6 +60,14 @@ public class WlyySignFamilyService extends BaseJpaService<WlyySignFamily, WlyySi
        if (StringUtils.isEmpty(wlyySignFamily.getCode())) {
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String saasId = wlyySignFamily.getSaasId();
        if (StringUtils.isEmpty(saasId)) {
            throw new ApiException(WlyyAgreementContants.Agreement.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        Saas saas = saasService.findByCode(saasId);
        if(saas==null){
            throw new ApiException(BaseContants.Saas.message_fail_code_no_exist, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wlyySignFamily.getType())) {
            throw new ApiException(WlyyAgreementContants.SignFamily.message_fail_type_is_null, CommonContants.common_error_params_code);
        }

+ 21 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/DoctorService.java

@ -0,0 +1,21 @@
package com.yihu.jw.wlyy.service.doctor;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.wlyy.dao.doctor.DoctorDao;
import com.yihu.jw.wlyy.entity.doctor.Doctors;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
public class DoctorService extends BaseJpaService<Doctors, DoctorDao> {
    @Autowired
    private DoctorDao doctorDao;
    public Doctors findByCode(String code){
        return doctorDao.findByCode(code);
    }
}

+ 20 - 0
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/doctor/HospitalService.java

@ -0,0 +1,20 @@
package com.yihu.jw.wlyy.service.doctor;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.wlyy.dao.doctor.HospitalDao;
import com.yihu.jw.wlyy.entity.doctor.BaseOrgHospital;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * Created by Administrator on 2017/6/7 0007.
 */
public class HospitalService extends BaseJpaService<BaseOrgHospital, HospitalDao> {
    @Autowired
    private HospitalDao hospitalDao;
    public BaseOrgHospital findByCode(String code){
        return hospitalDao.findByCode(code);
    }
}

+ 26 - 25
svr/svr-wlyy/src/main/java/com/yihu/jw/wlyy/service/patient/AdvertisementService.java

@ -7,7 +7,6 @@ import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wlyy.patient.WlyyPatientContants;
import com.yihu.jw.wlyy.dao.patient.AdvertisementDao;
import com.yihu.jw.wlyy.entity.agreement.WlyySignFamily;
import com.yihu.jw.wlyy.entity.patient.BasePatient;
import com.yihu.jw.wlyy.entity.patient.WlyyAdvertisement;
import com.yihu.jw.wlyy.service.agreement.WlyySignFamilyService;
@ -113,38 +112,40 @@ public class AdvertisementService extends BaseJpaService<WlyyAdvertisement, Adve
    public List<WlyyAdvertisement> getListByPatientCode(String patientCode) {
        List<WlyyAdvertisement> advertisements = null;
        //查找已签约的
        List<WlyySignFamily> signs =  signFamilyService.findByPatientCode(patientCode,1);
        if(signs!=null){
            for(WlyySignFamily sign:signs){
                String hospital = sign.getHospital();
                //通过hospital查找市区
            }
        }
        //如果还是空的,则查询患者的地址,根据患者的地址显示广告
        if(advertisements==null){
            BasePatient patient = patientService.findByCode(patientCode);
            if(patient==null){
                return null;
            }else{
                String cityName = patient.getCityName();
                //根据cityName查找saas
        //查询患者的地址,根据患者的地址显示广告
        BasePatient patient = patientService.findByCode(patientCode);
        if(patient!=null){//patient为空时,查找默认广告
            String cityName = patient.getCityName();
            //根据cityName查找saas
            if(!StringUtils.isEmpty(cityName)){
                Saas saas = saasService.findByName(cityName);
                if(saas==null){
                    return null;
                }else{
                if(saas!=null){
                    String saasCode = saas.getCode();
                    //通过saasCode查找广告
                    return getListBySaasCode(saasCode);
                    advertisements = getListBySaasCode(saasCode);
                }
            }
        }
        return null;
        //如果查询出的广告为空,则查询默认广告
        if(advertisements==null){
            advertisements = getDefaultList();
        }
        return advertisements;
    }
    /**
     * 通过saasCode查找广告
     * @param saasCode
     * @return
     */
    public List<WlyyAdvertisement> getListBySaasCode(String saasCode){
        return advertisementDao.getListBySaasCode(saasCode);
    }
    /**
     * 查找默认广告
     * @return
     */
    private List<WlyyAdvertisement> getDefaultList(){
        return advertisementDao.getDefaultList();
    }
}