فهرست منبع

部门配置修改

wangjun 4 سال پیش
والد
کامیت
e7c97569d6

+ 16 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/drugstore/dao/BaseDrugStoreTimeDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.hospital.drugstore.dao;
import com.yihu.jw.entity.base.area.BaseDrugStoreDO;
import com.yihu.jw.entity.base.area.BaseDrugStoreTimeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface BaseDrugStoreTimeDao extends PagingAndSortingRepository<BaseDrugStoreTimeDO, String>, JpaSpecificationExecutor<BaseDrugStoreTimeDO> {
    @Query("delete from BaseDrugStoreTimeDO  where drugStoreId = ?1")
    void deleteByDrugStoreId(String drugStoreId);
    @Query("from BaseDrugStoreTimeDO where drugStoreId =?1")
    List<BaseDrugStoreTimeDO> findByDrugStoreId(String drugStoreId);
}

+ 80 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/drugstore/service/BaseDrugStoreService.java

@ -1,11 +1,17 @@
package com.yihu.jw.hospital.drugstore.service;
package com.yihu.jw.hospital.drugstore.service;
import com.alibaba.fastjson.JSONArray;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.j2objc.annotations.AutoreleasePool;
import com.google.j2objc.annotations.AutoreleasePool;
import com.yihu.jw.entity.base.area.BaseDrugStoreDO;
import com.yihu.jw.entity.base.area.BaseDrugStoreDO;
import com.yihu.jw.entity.base.area.BaseDrugStoreTimeDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreTimeDao;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.CountDistance;
import com.yihu.jw.utils.CountDistance;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
@ -30,6 +36,10 @@ public class BaseDrugStoreService extends BaseJpaService<BaseDrugStoreDO, BaseDr
    private ObjectMapper objectMapper;
    private ObjectMapper objectMapper;
    @Autowired
    @Autowired
    private HibenateUtils hibenateUtils;
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseDrugStoreTimeDao baseDrugStoreTimeDao;
    @Autowired
    private BaseOrgDao baseOrgDao;
   //根据经纬度计算距离通过代码
   //根据经纬度计算距离通过代码
   public List<BaseDrugStoreDO> countDistanceListIncode(String latitude,String longitude,String drugStoreName,String hospitalName) throws ParseException {
   public List<BaseDrugStoreDO> countDistanceListIncode(String latitude,String longitude,String drugStoreName,String hospitalName) throws ParseException {
@ -64,6 +74,76 @@ public class BaseDrugStoreService extends BaseJpaService<BaseDrugStoreDO, BaseDr
        double storeLongitude = Double.parseDouble(baseDrugStoreDO.getLongitude());
        double storeLongitude = Double.parseDouble(baseDrugStoreDO.getLongitude());
        double distance = countDistance.getDistance(Double.parseDouble(latitude),Double.parseDouble(longitude),storeLatitude,storeLongitude);
        double distance = countDistance.getDistance(Double.parseDouble(latitude),Double.parseDouble(longitude),storeLatitude,storeLongitude);
        baseDrugStoreDO.setDistance(distance);
        baseDrugStoreDO.setDistance(distance);
        List<BaseDrugStoreTimeDO> list  = baseDrugStoreTimeDao.findByDrugStoreId(baseDrugStoreDO.getDrugStoreCode());
        baseDrugStoreDO.setBaseDrugStoreTimeDOlist(list);
        return baseDrugStoreDO;
        return baseDrugStoreDO;
    }
    }
    /*
    *
    */
    public BaseDrugStoreDO saveDrugStore(String jsonData,String timeDate){
        try {
            BaseDrugStoreDO baseDrugStoreDO = objectMapper.readValue(jsonData,BaseDrugStoreDO.class);
            if (StringUtils.isNoneBlank(baseDrugStoreDO.getId())){//修改
                if (StringUtils.isNoneBlank(timeDate)){
                    //删除之前设置的药房开方时间
                    baseDrugStoreTimeDao.deleteByDrugStoreId(baseDrugStoreDO.getId());
                    JSONArray jsonArray = JSONArray.parseArray(timeDate);
                    if (jsonArray!=null){
                        for (int i = 0;i<jsonArray.size();i++){
                            BaseDrugStoreTimeDO baseDrugStoreTimeDO = objectMapper.readValue(jsonArray.get(i).toString(), BaseDrugStoreTimeDO.class);
                            baseDrugStoreTimeDO.setDrugStoreId(baseDrugStoreDO.getId());
                            baseDrugStoreTimeDao.save(baseDrugStoreTimeDO);
                        }
                    }
                }
                BaseDrugStoreDO baseDrugStorePre = baseDrugStoreDao.findOne(baseDrugStoreDO.getId());
                if (baseDrugStorePre!=null){
                    BaseOrgDO baseOrgDO = baseOrgDao.findByCode(baseDrugStoreDO.getHospitalCode());
                    if (baseOrgDO!=null){
                        baseDrugStorePre.setHospitalCode(baseDrugStoreDO.getHospitalCode());
                        baseDrugStorePre.setHospitalName(baseOrgDO.getName());
                    }
                    baseDrugStorePre.setDrugStoreName(baseDrugStoreDO.getDrugStoreName());
                    baseDrugStorePre.setDrugStoreCode(baseDrugStoreDO.getDrugStoreCode());
                    baseDrugStorePre.setAddress(baseDrugStoreDO.getAddress());
                    baseDrugStorePre.setRemark(baseDrugStoreDO.getRemark());
                    baseDrugStorePre.setDrugImg(baseDrugStoreDO.getDrugImg());
                    baseDrugStorePre.setOpenControl(baseDrugStoreDO.getOpenControl());
                    baseDrugStorePre.setIsDel(1);
                    baseDrugStorePre.setLatitude(baseDrugStoreDO.getLatitude());
                    baseDrugStorePre.setLongitude(baseDrugStoreDO.getLongitude());
                    baseDrugStoreDO = baseDrugStoreDao.save(baseDrugStorePre);
                }
            }else {//新增
                baseDrugStoreDO.setIsDel(1);
                baseDrugStoreDO = baseDrugStoreDao.save(baseDrugStoreDO);
                if (StringUtils.isNoneBlank(timeDate)){
                    JSONArray jsonArray = JSONArray.parseArray(timeDate);
                    if (jsonArray!=null){
                        for (int i = 0;i<jsonArray.size();i++){
                            BaseDrugStoreTimeDO baseDrugStoreTimeDO = objectMapper.readValue(jsonArray.get(i).toString(), BaseDrugStoreTimeDO.class);
                            baseDrugStoreTimeDO.setDrugStoreId(baseDrugStoreDO.getId());
                            baseDrugStoreTimeDao.save(baseDrugStoreTimeDO);
                        }
                    }
                }
            }
            return baseDrugStoreDO;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
    //作废药房
    public void deleteDrugStore(String id,Integer isDel){
        BaseDrugStoreDO baseDrugStoreDO = baseDrugStoreDao.findOne(id);
        if (baseDrugStoreDO!=null){
            baseDrugStoreDO.setIsDel(isDel);
            baseDrugStoreDao.save(baseDrugStoreDO);
        }
    }
}
}

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
    @Id
