7 files modified
10 files added
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | import org.hibernate.validator.constraints.NotEmpty; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | @NotEmpty(message = "是否删除,1删除,0未删除不能为空") |
| | | private Boolean isDel; |
| | | /** |
| | | * 租户字段 |
| | | */ |
| | | private String tenantId; |
| | | private int isDel; |
| | | /** |
| | | * 状态,1启用,0停用 |
| | | */ |
| | | @NotEmpty(message = "状态,1启用,0停用不能为空") |
| | | private Boolean enabled; |
| | | private int enabled; |
| | | |
| | | /** |
| | | * 是否关闭筛查推送 ,0否,1是 |
| | | */ |
| | | private int isScreeningPush; |
| | | |
| | | /** |
| | | * 推送标题 |
| | | */ |
| | | private String pushTitle; |
| | | |
| | | /** |
| | | * 推送描述 |
| | | */ |
| | | private String pushDescription; |
| | | |
| | | /** |
| | | * 推送背景图片 |
| | | */ |
| | | private String pushBackImage; |
| | | |
| | | /** |
| | | * 微站首页中间位置图片 |
| | | */ |
| | | private String homePage; |
| | | } |
New file |
| | |
| | | package com.kidgrow.oprationcenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * |
| | | * @version 1.0 |
| | | * @Description: 筛查机构信息表<br> |
| | | * @Project: 用户中心<br> |
| | | * @CreateDate: Created in 2020-10-12 17:10:31 <br> |
| | | * @Author: <a href="78125310@kidgrow.com">dougang</a> |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @TableName("screening_organization_info") |
| | | public class ScreeningOrganizationInfo extends SuperModel { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 省 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 市 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 区 |
| | | */ |
| | | private String area; |
| | | /** |
| | | * 机构名称 |
| | | */ |
| | | private String organizationName; |
| | | /** |
| | | * 联系人 |
| | | */ |
| | | private String contactName; |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | private String contactNumber; |
| | | /** |
| | | * 医院ID |
| | | */ |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long sourceHospitalId; |
| | | /** |
| | | * 医院名称 |
| | | */ |
| | | private String sourceHospitalName; |
| | | /** |
| | | * 备注 |
| | | */ |
| | | private String remarks; |
| | | /** |
| | | * 机构简称 |
| | | */ |
| | | private String abbreviation; |
| | | /** |
| | | * 机构二维码地址 |
| | | */ |
| | | private String qrCode; |
| | | /** |
| | | * 社区 |
| | | */ |
| | | private String community; |
| | | /** |
| | | * 机构编码 |
| | | */ |
| | | private String organizationNo; |
| | | /** |
| | | * 区域code |
| | | */ |
| | | private String areaCode; |
| | | |
| | | /** |
| | | * 上一级 |
| | | */ |
| | | @JsonSerialize(using = ToStringSerializer.class) |
| | | private Long parentId; |
| | | |
| | | /** |
| | | * 等级 |
| | | */ |
| | | private int orgLevel; |
| | | } |
| | |
| | | package com.kidgrow.oprationcenter.mapper; |
| | | |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | import com.kidgrow.db.mapper.SuperMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.db.mapper.SuperMapper; |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return HospitalScreening对象 |
| | | */ |
| | | HospitalScreening findByObject(@Param("p") HospitalScreening hospitalScreening); |
| | | |
| | | /** |
| | | * 根据医院名称模糊查询医院数据列表 |
| | | * @param hospitalName |
| | | * @return |
| | | */ |
| | | List<HospitalScreening> findByName(@Param("hospitalName") String hospitalName); |
| | | } |
New file |
| | |
| | | package com.kidgrow.oprationcenter.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.db.mapper.SuperMapper; |
| | | import com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * @Description: 筛查机构信息表<br> |
| | | * @Project: 用户中心<br> |
| | | * @CreateDate: Created in 2020-10-12 17:10:31 <br> |
| | | * @Author: <a href="78125310@kidgrow.com">dougang</a> |
| | | * @version 1.0 |
| | | */ |
| | | public interface ScreeningOrganizationInfoMapper extends SuperMapper<ScreeningOrganizationInfo> { |
| | | /** |
| | | * 分页查询筛查机构信息表列表 |
| | | * @param page |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<ScreeningOrganizationInfo> findList(Page<ScreeningOrganizationInfo> page, @Param("p") Map<String, Object> params); |
| | | |
| | | /** |
| | | * 根据OrganizationInfo对象当做查询条件进行查询 |
| | | * @param organizationInfo |
| | | * @return OrganizationInfo对象 |
| | | */ |
| | | ScreeningOrganizationInfo findByObject(@Param("p") ScreeningOrganizationInfo organizationInfo); |
| | | } |
| | |
| | | package com.kidgrow.oprationcenter.service; |
| | | |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.service.ISuperService; |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | |
| | | import java.util.Map; |
| | | |
| | |
| | | * @return HospitalScreening对象 |
| | | */ |
| | | HospitalScreening findByObject(HospitalScreening hospitalScreening); |
| | | |
| | | /** |
| | | * 状态变更 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | ResultBody updateEnabled(Map<String, Object> params); |
| | | |
| | | /** |
| | | * 根据医院名称模糊查询医院数据列表 |
| | | * @param hospitalName |
| | | * @return |
| | | */ |
| | | ResultBody<HospitalScreening> findByName(String hospitalName); |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.kidgrow.oprationcenter.service; |
| | | |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.service.ISuperService; |
| | | import com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * @Description: 筛查机构信息表<br> |
| | | * @Project: 用户中心<br> |
| | | * @CreateDate: Created in 2020-10-12 17:10:31 <br> |
| | | * @Author: <a href="78125310@kidgrow.com">dougang</a> |
| | | * @version 1.0 |
| | | */ |
| | | public interface IScreeningOrganizationInfoService extends ISuperService<ScreeningOrganizationInfo> { |
| | | /** |
| | | * 列表 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | PageResult<ScreeningOrganizationInfo> findList(Map<String, Object> params); |
| | | |
| | | |
| | | /** |
| | | * 根据OrganizationInfo对象当做查询条件进行查询 |
| | | * @param organizationInfo |
| | | * @return OrganizationInfo对象 |
| | | */ |
| | | ScreeningOrganizationInfo findByObject(ScreeningOrganizationInfo organizationInfo); |
| | | } |
| | | |
| | |
| | | package com.kidgrow.oprationcenter.service.impl; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | import com.kidgrow.oprationcenter.mapper.HospitalScreeningMapper; |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | import com.kidgrow.oprationcenter.service.IHospitalScreeningService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | import com.kidgrow.oprationcenter.mapper.HospitalScreeningMapper; |
| | | import com.kidgrow.oprationcenter.service.IHospitalScreeningService; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | |
| | | public HospitalScreening findByObject(HospitalScreening hospitalScreening){ |
| | | return baseMapper.findByObject(hospitalScreening); |
| | | } |
| | | |
| | | /** |
| | | * 更新状态:推送装填,启停状态 |
| | | * @param params 包含:1、type:0推送,1启停 |
| | | * 2、ID :ID |
| | | * 3、val:对用的值 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultBody updateEnabled(Map<String, Object> params) { |
| | | int type = MapUtils.getInteger(params,"type"); |
| | | int val = MapUtils.getInteger(params,"objVal"); |
| | | long id = MapUtils.getLong(params,"objId"); |
| | | |
| | | HospitalScreening hospitalScreening = baseMapper.selectById(id); |
| | | |
| | | if(hospitalScreening == null){ |
| | | return ResultBody.failed("医院数据不存在!"); |
| | | } |
| | | |
| | | switch (type){ |
| | | case 0: |
| | | hospitalScreening.setIsScreeningPush(val); |
| | | break; |
| | | case 1: |
| | | hospitalScreening.setEnabled(val); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | int count = baseMapper.updateById(hospitalScreening); |
| | | |
| | | return count > 0 ? ResultBody.ok().msg("更新成功") : ResultBody.failed("更新失败"); |
| | | } |
| | | |
| | | /** |
| | | * 根据医院名称模糊查询医院数据列表 |
| | | * @param hospitalName |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultBody<HospitalScreening> findByName(String hospitalName) { |
| | | return ResultBody.ok().data(baseMapper.findByName(hospitalName)).msg("查询成功"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.kidgrow.oprationcenter.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | import com.kidgrow.oprationcenter.mapper.ScreeningOrganizationInfoMapper; |
| | | import com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo; |
| | | import com.kidgrow.oprationcenter.service.IScreeningOrganizationInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * @Description: 筛查机构信息表<br> |
| | | * @Project: 用户中心<br> |
| | | * @CreateDate: Created in 2020-10-12 17:10:31 <br> |
| | | * @Author: <a href="78125310@kidgrow.com">dougang</a> |
| | | * @version 1.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ScreeningOrganizationInfoServiceImpl extends SuperServiceImpl<ScreeningOrganizationInfoMapper, ScreeningOrganizationInfo> implements IScreeningOrganizationInfoService { |
| | | /** |
| | | * 列表 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageResult<ScreeningOrganizationInfo> findList(Map<String, Object> params){ |
| | | Page<ScreeningOrganizationInfo> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); |
| | | List<ScreeningOrganizationInfo> list = baseMapper.findList(page, params); |
| | | return PageResult.<ScreeningOrganizationInfo>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | |
| | | /** |
| | | * 根据OrganizationInfo对象当做查询条件进行查询 |
| | | * @param organizationInfo |
| | | * @return OrganizationInfo |
| | | */ |
| | | @Override |
| | | public ScreeningOrganizationInfo findByObject(ScreeningOrganizationInfo organizationInfo){ |
| | | return baseMapper.findByObject(organizationInfo); |
| | | } |
| | | |
| | | } |
| | |
| | | <if test="p.isDel != null and p.isDel !=''"> |
| | | and is_del = #{p.isDel} |
| | | </if> |
| | | <if test="p.tenantId != null and p.tenantId !=''"> |
| | | and tenant_id = #{p.tenantId} |
| | | </if> |
| | | <if test="p.enabled != null and p.enabled !=''"> |
| | | and enabled = #{p.enabled} |
| | | </if> |
| | |
| | | </if> |
| | | <if test="p.updateUserName != null and p.updateUserName !=''"> |
| | | and update_user_name = #{p.updateUserName} |
| | | </if> |
| | | <if test="p.isScreeningPush != null and p.isScreeningPush !=''"> |
| | | and is_screening_push = #{p.isScreeningPush} |
| | | </if> |
| | | <if test="p.pushTitle != null and p.pushTitle !=''"> |
| | | and push_title = #{p.pushTitle} |
| | | </if> |
| | | <if test="p.pushDescription != null and p.pushDescription !=''"> |
| | | and push_description = #{p.pushDescription} |
| | | </if> |
| | | <if test="p.pushBackImage != null and p.pushBackImage !=''"> |
| | | and push_back_image = #{p.pushBackImage} |
| | | </if> |
| | | <if test="p.homePage != null and p.homePage !=''"> |
| | | and home_page = #{p.homePage} |
| | | </if> |
| | | </where> |
| | | </sql> |
| | |
| | | <include refid="where"/> |
| | | order by id desc |
| | | </select> |
| | | |
| | | <select id="findByName" resultType="com.kidgrow.oprationcenter.model.HospitalScreening"> |
| | | select id, |
| | | hospital_name |
| | | from hospital_screening |
| | | where is_del=0 and enabled=1 and hospital_name LIKE concat('%',#{hospitalName},'%') |
| | | order by hospital_name desc,id desc |
| | | </select> |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <!--筛查机构信息表--> |
| | | <mapper namespace="com.kidgrow.oprationcenter.mapper.ScreeningOrganizationInfoMapper"> |
| | | <!--定义查询列--> |
| | | <sql id="Column_List"> |
| | | |
| | | * |
| | | |
| | | </sql> |
| | | |
| | | <!--sql查询片段--> |
| | | <sql id="where"> |
| | | <where> |
| | | <!--查询条件自行添加--> |
| | | <if test="p.id != null and p.id != ''"> |
| | | and id = #{p.id} |
| | | </if> |
| | | <if test="p.province != null and p.province != ''"> |
| | | and province = #{p.province} |
| | | </if> |
| | | <if test="p.city != null and p.city != ''"> |
| | | and city = #{p.city} |
| | | </if> |
| | | <if test="p.area != null and p.area != ''"> |
| | | and area = #{p.area} |
| | | </if> |
| | | <if test="p.organizationName != null and p.organizationName != ''"> |
| | | and organization_name = #{p.organizationName} |
| | | </if> |
| | | <if test="p.contactName != null and p.contactName != ''"> |
| | | and contact_name = #{p.contactName} |
| | | </if> |
| | | <if test="p.contactNumber != null and p.contactNumber != ''"> |
| | | and contact_number = #{p.contactNumber} |
| | | </if> |
| | | <if test="p.sourceHospitalId != null and p.sourceHospitalId != ''"> |
| | | and source_hospital_id = #{p.sourceHospitalId} |
| | | </if> |
| | | <if test="p.sourceHospitalName != null and p.sourceHospitalName != ''"> |
| | | and source_hospital_name = #{p.sourceHospitalName} |
| | | </if> |
| | | <if test="p.remarks != null and p.remarks != ''"> |
| | | and remarks = #{p.remarks} |
| | | </if> |
| | | <if test="p.createTime != null and p.createTime != ''"> |
| | | and create_time = #{p.createTime} |
| | | </if> |
| | | <if test="p.abbreviation != null and p.abbreviation != ''"> |
| | | and abbreviation = #{p.abbreviation} |
| | | </if> |
| | | <if test="p.qrCode != null and p.qrCode != ''"> |
| | | and qr_code = #{p.qrCode} |
| | | </if> |
| | | <if test="p.community != null and p.community != ''"> |
| | | and community = #{p.community} |
| | | </if> |
| | | <if test="p.organizationNo != null and p.organizationNo != ''"> |
| | | and organization_no = #{p.organizationNo} |
| | | </if> |
| | | <if test="p.createUserId != null and p.createUserId != ''"> |
| | | and create_user_id = #{p.createUserId} |
| | | </if> |
| | | <if test="p.updateTime != null and p.updateTime != ''"> |
| | | and update_time = #{p.updateTime} |
| | | </if> |
| | | <if test="p.updateUserId != null and p.updateUserId != ''"> |
| | | and update_user_id = #{p.updateUserId} |
| | | </if> |
| | | <if test="p.areaCode != null and p.areaCode != ''"> |
| | | and area_code = #{p.areaCode} |
| | | </if> |
| | | <if test="p.parentId != null and p.parentId != ''"> |
| | | and parent_id = #{p.parentId} |
| | | </if> |
| | | <if test="p.orgLevel != null and p.orgLevel != ''"> |
| | | and org_level = #{p.orgLevel} |
| | | </if> |
| | | </where> |
| | | </sql> |
| | | |
| | | <!--定义根据-OrganizationInfo当作查询条件返回对象--> |
| | | <select id="findByObject" resultType="com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo"> |
| | | select |
| | | <include refid="Column_List"/> |
| | | from screening_organization_info |
| | | <include refid="where"/> |
| | | order by id desc |
| | | limit 1 |
| | | |
| | | </select> |
| | | |
| | | <!--定义根据-OrganizationInfo当作查询条件返回对象集合--> |
| | | <select id="findList" resultType="com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo"> |
| | | select |
| | | <include refid="Column_List"/> |
| | | from screening_organization_info |
| | | <include refid="where"/> |
| | | order by id desc |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.kidgrow.oprationcenter.controller; |
| | | |
| | | import java.util.Map; |
| | | import com.kidgrow.common.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | import com.kidgrow.oprationcenter.service.IHospitalScreeningService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import com.kidgrow.oprationcenter.model.HospitalScreening; |
| | | import com.kidgrow.oprationcenter.service.IHospitalScreeningService; |
| | | import com.kidgrow.common.model.*; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | |
| | | /** |
| | |
| | | @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer") |
| | | }) |
| | | @GetMapping |
| | | public ResultBody<PageResult> list(@RequestParam Map<String, Object> params) { |
| | | public PageResult<HospitalScreening> list(@RequestParam Map<String, Object> params) { |
| | | if(params.size()==0){ |
| | | params.put("page",1); |
| | | params.put("limit",10); |
| | | } |
| | | return ResultBody.ok().data(hospitalScreeningService.findList(params)); |
| | | return hospitalScreeningService.findList(params); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | if(hospitalScreening.getId() == null){ |
| | | HospitalScreening hs = new HospitalScreening(); |
| | | hs.setHospitalId(hospitalScreening.getHospitalId()); |
| | | HospitalScreening byObject = hospitalScreeningService.findByObject(hs); |
| | | if(byObject != null){ |
| | | return ResultBody.failed().msg("该医院已添加"); |
| | | } |
| | | } |
| | | boolean v= hospitalScreeningService.saveOrUpdate(hospitalScreening); |
| | | if(v) { |
| | | return ResultBody.ok().data(hospitalScreening).msg("保存成功"); |
| | |
| | | return ResultBody.failed().msg("删除失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "修改反馈数据状态") |
| | | @GetMapping("/updateEnabled") |
| | | public ResultBody updateEnabled(@RequestParam Map<String, Object> params) { |
| | | if (params.size() == 0) { |
| | | return ResultBody.failed().msg("参数异常!"); |
| | | } |
| | | return hospitalScreeningService.updateEnabled(params); |
| | | } |
| | | |
| | | /** |
| | | * 查询 |
| | | */ |
| | | @ApiOperation(value = "查询") |
| | | @GetMapping("/findByName") |
| | | public ResultBody findByName(@RequestParam String hospitalName) { |
| | | if (!hospitalName.isEmpty()) { |
| | | return ResultBody.ok().data(hospitalScreeningService.findByName(hospitalName).getData()).msg("查询成功"); |
| | | } else { |
| | | return ResultBody.ok().data(null).msg(""); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.kidgrow.oprationcenter.controller; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.kidgrow.common.controller.BaseController; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.utils.QRCodeUtil; |
| | | import com.kidgrow.oprationcenter.model.ScreeningOrganizationInfo; |
| | | import com.kidgrow.oprationcenter.service.IScreeningOrganizationInfoService; |
| | | import com.kidgrow.redis.util.RedisUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import sun.misc.BASE64Decoder; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * |
| | | * @Description: 筛查机构信息表 |
| | | * @Project: 用户中心 |
| | | * @CreateDate: Created in 2020-10-12 17:10:31 <br> |
| | | * @Author: <a href="78125310@kidgrow.com">dougang</a> |
| | | * @version: 1.0 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/screeningorganizationinfo") |
| | | @Api(tags = "筛查机构信息表") |
| | | public class ScreeningOrganizationInfoController extends BaseController { |
| | | @Autowired |
| | | private IScreeningOrganizationInfoService organizationInfoService; |
| | | |
| | | @Autowired |
| | | private RedisUtils redisUtils; |
| | | |
| | | private final String URL = "url"; |
| | | |
| | | /** |
| | | * 列表 |
| | | */ |
| | | @ApiOperation(value = "查询列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "分页起始位置", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "limit", value = "分页结束位置", required = true, dataType = "Integer") |
| | | }) |
| | | @GetMapping |
| | | public PageResult<ScreeningOrganizationInfo> list(@RequestParam Map<String, Object> params) { |
| | | if (params.size() == 0) { |
| | | params.put("page", 1); |
| | | params.put("limit", 10); |
| | | } |
| | | return organizationInfoService.findList(params); |
| | | } |
| | | |
| | | /** |
| | | * 查询 |
| | | */ |
| | | @ApiOperation(value = "查询") |
| | | @GetMapping("/{organizationId}") |
| | | public ResultBody findById(@PathVariable String organizationId) { |
| | | ScreeningOrganizationInfo model = organizationInfoService.getById(organizationId); |
| | | return ResultBody.ok().data(model).msg("查询成功"); |
| | | } |
| | | |
| | | /** |
| | | * 根据OrganizationInfo当做查询条件进行查询 |
| | | */ |
| | | @ApiOperation(value = "根据OrganizationInfo当做查询条件进行查询") |
| | | @PostMapping("/query") |
| | | public ResultBody findByObject(@RequestBody ScreeningOrganizationInfo organizationInfo) { |
| | | ScreeningOrganizationInfo model = organizationInfoService.findByObject(organizationInfo); |
| | | return ResultBody.ok().data(model).msg("查询成功"); |
| | | } |
| | | |
| | | /** |
| | | * 新增or更新 |
| | | */ |
| | | @ApiOperation(value = "保存") |
| | | @PostMapping |
| | | public ResultBody save(@Valid @RequestBody ScreeningOrganizationInfo organizationInfo, BindingResult bindingResult) { |
| | | List<String> errMsg = new ArrayList<>(); |
| | | if (bindingResult.hasErrors()) { |
| | | for (ObjectError error : bindingResult.getAllErrors()) { |
| | | errMsg.add(error.getDefaultMessage()); |
| | | } |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | if (organizationInfo.getId() == null) { |
| | | //新增机构增加关注二维码 |
| | | String url = createQr(String.valueOf(organizationInfo.getId())); |
| | | if (StringUtils.isNotBlank(url)) { |
| | | organizationInfo.setQrCode(url); |
| | | } |
| | | } |
| | | boolean v = organizationInfoService.saveOrUpdate(organizationInfo); |
| | | if (v) { |
| | | return ResultBody.ok().data(organizationInfo).msg("保存成功"); |
| | | } else { |
| | | return ResultBody.failed().msg("保存失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String createQr(String id) { |
| | | String url = ""; |
| | | String str = "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"kagscreening_\" " + id + "}}}"; |
| | | |
| | | String token = redisUtils.get("Wechat:Token:KagReceiveToken").toString(); |
| | | String result = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + token) |
| | | .header("Content-Type", "application/json") |
| | | .body(str).execute().body(); |
| | | |
| | | |
| | | if (StringUtils.isBlank(result)) { |
| | | return url; |
| | | } |
| | | |
| | | JSONObject strJson = JSONObject.parseObject(result); |
| | | if (strJson.containsKey(URL)) { |
| | | url = strJson.getString("url"); |
| | | } |
| | | |
| | | return url; |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @ApiOperation(value = "删除") |
| | | @DeleteMapping("/{id}") |
| | | public ResultBody delete(@PathVariable String organizationId) { |
| | | boolean v = organizationInfoService.removeById(organizationId); |
| | | if (v) { |
| | | return ResultBody.ok().msg("删除成功"); |
| | | } else { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载二维码 |
| | | */ |
| | | @ApiOperation(value = "下载二维码") |
| | | @PostMapping("/downLoad") |
| | | public void downLoad(@RequestBody Map<String, Object> param, HttpServletResponse response) { |
| | | OutputStream out = null; |
| | | InputStream fileInputStream = null; |
| | | try { |
| | | String base64Str = QRCodeUtil.creatRrCode(MapUtils.getString(param, "url"), 258, 258, 3); |
| | | String fileName = MapUtils.getString(param, "no") + ".png"; |
| | | |
| | | BASE64Decoder dencoder = new BASE64Decoder(); |
| | | byte[] arr = dencoder.decodeBuffer(base64Str.split(",")[1]); |
| | | |
| | | // 设置输出的格式 |
| | | response.reset(); |
| | | response.setContentType("application/x-msdownload"); |
| | | response.addHeader("Content-Length", "" + arr.length); |
| | | response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); |
| | | |
| | | out = response.getOutputStream(); |
| | | fileInputStream = new ByteArrayInputStream(arr); |
| | | int len = 0; |
| | | byte[] by = new byte[1024*10]; |
| | | while ((len = fileInputStream.read(by))>0){ |
| | | out.write(by,0,len); |
| | | } |
| | | |
| | | }catch (Exception w){ |
| | | log.error("",w); |
| | | }finally { |
| | | try { |
| | | out.close(); |
| | | fileInputStream.close(); |
| | | }catch(Exception w){ |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | - saas_client_pay |
| | | - pay_manager |
| | | - equipment_docking |
| | | - hospital_screening |
| | | - screening_organization_info |
| | | ignoreSqls: |
| | | - com.kidgrow.usercenter.mapper.SysRoleMapper.findAll |
| | | - com.kidgrow.oprationcenter.mapper.ConsumptionRecordMapper.findDetailList |
New file |
| | |
| | | <div class="layui-card"> |
| | | <div class="layui-card-header"> |
| | | <h2 class="header-title">筛查医院管理</h2> |
| | | <span class="layui-breadcrumb pull-right"> |
| | | <a href="#!home_console">首页</a> |
| | | <a><cite>筛查医院管理</cite></a> |
| | | </span> |
| | | </div> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline" style="margin-bottom: -25px;"> |
| | | <select id="enabled" lay-filter="role_clients"> |
| | | <option value="">医院状态</option> |
| | | <option value="1">启用</option> |
| | | <option value="0">停用</option> |
| | | </select> |
| | | <select id="isScreeningPush" lay-filter="role_clients"> |
| | | <option value="">推送状态</option> |
| | | <option value="1">是</option> |
| | | <option value="0">否</option> |
| | | </select> |
| | | <input name="hospitalName" id="hospitalName-seach" placeholder="按医院名称" type="text" |
| | | class="layui-input search-input" maxlength="50" autocomplete="off"/>  |
| | | </div> |
| | | <button id="app-btn-search" class="layui-btn icon-btn" layt="abc"><i class="layui-icon"></i>搜索 |
| | | </button> |
| | | <button id="screeningHospital-btn-add" class="layui-btn icon-btn"><i class="layui-icon"></i>添加筛查医院 |
| | | </button> |
| | | <!-- 数据表格 --> |
| | | <table class="layui-table" id="app-table" lay-filter="app-table"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <input id="hospitalId" type="hidden"/> |
| | | <!-- 表格操作列 --> |
| | | |
| | | <script type="text/html" id="doctor-table-bar"> |
| | | <button class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改 |
| | | </button> |
| | | <button class="layui-btn layui-btn-xs" lay-event="downLoad"> |
| | | 下载二维码 |
| | | </button> |
| | | </script> |
| | | |
| | | <script type="text/html" id="hospital-push-state"> |
| | | <input type="checkbox" lay-filter="hospital-push-state" value="{{d.id}}" |
| | | lay-skin="switch" lay-text="是|否" {{d.isScreeningPush==1?'checked':''}}/> |
| | | </script> |
| | | |
| | | <script type="text/html" id="hospital-state"> |
| | | <input type="checkbox" lay-filter="hospital-state" value="{{d.id}}" |
| | | lay-skin="switch" lay-text="正常|停用" {{d.enabled==1?'checked':''}}/> |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['form', 'table', 'laydate', 'util', 'config', 'upload', 'admin', 'autocomplete', 'formSelects'], |
| | | function () { |
| | | var form = layui.form; |
| | | var table = layui.table; |
| | | var config = layui.config; |
| | | var layer = layui.layer; |
| | | var util = layui.util; |
| | | var admin = layui.admin; |
| | | var autocomplete = layui.autocomplete; |
| | | var formSelects = layui.formSelects; |
| | | var $ = layui.jquery; |
| | | |
| | | //自动完成-医院名称 |
| | | autocomplete.render({ |
| | | elem: $('#hospitalName-seach')[0], |
| | | keywordsName: 'hospitalName', //查询关键字名称 |
| | | url: config.base_server + 'api-opration/hospitalscreening/findByName', |
| | | template_val: '{{d.hospitalName}}', //选择后文本框显示的数据字段 |
| | | template_txt: "<div class='layui-table-cell'>{{d.hospitalName}}</div>", //下拉列表模板 |
| | | onselect: function (resp) { |
| | | $("#hospitalId").val(resp.id); |
| | | } |
| | | }); |
| | | |
| | | // 渲染表格 |
| | | table.render({ |
| | | elem: '#app-table', |
| | | url: config.base_server + 'api-opration/hospitalscreening', |
| | | method: 'GET', |
| | | headers: { |
| | | 'Authorization': 'Bearer ' + config.getToken().access_token |
| | | }, |
| | | page: true, |
| | | cols: [ |
| | | [{ |
| | | field: 'hospitalId', |
| | | width: "150", |
| | | title: '医院ID', |
| | | fixed: 'left' |
| | | }, { |
| | | field: 'hospitalName', |
| | | width: "200", |
| | | title: '医院名称', |
| | | fixed: 'left' |
| | | }, |
| | | { |
| | | field: 'isScreeningPush', |
| | | width: "120", |
| | | title: '推送状态', |
| | | align: 'center', |
| | | fixed: 'left', |
| | | templet: '#hospital-push-state' |
| | | }, |
| | | { |
| | | field: 'enabled', |
| | | width: "100", |
| | | title: '状态', |
| | | align: 'center', |
| | | fixed: 'left', |
| | | templet: '#hospital-state' |
| | | }, |
| | | { |
| | | field: 'createTime', |
| | | width: "150", |
| | | sort: true, |
| | | align: 'center', |
| | | title: '创建时间', |
| | | templet: "<div>{{layui.util.toDateString(d.createTime, 'yyyy/MM/dd HH:mm')}}</div>" |
| | | }, |
| | | { |
| | | width: "300", |
| | | align: 'center', |
| | | toolbar: '#doctor-table-bar', |
| | | title: '操作', |
| | | fixed: 'right' |
| | | } |
| | | ] |
| | | ], |
| | | done: function (res, curr, count) { |
| | | permissionsInput(res, config); |
| | | } |
| | | }); |
| | | |
| | | // 修改状态 |
| | | form.on('switch(hospital-push-state)', function (obj) { |
| | | layer.load(2); |
| | | admin.req('api-opration/hospitalscreening/updateEnabled', { |
| | | objId: obj.elem.value, |
| | | objVal: obj.elem.checked ? 1 : 0, |
| | | type: 0 |
| | | }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.msg(data.msg, { |
| | | icon: 1, |
| | | time: 2000 |
| | | }); |
| | | } else { |
| | | layer.msg(data.msg, { |
| | | icon: 2, |
| | | time: 2000 |
| | | }); |
| | | $(obj.elem).prop('checked', !obj.elem.checked); |
| | | form.render('checkbox'); |
| | | } |
| | | }, 'GET'); |
| | | }); |
| | | |
| | | // 修改状态 |
| | | form.on('switch(hospital-state)', function (obj) { |
| | | layer.load(2); |
| | | admin.req('api-opration/hospitalscreening/updateEnabled', { |
| | | objId: obj.elem.value, |
| | | objVal: obj.elem.checked ? 1 : 0, |
| | | type: 1 |
| | | }, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.msg(data.msg, { |
| | | icon: 1, |
| | | time: 2000 |
| | | }); |
| | | } else { |
| | | layer.msg(data.msg, { |
| | | icon: 2, |
| | | time: 2000 |
| | | }); |
| | | $(obj.elem).prop('checked', !obj.elem.checked); |
| | | form.render('checkbox'); |
| | | } |
| | | }, 'GET'); |
| | | }); |
| | | |
| | | // 搜索按钮点击事件 |
| | | $('#app-btn-search').click(function () { |
| | | var enabled = $('#enabled').val(); |
| | | var isScreeningPush = $("#isScreeningPush").val(); |
| | | var hospitalName = $('#hospitalName-seach').val(); |
| | | table.reload('app-table', { |
| | | where: { |
| | | enabled: enabled, |
| | | hospitalName: hospitalName, |
| | | isScreeningPush: isScreeningPush, |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 添加按钮点击事件 |
| | | $('#screeningHospital-btn-add').click(function () { |
| | | showEditModel_add("添加"); |
| | | }); |
| | | |
| | | var showEditModel_add = function (title, data) { |
| | | admin.putTempData('t_screeningHospital', data); |
| | | admin.popupCenter({ |
| | | title: title, |
| | | path: 'pages/keaigao/screeningHospital_form.html', |
| | | area: '600px', |
| | | offset: '0px', |
| | | finish: function () { |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // 工具条点击事件 |
| | | table.on('tool(app-table)', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | if (layEvent === 'downLoad') { |
| | | // 下载二维码 |
| | | downLoad(data.hospitalQrImage); |
| | | } else if (layEvent === 'edit') { |
| | | showEditModel_add("编辑", data); |
| | | } |
| | | }); |
| | | |
| | | function downLoad(url) { |
| | | window.open(url); |
| | | } |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <form id="app-form-add" lay-filter="app-form-add" class="layui-form model-form"> |
| | | <input name="id" type="hidden"/> |
| | | <div style="display:flex"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 75px;">所在医院</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <input name="hospitalName" id="hospitalName" placeholder="请输入医院名称" type="text" class="layui-input" |
| | | maxlength="50" lay-verify="required" required style="width: 150px;"/> |
| | | <input type="hidden" name="hospitalId" id="hospitalId"/> |
| | | <input type="hidden" name="id" id="id"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 67px;">推送筛查</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <input name="isScreeningPush" id="isScreeningPush_yes" type="radio" value="1" title="是" |
| | | class="layui-input"/> |
| | | <input name="isScreeningPush" id="isScreeningPush_no" type="radio" checked value="0" title="否" |
| | | class="layui-input"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div style="display:flex"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">推送标题</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <textarea name="pushTitle" id="pushTitle" placeholder="请输入推送标题" lay-verify="required" required class="layui-textarea" |
| | | style="width:99%;height:100px"></textarea> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 68px;">推送描述</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <textarea name="pushDescription" id="pushDescription" lay-verify="required" required placeholder="请输入推送描述" class="layui-textarea" |
| | | style="width:99%;height:100px"></textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div style="display:flex"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label">上传二维码</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <button type="button" class="layui-btn" id="qr"> |
| | | <i class="layui-icon"></i>上传图片 |
| | | </button> |
| | | <input name="hospitalQrImage" id="hospitalQrImage" type="hidden" class="layui-input" maxlength="20"/> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | 预览效果 |
| | | <div class="layui-upload-list" id="qrImage"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 85px;">微站首页图片</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <button type="button" class="layui-btn" id="phonto"> |
| | | <i class="layui-icon"></i>上传图片 |
| | | </button> |
| | | <input name="homePage" id="homePage" type="hidden" class="layui-input" maxlength="20"/> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | 预览效果 |
| | | <div class="layui-upload-list" id="indexImage"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item model-form-footer"> |
| | | <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button> |
| | | <button class="layui-btn" id="sure" lay-filter="screeningHospital-form-submit" |
| | | lay-submit>保存 |
| | | </button> |
| | | </div> |
| | | </form> |
| | | |
| | | <script> |
| | | layui.use(['form', 'laydate', 'util', 'config', 'admin', 'autocomplete', 'formSelects'], function () { |
| | | var form = layui.form; |
| | | var config = layui.config; |
| | | var layer = layui.layer; |
| | | var util = layui.util; |
| | | var admin = layui.admin; |
| | | var upload = layui.upload; |
| | | var autocomplete = layui.autocomplete; |
| | | var formSelects = layui.formSelects; |
| | | var $ = layui.jquery; |
| | | |
| | | form.render(); |
| | | |
| | | // 表单提交事件 |
| | | form.on('submit(screeningHospital-form-submit)', function (data) { |
| | | data.field.hospitalId = $("#hospitalId").val(); |
| | | data.field.hospitalName = $("#hospitalName").val(); |
| | | data.field.pushTitle = $("#pushTitle").val(); |
| | | data.field.pushDescription = $("#pushDescription").val(); |
| | | data.field.enabled = "1"; |
| | | |
| | | layer.load(2); |
| | | admin.req('api-opration/hospitalscreening', JSON.stringify(data.field), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.closeAll(); |
| | | parent.layui.table.reload('app-table', {}); |
| | | } else { |
| | | layer.msg(data.msg, { |
| | | icon: 2, |
| | | time: 3000 |
| | | }); |
| | | } |
| | | }, "POST"); |
| | | return false; |
| | | }); |
| | | |
| | | //自动完成-医院名称 |
| | | autocomplete.render({ |
| | | elem: $('#hospitalName')[0], |
| | | keywordsName: 'hospitalName', //查询关键字名称 |
| | | url: config.base_server + 'api-user/syshospital/findByName', |
| | | template_val: '{{d.hospitalName}}', //选择后文本框显示的数据字段 |
| | | template_txt: "<div class='layui-table-cell'>{{d.hospitalName}}</div>", //下拉列表模板 |
| | | onselect: function (resp) { |
| | | $("#hospitalId").val(resp.id); |
| | | } |
| | | }); |
| | | //上传二维码 |
| | | upload.render({ |
| | | elem: '#qr', |
| | | url: config.base_server + 'api-file/files-anon', |
| | | accept: 'file', |
| | | auto: true, |
| | | headers: { |
| | | "Authorization": "Bearer " + config.getToken().access_token |
| | | }, |
| | | before: function (obj) { |
| | | layer.load(); //上传loading |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function (index, file, result) { |
| | | $("#qrImage").html(''); |
| | | $('#qrImage').append('<img src="' + result + |
| | | '" width="50px" height="50px" alt="' + file.name + |
| | | '" class="layui-upload-img">') |
| | | }); |
| | | }, |
| | | done: function (data) { |
| | | layer.closeAll('loading'); |
| | | $("#hospitalQrImage").val(data.url); |
| | | }, |
| | | error: function (data) { |
| | | layer.closeAll('loading'); |
| | | } |
| | | }); |
| | | //微站首页图片 |
| | | upload.render({ |
| | | elem: '#phonto', |
| | | url: config.base_server + 'api-file/files-anon', |
| | | accept: 'file', |
| | | auto: true, |
| | | headers: { |
| | | "Authorization": "Bearer " + config.getToken().access_token |
| | | }, |
| | | before: function (obj) { |
| | | layer.load(); //上传loading |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function (index, file, result) { |
| | | $("#indexImage").html(''); |
| | | $('#indexImage').append('<img src="' + result + |
| | | '" width="50px" height="50px" alt="' + file.name + |
| | | '" class="layui-upload-img">') |
| | | }); |
| | | }, |
| | | done: function (data) { |
| | | layer.closeAll('loading'); |
| | | $("#homePage").val(data.url); |
| | | }, |
| | | error: function (data) { |
| | | layer.closeAll('loading'); |
| | | } |
| | | }); |
| | | |
| | | var screeningHospital = admin.getTempData('t_screeningHospital'); |
| | | if(screeningHospital){ |
| | | $("#hospitalName").val(screeningHospital.hospitalName); |
| | | $("#hospitalId").val(screeningHospital.hospitalId); |
| | | $("#id").val(screeningHospital.id); |
| | | $("#pushTitle").val(screeningHospital.pushTitle); |
| | | $("#pushDescription").val(screeningHospital.pushDescription); |
| | | |
| | | if (screeningHospital.isScreeningPush == 1) { |
| | | $("#isScreeningPush_yes").prop("checked", true) |
| | | } else { |
| | | $('#isScreeningPush_no').prop("checked", true) |
| | | } |
| | | |
| | | $("#hospitalQrImage").val(screeningHospital.hospitalQrImage); |
| | | $('#qrImage').append('<img src="' + screeningHospital.hospitalQrImage + |
| | | '" width="50px" height="50px" class="layui-upload-img">'); |
| | | |
| | | $("#homePage").val(screeningHospital.homePage); |
| | | $('#indexImage').append('<img src="' + screeningHospital.homePage + |
| | | '" width="50px" height="50px" class="layui-upload-img">'); |
| | | |
| | | form.render(); |
| | | } |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-card"> |
| | | <div class="layui-card-header"> |
| | | <h2 class="header-title">筛查机构管理</h2> |
| | | <span class="layui-breadcrumb pull-right"> |
| | | <a href="#!home_console">首页</a> |
| | | <a><cite>筛查机构管理</cite></a> |
| | | </span> |
| | | </div> |
| | | <div class="layui-card-body"> |
| | | <div class="layui-form toolbar"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <select id="province" placeholder="省份" lay-filter="province"> |
| | | </select> |
| | | <select id="city" placeholder="市" lay-filter="city"> |
| | | <option value="">选择市</option> |
| | | </select> |
| | | <select id="areas" placeholder="区县" lay-filter="areas"> |
| | | <option value="">选择区县</option> |
| | | </select> |
| | | <input name="hospitalName" id="hospitalName-seach" placeholder="按机构名称" type="text" |
| | | class="layui-input search-input" maxlength="50" autocomplete="off"/>  |
| | | </div> |
| | | <button id="app-btn-search" class="layui-btn icon-btn" layt="abc"><i class="layui-icon"></i>搜索 |
| | | </button> |
| | | <button id="screeningOrganization-btn-add" class="layui-btn icon-btn"><i class="layui-icon"></i>添加筛查机构 |
| | | </button> |
| | | <table class="layui-table" id="app-table" lay-filter="app-table"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <input id="hospitalId" type="hidden"/> |
| | | <!-- 表格操作列 --> |
| | | |
| | | <script type="text/html" id="doctor-table-bar"> |
| | | <button class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改 |
| | | </button> |
| | | <button class="layui-btn layui-btn-xs" lay-event="downLoad"> |
| | | 下载二维码 |
| | | </button> |
| | | </script> |
| | | |
| | | <script> |
| | | layui.use(['form', 'table', 'laydate', 'util', 'config', 'upload', 'admin', 'autocomplete', 'formSelects','area'], |
| | | function () { |
| | | var form = layui.form; |
| | | var table = layui.table; |
| | | var config = layui.config; |
| | | var admin = layui.admin; |
| | | var $ = layui.jquery; |
| | | var area = layui.area; |
| | | |
| | | //省份数据加载 |
| | | area.areaData("#province", 1, "", ""); |
| | | |
| | | //装载市区数据 |
| | | form.on("select(province)", function (data) { |
| | | area.areasClear("#areas", 3); |
| | | area.areaData("#city", 2, data.value, ""); |
| | | }); |
| | | |
| | | //装载区县数据 |
| | | form.on("select(city)", function (data) { |
| | | area.areaData("#areas", 3, data.value, ""); |
| | | }); |
| | | |
| | | // 渲染表格 |
| | | table.render({ |
| | | elem: '#app-table', |
| | | url: config.base_server + 'api-opration/screeningorganizationinfo', |
| | | method: 'GET', |
| | | headers: { |
| | | 'Authorization': 'Bearer ' + config.getToken().access_token |
| | | }, |
| | | page: true, |
| | | cols: [ |
| | | [{ |
| | | field: 'organizationNo', |
| | | width: "100", |
| | | title: '机构编码', |
| | | fixed: 'left', |
| | | },{ |
| | | field: 'organizationName', |
| | | width: "150", |
| | | title: '机构名称', |
| | | align: 'center', |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | field: 'abbreviation', |
| | | width: "150", |
| | | title: '机构简称', |
| | | align: 'center', |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | field: 'sourceHospitalName', |
| | | width: "150", |
| | | align: 'center', |
| | | title: '所属医院', |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | field: 'areaCode', |
| | | width: "200", |
| | | align: 'center', |
| | | title: '所属区域', |
| | | fixed: 'left', |
| | | }, |
| | | { |
| | | field: 'contactName', |
| | | width: "150", |
| | | sort: true, |
| | | align: 'center', |
| | | title: '联系人', |
| | | }, |
| | | { |
| | | field: 'contactNumber', |
| | | width: "150", |
| | | sort: true, |
| | | align: 'center', |
| | | title: '联系电话', |
| | | }, |
| | | { |
| | | field: 'remarks', |
| | | width: "250", |
| | | sort: true, |
| | | align: 'center', |
| | | title: '说明', |
| | | }, |
| | | { |
| | | width: "200", |
| | | align: 'center', |
| | | toolbar: '#doctor-table-bar', |
| | | title: '操作', |
| | | fixed: 'right' |
| | | } |
| | | ] |
| | | ], |
| | | done: function (res, curr, count) { |
| | | permissionsInput(res, config); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // 搜索按钮点击事件 |
| | | $('#app-btn-search').click(function () { |
| | | var province = $('#province').val(); |
| | | var city = $("#city").val(); |
| | | var area = $('#areas').val(); |
| | | var sourceHospitalName = $('#hospitalName-seach').val(); |
| | | table.reload('app-table', { |
| | | where: { |
| | | province: province, |
| | | city: city, |
| | | area: area, |
| | | sourceHospitalName:sourceHospitalName |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | // 添加按钮点击事件 |
| | | $('#screeningOrganization-btn-add').click(function () { |
| | | showEditModel_add("添加"); |
| | | }); |
| | | |
| | | var showEditModel_add = function (title, data) { |
| | | admin.putTempData('t_screeningOrganization', data); |
| | | admin.popupCenter({ |
| | | title: title, |
| | | path: 'pages/keaigao/screeningOrganization_form.html', |
| | | area: '600px', |
| | | offset: '0px', |
| | | finish: function () { |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // 工具条点击事件 |
| | | table.on('tool(app-table)', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | if (layEvent === 'downLoad') { |
| | | var url = config.base_server + "api-opration/screeningorganizationinfo/downLoad"; |
| | | // 下载二维码 |
| | | // 获取XMLHttpRequest |
| | | var xmlResquest = new XMLHttpRequest(); |
| | | // 发起请求 |
| | | xmlResquest.open("POST", url, true); |
| | | // 设置请求头类型 |
| | | xmlResquest.setRequestHeader("Content-type", "application/json"); |
| | | xmlResquest.setRequestHeader("Authorization","Bearer " + config.getToken().access_token); |
| | | xmlResquest.responseType = "blob"; |
| | | var data = JSON.stringify({"url": data.qrCode,"no":data.organizationNo}); |
| | | |
| | | // 返回 |
| | | xmlResquest.onload = function() { |
| | | if (this.status == 200) { |
| | | var fileName = "002.png"; |
| | | var blob = this.response; |
| | | var a = document.createElement('a'); |
| | | a.innerHTML = fileName; |
| | | // 指定生成的文件名 |
| | | a.download = fileName; |
| | | a.href = URL.createObjectURL(blob); |
| | | document.body.appendChild(a); |
| | | var evt = document.createEvent("MouseEvents"); |
| | | evt.initEvent("click", false, false); |
| | | a.dispatchEvent(evt); |
| | | document.body.removeChild(a); |
| | | } |
| | | }; |
| | | xmlResquest.send(data); |
| | | |
| | | } else if (layEvent === 'edit') { |
| | | showEditModel_add("编辑", data); |
| | | } |
| | | }); |
| | | |
| | | function downLoad(url) { |
| | | window.open(url); |
| | | } |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <form id="app-form-add" lay-filter="app-form-add" class="layui-form model-form"> |
| | | <input name="id" type="hidden"/> |
| | | <div style="display:flex"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 75px;">所在医院</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <input name="sourceHospitalName" id="sourceHospitalName" placeholder="请输入医院名称" type="text" class="layui-input" |
| | | maxlength="50" lay-verify="required" required style="width: 150px;"/> |
| | | <input type="hidden" name="sourceHospitalId" id="sourceHospitalId"/> |
| | | <input type="hidden" name="id" id="id"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 67px;">机构编码</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <input name="organizationNo" id="organizationNo" placeholder="请输入机构编码" type="text" class="layui-input" |
| | | maxlength="10" lay-verify="required" required style="width: 150px;"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div style="display:flex"> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label" style="width: 75px;">所在区域</label> |
| | | <div class="layui-inline" style="width: 134px;"> |
| | | <select lay-verify="required" required id="OrganizationProvince" placeholder="省份" |
| | | lay-filter="OrganizationProvince" > |
| | | </select> |
| | | </div> |
| | | <div class="layui-inline" style="width: 134px;"> |
| | | <select id="OrganizationCity" lay-verify="required" required placeholder="市" lay-filter="OrganizationCity"> |
| | | <option value="">选择市</option> |
| | | </select> |
| | | </div> |
| | | <div class="layui-inline" style="width: 134px;"> |
| | | <select id="OrganizationArea" lay-verify="required" required placeholder="区县" lay-filter="OrganizationArea"> |
| | | <option value="">选择区县</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div style="display:flex"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 75px;">机构名称</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <input name="organizationName" id="organizationName" placeholder="请输入机构名称" type="text" class="layui-input" |
| | | maxlength="20" lay-verify="required" required style="width: 150px;"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 67px;">机构简称</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <input name="abbreviation" id="abbreviation" placeholder="请输入机构简称" type="text" class="layui-input" |
| | | maxlength="10" lay-verify="required" required style="width: 150px;"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div style="display:flex"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 75px;">联系人</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <input name="contactName" id="contactName" placeholder="请输入联系人" type="text" class="layui-input" |
| | | maxlength="50" lay-verify="required" required style="width: 150px;"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 67px;">联系电话</label> |
| | | <div class="layui-input-block" style="width: 150px;"> |
| | | <input name="contactNumber" id="contactNumber" placeholder="请输入联系电话" type="text" class="layui-input" |
| | | maxlength="15" lay-verify="number" required style="width: 150px;"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div style="display:flex"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" style="width: 75px;">说明</label> |
| | | <div class="layui-input-block" style="width: 430px;"> |
| | | <textarea name="remark" id="remark" lay-verify="required" required placeholder="请输入说明" class="layui-textarea" |
| | | style="width:99%;height:100px" maxlength="100"></textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item model-form-footer"> |
| | | <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button> |
| | | <button class="layui-btn" id="sure" lay-filter="screeningHospital-form-submit" |
| | | lay-submit>保存 |
| | | </button> |
| | | </div> |
| | | </form> |
| | | |
| | | <script> |
| | | layui.use(['form', 'laydate', 'util', 'config', 'admin', 'autocomplete', 'formSelects','area'], function () { |
| | | var form = layui.form; |
| | | var config = layui.config; |
| | | var layer = layui.layer; |
| | | var admin = layui.admin; |
| | | var autocomplete = layui.autocomplete; |
| | | var $ = layui.jquery; |
| | | var area = layui.area; |
| | | |
| | | form.render(); |
| | | |
| | | //省份数据加载 |
| | | area.areaData("#OrganizationProvince", 1, "", ""); |
| | | |
| | | //装载市区数据 |
| | | form.on("select(OrganizationProvince)", function (data) { |
| | | area.areasClear("#OrganizationArea", 3); |
| | | area.areaData("#OrganizationCity", 2, data.value, ""); |
| | | }); |
| | | //装载区县数据 |
| | | form.on("select(OrganizationCity)", function (data) { |
| | | area.areaData("#OrganizationArea", 3, data.value, ""); |
| | | }); |
| | | |
| | | // 表单提交事件 |
| | | form.on('submit(screeningHospital-form-submit)', function (data) { |
| | | data.field.sourceHospitalId = $("#sourceHospitalId").val(); |
| | | data.field.sourceHospitalName = $("#sourceHospitalName").val(); |
| | | data.field.province = $("#OrganizationProvince").val(); |
| | | data.field.city = $("#OrganizationCity").val(); |
| | | data.field.area = $("#OrganizationArea").val(); |
| | | |
| | | data.field.organizationName = $("#organizationName").val(); |
| | | data.field.abbreviation = $("#abbreviation").val(); |
| | | data.field.contactName = $("#contactName").val(); |
| | | data.field.contactNumber = $("#contactNumber").val(); |
| | | data.field.remarks = $("#remark").val(); |
| | | data.field.areaCode=$("#OrganizationProvince option:selected").text() + $("#OrganizationCity option:selected").text()+ |
| | | $("#OrganizationArea option:selected").text(); |
| | | |
| | | layer.load(2); |
| | | admin.req('api-opration/screeningorganizationinfo', JSON.stringify(data.field), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.closeAll(); |
| | | parent.layui.table.reload('app-table', {}); |
| | | } else { |
| | | layer.msg(data.msg, { |
| | | icon: 2, |
| | | time: 3000 |
| | | }); |
| | | } |
| | | }, "POST"); |
| | | return false; |
| | | }); |
| | | |
| | | //自动完成-医院名称 |
| | | autocomplete.render({ |
| | | elem: $('#sourceHospitalName')[0], |
| | | keywordsName: 'hospitalName', //查询关键字名称 |
| | | url: config.base_server + 'api-opration/hospitalscreening/findByName', |
| | | template_val: '{{d.hospitalName}}', //选择后文本框显示的数据字段 |
| | | template_txt: "<div class='layui-table-cell'>{{d.hospitalName}}</div>", //下拉列表模板 |
| | | onselect: function (resp) { |
| | | $("#sourceHospitalId").val(resp.id); |
| | | } |
| | | }); |
| | | |
| | | var screeningOrganization = admin.getTempData('t_screeningOrganization'); |
| | | if(screeningOrganization){ |
| | | $("#sourceHospitalName").val(screeningOrganization.sourceHospitalName); |
| | | $("#sourceHospitalId").val(screeningOrganization.sourceHospitalId); |
| | | $("#id").val(screeningOrganization.id); |
| | | $("#organizationNo").val(screeningOrganization.organizationNo); |
| | | $("#OrganizationProvince").val(screeningOrganization.province); |
| | | area.areaData("#OrganizationCity", 2, $("#OrganizationProvince").val(), screeningOrganization.city); |
| | | $("#OrganizationCity").val(screeningOrganization.city); |
| | | area.areaData("#OrganizationArea", 3, $("#OrganizationCity").val(), screeningOrganization.area); |
| | | $("#OrganizationArea").val(screeningOrganization.area); |
| | | |
| | | $("#organizationName").val(screeningOrganization.organizationName); |
| | | $("#abbreviation").val(screeningOrganization.abbreviation); |
| | | $("#contactName").val(screeningOrganization.contactName); |
| | | $("#contactNumber").val(screeningOrganization.contactNumber); |
| | | $("#remark").val(screeningOrganization.remarks); |
| | | |
| | | form.render(); |
| | | } |
| | | }); |
| | | </script> |