瀏覽代碼

验收接口
档案接口

hzp 8 年之前
父節點
當前提交
e16ef100ec

+ 4 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.health.repository;
import com.yihu.wlyy.health.entity.DevicePatientHealthIndex;
import io.swagger.models.auth.In;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -13,7 +14,9 @@ import java.util.List;
public interface DevicePatientHealthIndexDao
		extends PagingAndSortingRepository<DevicePatientHealthIndex, Long>, JpaSpecificationExecutor<DevicePatientHealthIndex> {
	
	 List<DevicePatientHealthIndex> findByIdcardAndType(String idcard,Integer type);
	/**
	 * 按录入时间和患者标识查询健康记录
	 * @param patientCode

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -79,6 +79,9 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	@Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status >= 0")
	SignFamily findByIdcard(String idcard);
	@Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status > 0 and a.expensesStatus ='1'")
	SignFamily getExpensesSignByIdcard(String idcard);
	@Query("select a from SignFamily a where a.idcard = ?1 and a.type =1 and a.status >= 0")
	SignFamily findSSByIdcard(String idcard);

+ 0 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/archives/PatientEventService.java

@ -31,8 +31,6 @@ public class PatientEventService {
    @Autowired
    private PatientEventImgDao patientEventImgDao;
    @Autowired
    private ObjectMapper objectMapper;

+ 74 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSignService.java

@ -0,0 +1,74 @@
package com.yihu.wlyy.service.third.jw;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.service.third.ehr.EhrService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by hzp on 2016/12/19.
 * 基卫签约服务
 */
@Service
public class JwSignService {
    //基卫服务地址
    private String jwUrl = SystemConf.getInstance().getJwUrl();
    /****************************************************************************************************************************/
    /**
     * 上传家庭签约记录
     */
    public String uploadSignFamily(String code) {
        String url = jwUrl + "/third/sign/UploadSignFamily";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("code", code));
        return HttpClientUtil.post(url, params, "UTF-8");
    }
    /**
     * 获取患者三师签约信息
     */
    public String getSignSanshi(String idcard) {
        String url = jwUrl + "/third/zysoftservice/getSickSanShiTeamSignInfo";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("idcard", idcard));
        return HttpClientUtil.post(url, params, "UTF-8");
    }
    /**
     * 获取患者家庭签约信息
     */
    public String getSignFamily(String idcard) {
        String url = jwUrl + "/third/zysoftservice/getSickCurrnetFamilySignInfo";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("idcard", idcard));
        return HttpClientUtil.post(url, params, "UTF-8");
    }
}

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