//==========mysql 环境 id策略======================================================
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
    /*@GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
//==========Oracle 环境id策略 =========================================================
/*   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
    public Integer getId() {
        return id;
        return id;

+ 39 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseDrugStoreDO.java

@ -6,6 +6,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Transient;
import java.util.List;
@Entity
@Entity
@Table(name = "base_drug_store")
@Table(name = "base_drug_store")
@ -24,6 +25,11 @@ public class BaseDrugStoreDO extends UuidIdentityEntityWithOperator {
    private String drugStoreCode;
    private String drugStoreCode;
    private String drugStoreName;
    private String drugStoreName;
    private Integer isDel;
    private Integer isDel;
    private String remark;
    private String drugImg;
    private String openControl;
    @Transient
    private List<BaseDrugStoreTimeDO> baseDrugStoreTimeDOlist;
    /*private String hisCode;
    /*private String hisCode;
    public String getHisCode() {
    public String getHisCode() {
@ -36,6 +42,39 @@ public class BaseDrugStoreDO extends UuidIdentityEntityWithOperator {
    @Transient
    @Transient
    private double distance ;
    private double distance ;
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "drug_img")
    public String getDrugImg() {
        return drugImg;
    }
    public void setDrugImg(String drugImg) {
        this.drugImg = drugImg;
    }
    @Column(name = "open_control")
    public String getOpenControl() {
        return openControl;
    }
    public void setOpenControl(String openControl) {
        this.openControl = openControl;
    }
    @Transient
    public List<BaseDrugStoreTimeDO> getBaseDrugStoreTimeDOlist() {
        return baseDrugStoreTimeDOlist;
    }
    public void setBaseDrugStoreTimeDOlist(List<BaseDrugStoreTimeDO> baseDrugStoreTimeDOlist) {
        this.baseDrugStoreTimeDOlist = baseDrugStoreTimeDOlist;
    }
    @Transient
    @Transient
    public double getDistance() {
    public double getDistance() {
        return distance;
        return distance;

+ 58 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/area/BaseDrugStoreTimeDO.java

@ -0,0 +1,58 @@
package com.yihu.jw.entity.base.area;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_drug_store_time")
public class BaseDrugStoreTimeDO extends UuidIdentityEntityWithOperator {
    private Date beginTime;
    private Date endTime;
    private String weekDay;
    private String amPm;
    private String drugStoreId;
    @Column(name = "begin_time")
    public Date getBeginTime() {
        return beginTime;
    }
    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }
    @Column(name = "end_time")
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    @Column(name = "week_day")
    public String getWeekDay() {
        return weekDay;
    }
    public void setWeekDay(String weekDay) {
        this.weekDay = weekDay;
    }
    @Column(name = "am_pm")
    public String getAmPm() {
        return amPm;
    }
    public void setAmPm(String amPm) {
        this.amPm = amPm;
    }
    @Column(name = "drug_store_id")
    public String getDrugStoreId() {
        return drugStoreId;
    }
    public void setDrugStoreId(String drugStoreId) {
        this.drugStoreId = drugStoreId;
    }
}

+ 49 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java

@ -26,6 +26,10 @@ public class DictHospitalDeptDO extends IntegerIdentityEntity {
	 * 机构code,每个机构的科室不完全一样
	 * 机构code,每个机构的科室不完全一样
	 */
	 */
	private String orgCode;
	private String orgCode;
    /**
     * 机构名称
     */
    private String orgName;
    /**
    /**
	 * 科室标识
	 * 科室标识
@ -70,9 +74,53 @@ public class DictHospitalDeptDO extends IntegerIdentityEntity {
     * 是否会诊科室
     * 是否会诊科室
     */
     */
    private String consultDeptFlag;
    private String consultDeptFlag;
    /**
     * 科室logo
     */
    private String deptLogo;
    /**
     * 科室图片
     */
    private String deptImg;
    /**
     * 科室描述
     */
    private String deptDescription;
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    @Column(name = "dept_logo")
    public String getDeptLogo() {
        return deptLogo;
    }
    public void setDeptLogo(String deptLogo) {
        this.deptLogo = deptLogo;
    }
    @Column(name = "dept_img")
    public String getDeptImg() {
        return deptImg;
    }
    public void setDeptImg(String deptImg) {
        this.deptImg = deptImg;
    }
    @Column(name = "dept_description")
    public String getDeptDescription() {
        return deptDescription;
    }
    public void setDeptDescription(String deptDescription) {
        this.deptDescription = deptDescription;
    }
	@Column(name = "org_code")
    @Column(name = "org_code")
    public String getOrgCode() {
    public String getOrgCode() {
        return orgCode;
        return orgCode;
    }
    }

