Przeglądaj źródła

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

ysj 5 lat temu
rodzic
commit
3fd1baecc3
16 zmienionych plików z 386 dodań i 39 usunięć
  1. 7 0
      app/app-iot-server/pom.xml
  2. 19 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 17 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  4. 1 1
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java
  5. 0 1
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  6. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf02DO.java
  7. 167 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotHospitalDO.java
  8. 13 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  9. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SpecialistTeamVO.java
  10. 1 1
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  11. 6 8
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  12. 69 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/HospitalController.java
  13. 9 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotHospitalDao.java
  14. 42 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotHospitalService.java
  15. 16 14
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java
  16. 4 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

+ 7 - 0
app/app-iot-server/pom.xml

@ -157,6 +157,13 @@
            <artifactId>mime-util</artifactId>
            <version>2.1.3</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>
    <build>

+ 19 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -24,6 +24,7 @@ import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
@ -38,6 +39,7 @@ import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -163,6 +165,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private WlyyHospitalWorkRuleDao wlyyHospitalWorkRuleDao;
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Value("${demo.flag}")
@ -297,6 +301,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (rstotal != null && rstotal.size() > 0) {
            count = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        String condition = "";
        if("xm_ykyy_wx".equals(wechatId)){
            condition= "to_char(o.register_date ,'yyyy-MM-dd hh24:mi:ss' ) AS \"registerDate\"," ;
        }else{
            condition=  "date_format(o.register_date ,'%Y-%m-%d %H:%i:%S' ) AS registerDate," ;
        }
        String sql ="SELECT " +
                " o.id AS \"id\", " +
                " o.adm_no AS \"admNo\", " +
@ -326,8 +336,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.disease_img AS \"diseaseImg\", " +
                " o.create_time AS \"createTime\", " +
                " o.status AS \"status\"," +
                " o.register_date AS \"registerDate\"," +
                " o.evaluate_status AS \"evaluateStatus\"" +
                condition+
              /*  " o.register_date AS \"registerDate\"," +*/
                " o.evaluate_status AS \"evaluateStatus\"," +
                " o.pay_status as \"payStatus\" "+
                " FROM " +
                " wlyy_outpatient o " +
@ -1784,12 +1795,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescriptionDO = new WlyyPrescriptionDO();
            prescriptionDO.setOutpatientId(outPatientId);
        }
        prescriptionDO.setType(1);
        prescriptionDO.setDept(outpatientDO.getDept());
        prescriptionDO.setCreateTime(new Date());
        prescriptionDO.setStatus(10);
        prescriptionDO.setPatientCode(outpatientDO.getPatient());
        prescriptionDO.setPatientName(outpatientDO.getPatientName());
        prescriptionDO.setDoctor(outpatientDO.getDoctor());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(prescriptionDO.getOutpatientId());
            prescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
        }
        WlyyPrescriptionDO prescription = prescriptionDao.save(prescriptionDO);
        //========================处方操作结束=============================================================