@ -472,7 +472,7 @@ public class WeixinBaseController extends BaseController {
	 *
	 * @return
	 */
	private InputStream getInputStream(String mediaId) {
	public InputStream getInputStream(String mediaId) {
		String accessToken = getAccessToken();
		InputStream is = null;
		String url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=" + accessToken + "&media_id=" + mediaId;

+ 20 - 29
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/archives/PatientArchivesController.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.service.app.archives.PatientEventService;
import com.yihu.wlyy.service.app.archives.PatientRecordService;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -35,7 +36,7 @@ import java.util.Map;
@Controller
@RequestMapping(value = "/patient/archives", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "患者端-健康档案服务接口")
public class PatientArchivesController extends BaseController {
public class PatientArchivesController extends WeixinBaseController {
    @Autowired
    private PatientRecordService patientRecordService;
@ -161,41 +162,31 @@ public class PatientArchivesController extends BaseController {
        }
    }
    @RequestMapping(value = "/event/uploadImg", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("上传图片")
    public String uploadImg(HttpServletRequest request, HttpServletResponse response)
    @ApiOperation("单张上传图片")
    public String uploadImg(@ApiParam(name="mediaId",value="微信图片标识",defaultValue = "")
                            @RequestParam(value="mediaId",required = true) String mediaId,
                            @ApiParam(name="fileExt",value="文件格式后缀",defaultValue = "")
                            @RequestParam(value="fileExt",required = false) String fileExt)
    {
        //图片路径
        List<String> tempPaths = new ArrayList<String>();
        try {
            MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
            Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
            String url ="";
            FastDFSUtil fastDFSUtil = new FastDFSConfig().fastDFSUtil();
            String fileName = null;
            for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
                // 上传文件
                MultipartFile mf = entity.getValue();
                fileName = mf.getOriginalFilename();
                String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
                InputStream in = new ByteArrayInputStream(mf.getBytes());
                ObjectNode result = fastDFSUtil.upload(in, fileExt, "");
                in.close();
                if (result != null) {
                    tempPaths.add(result.get("fileUrl").toString().replaceAll("\"", ""));
                }
            InputStream wxImg = getInputStream(mediaId);
            if(StringUtils.isEmpty(fileExt))
            {
                fileExt="jpg";
            }
            String urls = "";
            for (String image : tempPaths) {
                if (urls.length() == 0) {
                    urls = image;
                } else {
                    urls += "," + image;
                }
            ObjectNode result = fastDFSUtil.upload(wxImg, fileExt, "");
            wxImg.close();
            if (result != null) {
                url = result.get("fileUrl").toString().replaceAll("\"", "");
            }
            return write(200, "图片上传成功!","urls", urls);
            return write(200, "图片上传成功!","url", url);
        } catch (Exception e) {
            return invalidUserException(e,-1, "图片上传失败!");
        }

+ 84 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/OpenApiArchiveController.java

@ -0,0 +1,84 @@
package com.yihu.wlyy.web.third;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.health.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.third.jw.JwSignService;
import com.yihu.wlyy.web.BaseController;
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.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
 * 档案相关接口
 * @author hzp at 2016-12-19
 */
@Controller
@RequestMapping(value = "/third/archive")
@Api(description = "档案相关接口(设备、随访)")
public class OpenApiArchiveController extends BaseController {
	@Autowired
	DevicePatientHealthIndexDao healthIndexDao;
	@RequestMapping(value = "/healthIndex", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("获取指标数据")
	public String getHealthIndex(@ApiParam(name="idcard",value="身份证号",defaultValue = "52222419850508381X")
								 @RequestParam(value="idcard",required = true) String idcard,
								 @ApiParam(name="type",value="数据类型(1:血糖,2:血压,3腰围 4体重)",defaultValue = "1")
								 @RequestParam(value="type",required = true) Integer type)
	{
		try {
			List<DevicePatientHealthIndex> result = healthIndexDao.findByIdcardAndType(idcard,type);
			return write(200, "获取指标数据成功!","data",result);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取指标数据失败!");
		}
	}
	@ApiOperation("设备数据上传接口")
	@RequestMapping(value = "/healthIndex/upload",method = RequestMethod.POST)
	@ResponseBody
	public String uploadHealthIndex(
			@ApiParam(name="appkey",value="应用key",defaultValue = "")
			@RequestParam(value="appkey",required = true) String appkey,
			@ApiParam(name="sign",value="签名校验",defaultValue = "")
			@RequestParam(value="sign",required = true) String sign,
			@ApiParam(name="timestamp",value="时间戳",defaultValue = "")
			@RequestParam(value="timestamp",required = true) String timestamp,
			@ApiParam(name="data",value="设备数据",defaultValue = "")
			@RequestParam(value="data",required = true) String data,
			@ApiParam(name="type",value="指标类型1血糖2血压3体重4腰围",defaultValue = "")
			@RequestParam(value="type",required = true) String type,
			@ApiParam(name="sn",value="设备sn码",defaultValue = "")
			@RequestParam(value="sn",required = true) String sn) {
		return write(-1, "设备数据上传失败!");
	}
	@ApiOperation("随访数据上传接口")
	@RequestMapping(value = "/followup/upload",method = RequestMethod.POST)
	@ResponseBody
	public String uploadFollowup(
			@ApiParam(name="appkey",value="应用key",defaultValue = "")
			@RequestParam(value="appkey",required = true) String appkey,
			@ApiParam(name="sign",value="签名校验",defaultValue = "")
			@RequestParam(value="sign",required = true) String sign,
			@ApiParam(name="timestamp",value="时间戳",defaultValue = "")
			@RequestParam(value="timestamp",required = true) String timestamp,
			@ApiParam(name="data",value="随访数据",defaultValue = "")
			@RequestParam(value="data",required = true) String data) {
		return write(-1, "随访数据上传失败!");
	}
}

+ 67 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/OpenApiSignController.java

@ -0,0 +1,67 @@
package com.yihu.wlyy.web.third;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.archives.PatientEventService;
import com.yihu.wlyy.service.app.archives.PatientRecordService;
import com.yihu.wlyy.service.third.jw.JwSignService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
 * 签约相关接口
 * @author hzp at 2016-12-19
 */
@Controller
@RequestMapping(value = "/third/sign")
@Api(description = "签约相关接口")
public class OpenApiSignController extends BaseController {
	@Autowired
	SignFamilyDao signFamilyDao;
	@Autowired
	JwSignService  jwSignService;
	@RequestMapping(value = "/sanshi", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("获取三师签约信息(基卫)")
	public String getSignSanshi(@ApiParam(name="idcard",value="身份证号",defaultValue = "360403195512282415")
								 @RequestParam(value="idcard",required = true) String idcard)
	{
		try {
			String response = jwSignService.getSignSanshi(idcard);
			return write(200, "获取三师签约信息成功!","data",response);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取三师签约信息失败!");
		}
	}
	@RequestMapping(value = "/family", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("获取家庭签约信息")
	public String getSignFamily(@ApiParam(name="idcard",value="身份证号",defaultValue = "350124198003255088")
								 @RequestParam(value="idcard",required = true) String idcard)
	{
		try {
			SignFamily sign =  signFamilyDao.getExpensesSignByIdcard(idcard);
			return write(200, "获取家庭签约信息成功!","data",sign);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取家庭签约信息失败!");
		}
	}
}

+ 149 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/OpenApiSmjkController.java

@ -0,0 +1,149 @@
package com.yihu.wlyy.web.third;
import com.yihu.wlyy.service.app.archives.PatientEventService;
import com.yihu.wlyy.service.app.archives.PatientRecordService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*;
/**
 * 市民健康档案接口
 * @author hzp at 2016-12-19
 */
@Controller
@RequestMapping(value = "/third/smjk")
@Api(description = "市民健康档案接口")
public class OpenApiSmjkController extends BaseController {
	@Autowired
	private PatientRecordService patientRecordService;
	@Autowired
	private PatientEventService patientEventService;
	@ApiOperation("获取门诊记录/住院记录(基卫+APP)")
	@RequestMapping(value = "/event", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	public String getAllEvent(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
							  @RequestParam(value="patient",required = false) String patient,
							  @ApiParam(name="type",value="类型",defaultValue = "")
							  @RequestParam(value="type",required = false) String type,
							  @ApiParam(name="page",value="第几页",defaultValue = "1")
							  @RequestParam(value="page",required = true) String page,
							  @ApiParam(name="pageSize",value="每页几行",defaultValue = "10")
							  @RequestParam(value="pageSize",required = true) String pageSize,
							  @ApiParam(name="lastTime",value="最后一条时间",defaultValue = "")
							  @RequestParam(value="lastTime",required = false) String lastTime) {
		try {
			List<Map<String,String>> result = patientRecordService.getAllEvent(patient,type,page,pageSize,lastTime);
			return write(200, "获取就诊记录成功!", "data", result);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取门/急诊数据失败!");
		}
	}
	@RequestMapping(value = "/event/healthData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("获取健康档案详情(基卫)")
	public String getHealthData(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
								@RequestParam(value="patient",required = false) String patient,
								@ApiParam(name="event",value="事件ID",defaultValue = "30d1eb16-bca2-4b39-b413-672b4361e7a7")
								@RequestParam(value="event",required = true) String event,
								@ApiParam(name="catalog",value="档案类型",defaultValue = "0101")
								@RequestParam(value="catalog",required = true) String catalog,
								@ApiParam(name="serial",value="该类别顺序号,默认填1",defaultValue = "1")
								@RequestParam(value="serial",required = true) String serial) {
		try {
			String result = patientRecordService.getHealthData(patient, event, catalog, serial);
			return write(200, "获取健康档案详情成功!", "data", result);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取健康档案详情失败!");
		}
	}
	@RequestMapping(value = "/event/catalog", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("通过事件号获取档案类型列表(基卫)")
	public String getEventCatalog(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
								  @RequestParam(value="patient",required = false) String patient,
								  @ApiParam(name="event",value="事件ID",defaultValue = "30d1eb16-bca2-4b39-b413-672b4361e7a7")
								  @RequestParam(value="event",required = true) String event) {
		try {
			List<Map<String,String>> result = patientRecordService.getEventCatalog(patient,event);
			return write(200, "通过事件号获取档案类型列表成功!", "data", result);
		} catch (Exception e) {
			return invalidUserException(e, -1, e.getMessage());
		}
	}
	@RequestMapping(value = "/event/drug", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("获取用药记录(基卫)")
	public String getDrugsList(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
							   @RequestParam(value="patient",required = false) String patient,
							   @ApiParam(name="page",value="第几页",defaultValue = "1")
							   @RequestParam(value="page",required = true) String page,
							   @ApiParam(name="pageSize",value="每页几行",defaultValue = "10")
							   @RequestParam(value="pageSize",required = true) String pageSize) {
		try {
			String result = patientRecordService.getDrugsListPage(patient, page, pageSize);
			return write(200, "获取用药记录成功!", "data", result);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取用药记录失败!");
		}
	}
	@ApiOperation("获取检查检验报告(基卫+APP)")
	@RequestMapping(value = "/event/report", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	public String getReportList(@ApiParam(name="patient",value="患者代码",defaultValue = "14531c1f0c09442e8017853fd1a0c8b7")
								@RequestParam(value="patient",required = false) String patient,
								@ApiParam(name="page",value="第几页",defaultValue = "1")
								@RequestParam(value="page",required = true) String page,
								@ApiParam(name="pageSize",value="每页几行",defaultValue = "10")
								@RequestParam(value="pageSize",required = true) String pageSize)
	{
		try {
			List<Map<String,String>> result = patientRecordService.getExamAndLabReport(patient, page, pageSize);
			return write(200, "获取检查检验报告成功!", "data", result);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取检查检验报告失败!");
		}
	}
	/******************************************* 就诊事件管理 **********************************************************/
	@RequestMapping(value = "/event/detail", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("获取就诊事件详情")
	public String getEventDetail(@ApiParam(name="event",value="事件ID",defaultValue = "")
								 @RequestParam(value="event",required = true) String event)
	{
		try {
			JSONObject result = patientEventService.getEventDetail(event);
			return write(200, "获取就诊事件详情成功!", "data", result);
		} catch (Exception e) {
			return invalidUserException(e, -1, "获取就诊事件详情失败!");
		}
	}
}