+ 123 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/dict/DictHospitalDeptService.java

@ -6,6 +6,12 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.enums.SystemDictEnum;
import com.yihu.jw.base.enums.SystemDictEnum;
import com.yihu.jw.base.service.org.BaseOrgService;
import com.yihu.jw.base.service.org.BaseOrgService;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -13,9 +19,8 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.util.*;
/**
/**
 * 
 * 
@ -40,6 +45,12 @@ public class DictHospitalDeptService extends BaseJpaService<DictHospitalDeptDO,
    @Autowired
    @Autowired
    private BaseOrgService baseOrgService;
    private BaseOrgService baseOrgService;
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    /**
    /**
     * 查询某一租户下的医院科室字典信息,如果saadId为空表示当前用户角色为超级管理员,超级管理员可以看到所有数据
     * 查询某一租户下的医院科室字典信息,如果saadId为空表示当前用户角色为超级管理员,超级管理员可以看到所有数据
     * @param saasId
     * @param saasId
@ -102,5 +113,114 @@ public class DictHospitalDeptService extends BaseJpaService<DictHospitalDeptDO,
    public void saveBatch(List<DictHospitalDeptDO> dictHospitalDeptDOS)throws Exception{
    public void saveBatch(List<DictHospitalDeptDO> dictHospitalDeptDOS)throws Exception{
        dictHospitalDeptDao.save(dictHospitalDeptDOS);
        dictHospitalDeptDao.save(dictHospitalDeptDOS);
    }
    }
    /**
     * 查询单个科室信息 带医生
     * @return
     */
    public Map findSingleDept(Integer id,Integer page,Integer pageSize){
        Map<String ,Object> returnMap = new HashMap<>();
        DictHospitalDeptDO dictHospitalDeptDO = dictHospitalDeptDao.findOne(id);
        if (dictHospitalDeptDO!=null){
            String sql = "select b.name as \"name\",b.id as \"id\"" +
                    " b.sex as \"sex\"," +
                    " b.idcard as \"idcard\"," +
                    " b.mobile as \"mobile\"," +
                    " b.job_title_code as \"jobTitleCode\"," +
                    " b.job_title_name as \"jobTitleName\"" +
                    " from base_doctor_hospital d " +
                    " left join dict_hospital_dept p on d.dept_code = p.code" +
                    " left join base_doctor b on d.doctor_code = b.id" +
                    " where b p.dept_code = '"+dictHospitalDeptDO.getCode()+"'";
            List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
            List<Map<String,Object>> listCount = hibenateUtils.createSQLQuery(sql);
            for (Map<String,Object> map:list){
                if (map.get("idcard")!=null){
                    map.put("age", IdCardUtil.getAgeForIdcard(map.get("idcard").toString()));
                }
            }
            returnMap.put("doctorList",list);
            if (listCount!=null){
                returnMap.put("doctorListCount",listCount.size());
            }else {
                returnMap.put("doctorListCount",0);
            }
        }
        returnMap.put("dept",dictHospitalDeptDO);
        return returnMap;
    }
    /**
     * 新增科室
     * @return
     */
    public DictHospitalDeptDO addDept(String jsonData,String doctorIds){
        try {
            DictHospitalDeptDO dictHospitalDeptDO = objectMapper.readValue(jsonData,DictHospitalDeptDO.class);
            dictHospitalDeptDao.save(dictHospitalDeptDO);
            if (StringUtils.isNotBlank(doctorIds)){
                if (doctorIds.contains(",")){
                    String[] doctorId = doctorIds.split(",");
                    for (int i = 0;i<doctorId.length;i++){
                        BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                        baseDoctorHospitalDO.setDoctorCode(doctorId[i]);
                        baseDoctorHospitalDO.setDeptName(dictHospitalDeptDO.getName());
                        baseDoctorHospitalDO.setDeptCode(dictHospitalDeptDO.getCode());
                        baseDoctorHospitalDO.setOrgCode(dictHospitalDeptDO.getOrgCode());
                        baseDoctorHospitalDO.setOrgName(dictHospitalDeptDO.getOrgName());
                        baseDoctorHospitalDO.setDel("1");
                        baseDoctorHospitalDO.setCreateTime(new Date());
                        baseDoctorHospitalDao.save(baseDoctorHospitalDO);
                    }
                }else {
                    BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                    baseDoctorHospitalDO.setDoctorCode(doctorIds);
                    baseDoctorHospitalDO.setDeptName(dictHospitalDeptDO.getName());
                    baseDoctorHospitalDO.setDeptCode(dictHospitalDeptDO.getCode());
                    baseDoctorHospitalDO.setOrgCode(dictHospitalDeptDO.getOrgCode());
                    baseDoctorHospitalDO.setOrgName(dictHospitalDeptDO.getOrgName());
                    baseDoctorHospitalDO.setDel("1");
                    baseDoctorHospitalDO.setCreateTime(new Date());
                    baseDoctorHospitalDao.save(baseDoctorHospitalDO);
                }
            }
            return dictHospitalDeptDO;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
   public void saveDeptDoctor(String doctorIds ,String deptCode){
       DictHospitalDeptDO dictHospitalDeptDO = dictHospitalDeptDao.findByCode(deptCode);
       if (dictHospitalDeptDO!=null){
           if (StringUtils.isNotBlank(doctorIds)) {
               if (doctorIds.contains(",")) {
                   String[] doctorId = doctorIds.split(",");
                   for (int i = 0; i < doctorId.length; i++) {
                       BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                       baseDoctorHospitalDO.setDoctorCode(doctorId[i]);
                       baseDoctorHospitalDO.setDeptName(dictHospitalDeptDO.getName());
                       baseDoctorHospitalDO.setDeptCode(dictHospitalDeptDO.getCode());
                       baseDoctorHospitalDO.setOrgCode(dictHospitalDeptDO.getOrgCode());
                       baseDoctorHospitalDO.setOrgName(dictHospitalDeptDO.getOrgName());
                       baseDoctorHospitalDO.setDel("1");
                       baseDoctorHospitalDO.setCreateTime(new Date());
                       baseDoctorHospitalDao.save(baseDoctorHospitalDO);
                   }
               } else {
                   BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                   baseDoctorHospitalDO.setDoctorCode(doctorIds);
                   baseDoctorHospitalDO.setDeptName(dictHospitalDeptDO.getName());
                   baseDoctorHospitalDO.setDeptCode(dictHospitalDeptDO.getCode());
                   baseDoctorHospitalDO.setOrgCode(dictHospitalDeptDO.getOrgCode());
                   baseDoctorHospitalDO.setOrgName(dictHospitalDeptDO.getOrgName());
                   baseDoctorHospitalDO.setDel("1");
                   baseDoctorHospitalDO.setCreateTime(new Date());
                   baseDoctorHospitalDao.save(baseDoctorHospitalDO);
               }
           }
       }
   }
   public void removeDeptDoctor(){
   }
}
}

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorHospitalService.java