+ 17 - 7
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -880,7 +880,7 @@ public class YkyyEntranceService {
    public String findByRealOrder(String code) throws Exception {
        List<WlyyPrescriptionDO>  wlyyPrescriptionDOs = prescriptionDao.findByPatientCode(code);
        List<WlyyPrescriptionDO>  wlyyPrescriptionDOs = prescriptionDao.findById(code);
        if (wlyyPrescriptionDOs!=null&&wlyyPrescriptionDOs.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOs.get(0);
            JSONObject objectString = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
@ -889,6 +889,7 @@ public class YkyyEntranceService {
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
            for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
                logger.info("11111参数入参"+object.toJSONString());
                WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(object,WlyyPrescriptionInfoVO.class);
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
@ -896,7 +897,7 @@ public class YkyyEntranceService {
            synPrecriptionHis(prescriptionVO);
        }
        return null;
        return wlyyPrescriptionDOs.toString();
    }
@ -933,24 +934,28 @@ public class YkyyEntranceService {
            params.put("json",jsonString);
            params.put("table","HLW_CF01");
            logger.info("HLW_CF01:"+jsonString);
            HttpResponse response = HttpUtils.doGet(url,params);
            HttpResponse response = HttpUtils.doGet(saveUrl,params);
            if (response.getStatus()==200){
                logger.info("表HLW_CF01同步成功!");
            }else {
                logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
            }
            logger.info("处方:"+wlyyPrescriptionVO);
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
            for (WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO:wlyyPrescriptionInfoVOS){
                try {
                    logger.info("chufang1============");
                HlwCf02DO hlwCf02DO = new HlwCf02DO();
                hlwCf02DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
                hlwCf02DO.setYPXH(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugNo()));
                logger.info("drugNo"+hlwCf02DO.getYPXH());
                hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
                hlwCf02DO.setXMLX(1);
                hlwCf02DO.setCFTS(1);
                hlwCf02DO.setYPSL(Double.parseDouble(wlyyPrescriptionInfoVO.getQuantity()));
                hlwCf02DO.setYPDJ(wlyyPrescriptionInfoVO.getPackRetprice());
                hlwCf02DO.setHJJE(Integer.parseInt(wlyyPrescriptionInfoVO.getQuantity())*wlyyPrescriptionInfoVO.getPackRetprice());//划价价额
                hlwCf02DO.setYPZS(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));
                hlwCf02DO.setYPZS(1);//药品组数  待确定
                hlwCf02DO.setYCSL("0");
                hlwCf02DO.setFYGB(17);//费用归并
                hlwCf02DO.setZFBL(1.0);//自负比例
@ -958,20 +963,25 @@ public class YkyyEntranceService {
                hlwCf02DO.setMRCS(Integer.parseInt(wlyyPrescriptionInfoVO.getDosage()));//每日次数
                hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
                hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
                hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));
                /*hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));*/
                hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
              /*  hibenateUtils.save(hlwCf02DO);*/
                String jsonString1 = JSONObject.toJSONString(hlwCf01DO);
                String jsonString1 = JSONObject.toJSONString(hlwCf02DO);
                    logger.info("chufang2============");
                Map<String,Object> params1 = new HashedMap();
                params1.put("json",jsonString1);
                params1.put("table","HLW_CF02");
                logger.info("HLW_CF02:"+jsonString1);
                HttpResponse response1 = HttpUtils.doGet(url,params1);
                HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
                if (response1.getStatus()==200){
                    logger.info("表HLW_CF02同步成功!");
                }else {
                    logger.info("表HLW_CF02同步失败!"+response1.getErrorMsg());
                }
                }catch (Exception e){
                    e.printStackTrace();
                    e.getMessage();
                }
            }
        }

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/service/WechatInfoService.java