@ -81,4 +81,5 @@ public class BaseDoctorHospitalService extends BaseJpaService<BaseDoctorHospital
                " ORDER BY doctorDutyName DESC";
                " ORDER BY doctorDutyName DESC";
        return jdbcTemplate.queryForList(sql.replace("{doctorCode}",doctorCode));
        return jdbcTemplate.queryForList(sql.replace("{doctorCode}",doctorCode));
    }
    }
}
}

+ 19 - 28
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -16,6 +16,7 @@ import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -140,24 +141,16 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
                        "FROM\n" +
                        "FROM\n" +
                        "\tbase_org\n" +
                        "\tbase_org\n" +
                        "WHERE\n" +
                        "WHERE\n" +
                        "\t(\n" +
                        "\t\t(code like '{code}' OR '' =  '{code}')\n" +
                        "\t\tAND (del = '{orgStatus}' OR '' = '{orgStatus}')\n" +
                        "\t)\n" +
                        "OR (\n" +
                        "\t(NAME LIKE '{name}' OR '' = '{name}')\n" +
                        "\tAND (del ='{orgStatus}' OR '' = '{orgStatus}')\n" +
                        ")\n" +
                        "AND (del = '{orgStatus}' OR '' = '{orgStatus}')\n" +
                        "ORDER BY\n" +
                        " 1=1 ";
                if (!StringUtil.isBlank(codeOrNameValue)){
                    sql+=" and (code like '%"+codeOrNameValue+"%' or  NAME like '%"+codeOrNameValue+"%') ";
                }
                if (!StringUtil.isBlank(orgStatus)){
                    sql+=" and del = '"+orgStatus+"'";
                }
                sql+="  ORDER BY\n" +
                        "\tcreate_time DESC";
                        "\tcreate_time DESC";
                String finalSql = sql
                .replace("{code}", "%" + codeOrNameValue + "%")
                .replace("{name}", "%" + codeOrNameValue + "%")
                .replace("{orgStatus}", null == orgStatus ? "" : orgStatus);
                String finalSql = sql;
        List<Map<String, Object>> list=null;
        List<Map<String, Object>> list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
@ -194,17 +187,15 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
        String countSql = "SELECT count(id)" +
        String countSql = "SELECT count(id)" +
                " FROM base_org " +
                " FROM base_org " +
                " WHERE " +
                " WHERE " +
                " ((code like '{code}' or ''='{code}')  and (del = '{orgStatus}' or ''='{orgStatus}'))" +
                " OR " +
                " ((name like '{name}' or ''='{name}') and (del = '{orgStatus}' or ''='{orgStatus}'))" +
                " AND" +
                " (del = '{orgStatus}' OR ''='{orgStatus}')";
        String finalCountSql = countSql
                .replace("{code}", "%" + codeOrNameValue + "%")
                .replace("{name}", "%" + codeOrNameValue + "%")
                .replace("{orgStatus}", null == orgStatus ? "" : orgStatus);
        Logger.getAnonymousLogger().info("finalCountSql="+finalCountSql);
        Integer count = jdbcTemplate.queryForObject(finalCountSql, Integer.class);
               " 1=1 ";
        if (!StringUtil.isBlank(codeOrNameValue)){
            countSql+=" and (code like '%"+codeOrNameValue+"%' or  NAME like '%"+codeOrNameValue+"%') ";
        }
        if (!StringUtil.isBlank(orgStatus)){
            countSql+=" and del = '"+orgStatus+"'";
        }
        Logger.getAnonymousLogger().info("finalCountSql="+countSql);
        Integer count = jdbcTemplate.queryForObject(countSql, Integer.class);
        result.put("count", count);
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
        return result;
        return result;