@ -106,7 +106,7 @@ public class WechatInfoService {
                    JsApiTicket newJsApiTicket = new JsApiTicket();
                    newJsApiTicket.setJsapi_ticket(ticket);
                    newJsApiTicket.setExpires_in(Long.parseLong(expires_in));
                    if("xm_zsyy_wx".equals(wxId)){
                    if("xm_zsyy_wx".equals(wxId) || "xm_xzzx_wx".equals(wxId) || "xm_ykyy_wx".equals(wxId)){
                        newJsApiTicket.setAcc_id(wxId);
                    }else{
                        newJsApiTicket.setAcc_id(wxWechat.getAppOriginId());

+ 0 - 1
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -710,7 +710,6 @@ public class ImUtil {
	 *获取所有会话未读消息数。
	 * @param userid
	 * @param type
	 * @param status
	 * @return
	 */
	public Integer SessionsUnreadMessageCount(String userid,Integer type){

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf02DO.java

@ -11,7 +11,7 @@ import java.util.Date;
 * */
@Entity
@Table(name = "HLW_CF02")
@SequenceGenerator(name="id_generated", sequenceName="HLW_CF02_SEQ")
@SequenceGenerator(name="id_generated", sequenceName="SEQ_HLW_CF02")
public class HlwCf02DO {
    private Integer sBXH;//NUMBER(18)   N注释
    private Integer cFSB;//NUMBER(18)   N识别序号

+ 167 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotHospitalDO.java

@ -0,0 +1,167 @@
package com.yihu.jw.entity.iot.dict;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * @author humingfen on 2020/4/27.
 */
@Entity
@Table(name = "iot_hospital")
public class IotHospitalDO extends UuidIdentityEntity {
    @Column(name = "saas_id")
    private String saasId;
    // 医院名稱
    private String name;
    // 作废标志,1有效 0 失效
    private String del;
    //省份标志
    private String province;
    //省份名称
    @Column(name = "province_name")
    private String provinceName;
    //城市标志
    private String city;
    //城市名称
    @Column(name = "city_name")
    private String cityName;
    //区县标志
    private String town;
    //区县名称
    @Column(name = "town_name")
    private String townName;
    //级别,1医院,2社区医院
    private int level;
    //医院等级
    private int grade;
    //医院详细地址
    private String address;
    //医院简介
    private String intro;
    //医院图片
    private String photo;
    private String phone;//联系方式
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    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 int getLevel() {
        return level;
    }
    public void setLevel(int level) {
        this.level = level;
    }
    public int getGrade() {
        return grade;
    }
    public void setGrade(int grade) {
        this.grade = grade;
    }
    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 getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
}

+ 13 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -22,6 +22,7 @@ public class IotRequestMapping {
        public static final String patientDevice = api_iot_common + "/patientDevice";
        public static final String wlyy = api_iot_common + "/wlyy";
        public static final String figereLabel = api_iot_common + "/figereLabel";
        public static final String hospital = api_iot_common + "/hospital";
        public static final String message_success_update = "update success";
@ -284,4 +285,16 @@ public class IotRequestMapping {
    }
    /**
     * 单位模块常量
     */
    public static class Hospital{
        public static final String getListByName = "getListByName";
        public static final String create = "createHospital";
        public static final String delete = "deleteHospital";
        public static final String message_success_find = "hospital find success";
        public static final String message_success_create = "hospital create success";
        public static final String message_success_delete = "hospital delete success";
    }
}

+ 14 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SpecialistTeamVO.java

@ -1,10 +1,12 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
import java.util.List;
/**
@ -40,6 +42,9 @@ public class SpecialistTeamVO {
    private String hospitalName;
    @ApiModelProperty("医生团队成员")
    private List<AdminTeamMemberVO> members;
    @ApiModelProperty("签约时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date signDate;
    public String getPatient() {
@ -145,4 +150,13 @@ public class SpecialistTeamVO {
    public void setMembers(List<AdminTeamMemberVO> members) {
        this.members = members;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getSignDate() {
        return signDate;
    }
    public void setSignDate(Date signDate) {
        this.signDate = signDate;
    }
}

+ 1 - 1
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -215,7 +215,7 @@ public class BasicZuulFilter extends ZuulFilter {
    private static boolean sqlValidate(String str) {
        str = str.toLowerCase();//统一转为小写,比较简单的单词加入右边空格,避免单词中包含字段
        String badStr = "and |exec |execute |insert |select |delete |update |drop |*|chr |mid |master |truncate |" +
        String badStr = "and |exec |execute |insert |select |delete |update |drop |chr |mid |master |truncate |" +
                "declare | sitename |net user|xp_cmdshell|or |exec |execute |create |" +
                "table |from |grant |use |group_concat|column_name|" +
                "information_schema.columns|table_schema|union |where |select |update |order |by |like |" +

+ 6 - 8
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -244,14 +244,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }else{
            return success("该身份证无法找到医生",-1);
        }
        //专家咨询
        if("412821198807284025".equals(doctorIdcard)){//测试用写死的数据
            result.put("zxCount",2);//咨询数量
            result.put("fzCount",4);//图文复诊数量
        }else{
            result.put("zxCount",imService.sessionCountByType(doctor.getId(),1,0));//咨询数量
            result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1"));//图文复诊数量
        }
    
        //医生咨询
        Integer unreadMessageCount = imService.SessionsUnreadMessageCount(doctor.getId(),1);
        result.put("zxCount",unreadMessageCount);//咨询数量
        result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1"));//图文复诊数量
        return success("请求成功",result);
    }

+ 69 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/HospitalController.java

@ -0,0 +1,69 @@
package com.yihu.iot.controller.dict;
import com.yihu.iot.service.dict.IotHospitalService;
import com.yihu.jw.entity.iot.dict.IotHospitalDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(IotRequestMapping.Common.hospital)
@Api(tags = "单位管理相关操作", description = "单位管理相关操作")
public class HospitalController extends EnvelopRestEndpoint {
    @Autowired
    private IotHospitalService hospitalService;
    @PostMapping(value = IotRequestMapping.Hospital.create)
    @ApiOperation(value = "创建编辑单位字典")
    public MixEnvelop create(
            @ApiParam(name = "jsonData", value = "设备体征字典json数据")
            @RequestParam(value = "jsonData", required = false) String jsonData){
        try {
            IotHospitalDO hospitalDO = toEntity(jsonData, IotHospitalDO.class);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, hospitalService.create(hospitalDO));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Hospital.getListByName)
    @ApiOperation(value = "获取机构单位列表接口")
    public MixEnvelop getListByName(
            @ApiParam(name = "name", value = "机构名称")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "page", value = "当前页,从1开始")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "页面大小")
            @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            List<IotHospitalDO> hospitalDOList = hospitalService.getListByName(name, page, pageSize);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find, hospitalDOList);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Hospital.delete)
    @ApiOperation(value = "删除单位字典")
    public MixEnvelop delete(
            @ApiParam(name = "id", value = "单位id")
            @RequestParam(value = "id", required = true) String id){
        try {
            hospitalService.delete(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 9 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotHospitalDao.java

@ -0,0 +1,9 @@
package com.yihu.iot.dao.dict;
import com.yihu.jw.entity.iot.dict.IotHospitalDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface IotHospitalDao extends PagingAndSortingRepository<IotHospitalDO, String>,
        JpaSpecificationExecutor<IotHospitalDO> {
}

+ 42 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotHospitalService.java

@ -0,0 +1,42 @@
package com.yihu.iot.service.dict;
import com.yihu.iot.dao.dict.IotHospitalDao;
import com.yihu.jw.entity.iot.dict.IotHospitalDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * @author humingfen on 2020/4/27.
 */
@Service
public class IotHospitalService extends BaseJpaService<IotHospitalDO, IotHospitalDao> {
    @Autowired
    private IotHospitalDao hospitalDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public IotHospitalDO create(IotHospitalDO hospitalDO) {
        hospitalDO.setSaasId(getCode());
        hospitalDO.setDel("1");
        hospitalDao.save(hospitalDO);
        return hospitalDO;
    }
    public List<IotHospitalDO> getListByName(String name, Integer page, Integer pageSize) {
        String sql = "SELECT * FROM `iot_hospital` h WHERE h.del = 1 ";
        if(StringUtils.isNotBlank(name)){
            sql += "and h.name like '%" + name + "%' ";
        }
        if(page != null && pageSize != null){
            sql += "limit " + (page-1)*pageSize + "," + pageSize;
        }
        List<IotHospitalDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(IotHospitalDO.class));
        return list;
    }
}

+ 16 - 14
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java

@ -45,22 +45,24 @@ public class IotSystemDictService extends BaseJpaService<IotSystemDictDO,IotSyst
        String value = dictDO.getValue();
        String parentCode = dictDO.getParentCode();
        //判断新增或者编辑
        if(StringUtils.isNotBlank(dictDO.getCode())){
        if(StringUtils.isNotBlank(dictDO.getCode())) {
            dictDO = iotSystemDictDao.findByDictNameAndCodeAndDel(dictDO.getDictName(), dictDO.getCode(), 1);
            dictDO.setValue(value);
            dictDO.setParentCode(parentCode);
            dictDO.setUpdateTime(new Date());
        }else {
            //获取最近一条添加记录的code
            List<IotSystemDictDO> dictDOList = iotSystemDictDao.getAllByDictNameAndOrderByCodeDesc(dictDO.getDictName());
            if(dictDOList.size() > 0){
                dictDO.setCode((Long.parseLong(dictDOList.get(0).getCode()) + 1) + "");
            }else {
                dictDO.setCode("1");
            if (StringUtils.isNotBlank(dictDO.getId())) {
                dictDO.setValue(value);
                dictDO.setParentCode(parentCode);
                dictDO.setUpdateTime(new Date());
            } else {
                //获取最近一条添加记录的code
                List<IotSystemDictDO> dictDOList = iotSystemDictDao.getAllByDictNameAndOrderByCodeDesc(dictDO.getDictName());
                if (dictDOList.size() > 0) {
                    dictDO.setCode((Long.parseLong(dictDOList.get(0).getCode()) + 1) + "");
                } else {
                    dictDO.setCode("1");
                }
                dictDO.setSaasId(getCode());
                dictDO.setDel(1);
                dictDO.setCreateTime(new Date());
            }
            dictDO.setSaasId(getCode());
            dictDO.setDel(1);
            dictDO.setCreateTime(new Date());
        }
        iotSystemDictDao.save(dictDO);
        return dictDO;

+ 4 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -607,16 +607,16 @@ public class SpecialistService{
                " r.id AS relationCode, " +
                " r.patient, " +
                " r.patient_name AS patientName, " +
                " r.team_code, " +
                " r.team_code,r.sign_date , " +
                " t.`name` AS name," +
                " d.photo," +
                " md.code AS doctor," +
                " md.name AS doctorName" +
                " d.code AS doctor," +
                " d.name AS doctorName,d.hospital,d.hospital_name " +
                " FROM " +
                " wlyy_specialist_patient_relation r  " +
                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
                " JOIN "+basedb+".wlyy_doctor d ON t.leader_code = d.`code` " +
                " JOIN "+basedb+".wlyy_doctor md ON md.code = r.doctor " +
//                " JOIN "+basedb+".wlyy_doctor md ON md.code = r.doctor " +
                " WHERE " +
                " r.patient = '"+patient+"' " +
                " AND r.`status` >=0  " +