+ 24 - 21
svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamService.java

@ -21,6 +21,7 @@ import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
import com.yihu.jw.restmodel.base.wx.WxGraphicMessageVO;
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.jw.restmodel.base.wx.WxReplySceneVO;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
@ -314,9 +315,6 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
        JSONObject result = new JSONObject();
        JSONObject result = new JSONObject();
      /*  int start = 0 == page ? page++ : (page - 1) * size;
      /*  int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : page * size;*/
        int end = 0 == size ? 15 : page * size;*/
        String teamNameValue = null == teamName ? "" : teamName;
        String orgCodeValue = null == orgCode ? "" : orgCode;
        String statusValue = null == status ? "" : status;
//        String sql = " " +
//        String sql = " " +
//                "SELECT " +
//                "SELECT " +
@ -368,18 +366,20 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
                "  base_team team, " +
                "  base_team team, " +
                "  base_org org " +
                "  base_org org " +
                "WHERE " +
                "WHERE " +
                "  team.org_code = org.code " +
                "  and (team.name like '{teamName}' or '' ='{teamName}') " +
                "  and (team.org_code = '{orgCode}' or '' = '{orgCode}') " +
                "  and ( team.del = '{status}' or '' = '{status}') " +
                " ORDER BY team.create_time DESC " ;
                "  team.org_code = org.code " ;
        String finalSql = sql
                .replace("{teamName}","%" + teamNameValue + "%")
                .replace("{orgCode}",orgCodeValue)
                .replace("{status}",statusValue);
        if (!StringUtil.isBlank(teamName)){
            sql += " and team.name like '%"+teamName+"%'";
        }
        if (!StringUtil.isBlank(orgCode)){
            sql += " and team.org_code = '"+orgCode+"'";
        }
        if (!StringUtil.isBlank(status)){
            sql += " and team.del = '"+status+"'";
        }
        sql+= " ORDER BY team.create_time DESC " ;
        String finalSql = sql;
        List<Map<String,Object>>  list=null;
        List<Map<String,Object>>  list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
@ -423,14 +423,17 @@ public class BaseTeamService extends BaseJpaService<BaseTeamDO, BaseTeamDao> {
                "  base_team team, " +
                "  base_team team, " +
                "  base_org org " +
                "  base_org org " +
                "WHERE " +
                "WHERE " +
                "  team.org_code = org.code " +
                "  AND (team.name LIKE '{teamName}' OR '' = '{teamName}') " +
                "  AND (team.org_code = '{orgCode}' OR '' = '{orgCode}') " +
                "  AND (team.del = '{status}' OR '' = '{status}')";
        String finalCountSql = countSql
                .replace("{teamName}","%" + teamNameValue + "%")
                .replace("{orgCode}",orgCodeValue)
                .replace("{status}",statusValue);
                "  team.org_code = org.code " ;
        if (!StringUtil.isBlank(teamName)){
            sql += " and team.name like '%"+teamName+"%'";
        }
        if (!StringUtil.isBlank(orgCode)){
            sql += " and team.org_code = '"+orgCode+"'";
        }
        if (!StringUtil.isBlank(status)){
            sql += " and team.del = '"+status+"'";
        }
        String finalCountSql = countSql;
        Logger.getAnonymousLogger().info("finalCountSql="+finalCountSql);
        Logger.getAnonymousLogger().info("finalCountSql="+finalCountSql);
        int count = jdbcTemplate.queryForObject(finalCountSql,Integer.class);
        int count = jdbcTemplate.queryForObject(finalCountSql,Integer.class);
        result.put("count", count);
        result.put("count", count);