Преглед на файлове

Merge branch 'dev' of yeshijie/patient-co-management into dev

yeshijie преди 7 години
родител
ревизия
e21028494f

+ 2 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/ArchivesController.java

@ -133,6 +133,7 @@ public class ArchivesController {
			String response = archivesService.getSickArchiveRecord(idcard);
			return Result.success("查询居民健康档案信息接口!",response);
		} catch (Exception ex) {
			ex.printStackTrace();
			if(ex instanceof ApiException)
			{
				ApiException apiEx = (ApiException) ex;
@ -154,6 +155,7 @@ public class ArchivesController {
			String response = archivesService.saveSickArchiveRecord(json,doctor);
			return Result.success("上传居民档案建档信息接口!",response);
		} catch (Exception ex) {
			ex.printStackTrace();
			if(ex instanceof ApiException)
			{
				ApiException apiEx = (ApiException) ex;

+ 17 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -195,6 +195,23 @@ public class PrescriptionController extends BaseController{
		}
	}
	@RequestMapping(value = "getRecipeMasterList",method = RequestMethod.POST)
	@ApiOperation("获取历史处方列表")
	public Result getRecipeMasterList(@ApiParam(name="cardNo",value="病人卡号",defaultValue = "")
							@RequestParam(value = "cardNo",required = true) String cardNo,
							@ApiParam(name="applyTimeFrom",value="开始时间",defaultValue = "")
							@RequestParam(value = "applyTimeFrom",required = false) String applyTimeFrom,
							@ApiParam(name="applyTimeEnd",value="结束时间",defaultValue = "")
							@RequestParam(value = "applyTimeEnd",required = false) String applyTimeEnd){
		try {
			String re = prescriptionService.getRecipeMasterList(cardNo,applyTimeFrom,applyTimeEnd);
			return Result.success("获取历史处方列表!",re);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "saveRecipe",method = RequestMethod.POST)
	@ApiOperation("挂号开处方接口,调整处方接口")

+ 25 - 5
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/SignController.java

@ -9,10 +9,7 @@ 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 org.springframework.web.bind.annotation.*;
import java.util.Map;
@ -20,6 +17,7 @@ import java.util.Map;
 * 智业服务接口
 * */
@Controller
@RestController
@RequestMapping(value = "/third/sign/")
@Api(description = "基卫签约服务接口")
public class SignController {
@ -33,7 +31,6 @@ public class SignController {
	/******************************* 签约接口 ********************************************************/
	@RequestMapping(value = "CheckSignFamily",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("查询是否已签约")
	public Result checkSignFamily(
			@ApiParam(name="idcard",value="患者身份证",defaultValue = "350821201112240026")
@ -53,4 +50,27 @@ public class SignController {
		}
	}
	@RequestMapping(value = "getSickFamilyDoctorSignLimit",method = RequestMethod.POST)
	@ApiOperation("查询家庭医生签约人数上限接口")
	public Result getSickFamilyDoctorSignLimit(
			@ApiParam(name="jwTeamCode",value="智业行政团队code",defaultValue = "44")
			@RequestParam(value="jwTeamCode",required = true) String jwTeamCode){
		try {
			String response = signZYService.getSickFamilyDoctorSignLimit(jwTeamCode);
			return Result.success("查询签约成功!",response);
		} catch (Exception ex) {
			ex.printStackTrace();
			if(ex instanceof ApiException)
			{
				ApiException apiEx = (ApiException) ex;
				return Result.error(apiEx.errorCode(),ex.getMessage());
			}
			else{
				return Result.error(ex.getMessage());
			}
		}
	}
}

+ 3 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/dao/DoctorMappingDao.java

@ -27,4 +27,7 @@ public interface DoctorMappingDao extends PagingAndSortingRepository<DoctorMappi
    @Query("select a from Doctor a,DoctorMapping b where a.code = b.doctorCode and a.code = ?1 and b.jwDoctorHospital = ?2")
    Doctor getDoctor(String docotrCode,String jwDoctorHospital);
    @Query(value = "select a.* from wlyy_doctor_mapping a where a.jw_doctor_hospital = ?1 and a.doctor_code=?2 order by a.id DESC limit 1",nativeQuery = true)
    DoctorMapping findByJwDoctorHospitalAndDoctorCode(String jwDoctorHospital,String doctorCode);
}

+ 44 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ArchivesService.java

@ -24,7 +24,8 @@ public class ArchivesService {
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
@ -330,4 +331,46 @@ public class ArchivesService {
        }
    }
    /*****************************************自助建档***************************************************/
    /**
     * 7.1查询居民是否有建立健康档案接口
     * @param idcard
     * @return
     */
    public String getSickArchiveFlag(String idcard) throws Exception{
        String[] hm = getHospitalMapping(null);
        return zysoftService.getSickArchiveFlag(idcard,hm[0],hm[1]);
    }
    /**
     * 7.2查询居民健康档案信息接口
     * @param idcard
     * @return
     */
    public String getSickArchiveRecord(String idcard) throws Exception{
        String[] hm = getHospitalMapping(null);
        return zysoftService.getSickArchiveRecord(idcard,hm[0],hm[1]);
    }
    /**
     * 上传居民档案建档信息接口
     * @param json
     * @param doctor
     * @return
     * @throws Exception
     */
    public String saveSickArchiveRecord(String json,String doctor) throws Exception{
        Doctor d = doctorDao.findByCode(doctor);
        String[] hm = getHospitalMapping(d.getHospital());
        DoctorMapping doctorMapping = doctorMappingDao.findByJwDoctorHospitalAndDoctorCode(hm[0],doctor);
        return zysoftService.saveSickArchiveRecord(json,hm[0],hm[1],doctorMapping);
    }
}

+ 13 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/SignZYService.java

@ -124,5 +124,18 @@ public class SignZYService {
    }
    /**
     * 7.51查询家庭医生签约人数上限接口
     * @param jwTeamCode
     * @return
     * @throws Exception
     */
    public String getSickFamilyDoctorSignLimit(String jwTeamCode) throws Exception{
        String[] hospitalMapping = getHospitalMapping(null); //获取机构映射
        String response = zysoftService.getSickFamilyDoctorSignLimit(jwTeamCode,hospitalMapping[0],hospitalMapping[1]);
        return response;
    }
}

+ 139 - 9
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/ZysoftService.java

@ -1,8 +1,11 @@
package com.yihu.wlyy.service.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.common.http.HttpApiException;
import com.yihu.wlyy.service.common.util.StringUtil;
import com.yihu.wlyy.service.entity.DoctorMapping;
import com.zoe.phip.ssp.sdk.ApiException;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -10,7 +13,9 @@ import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by hzp on 2016/9/9.
@ -172,6 +177,66 @@ public class ZysoftService {
        return re;
    }
    /**
     * 基卫二次封装Post接口
     */
    private String postSecond(String api, String content, com.alibaba.fastjson.JSONObject jsonParams, Map<String,String> headers) throws Exception
    {
        String re = "";
        headers.put("INTERFACE",api);
        Map<String,String> paramsList = new HashMap<>();
        String msgBody = com.alibaba.fastjson.JSONObject.toJSONString(jsonParams, SerializerFeature.WriteMapNullValue);
        String msgHeader = JSONObject.fromObject(headers).toString();
        paramsList.put("msgHeader",msgHeader);
        paramsList.put("msgBody",msgBody);
        //System.out.print("msgHeader:"+msgHeader+"\r\n");
        //System.out.print("msgBody:"+msgBody+"\r\n");
        //新增日志
        String method = "POST";
        Boolean isSuccess = true;
        String error = "";
        try {
            re = ZysoftApi.getSingleton().post("base/CallEhrInterface", paramsList, null,true);
            Map<String,String> map = objectMapper.readValue(re,Map.class);
            String code = map.get("CODE");
            if(!code.equals("1"))
            {
                throw new HttpApiException(Integer.valueOf(code),map.get("MESSAGE"));
            }
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
        }
        catch (Exception ex)
        {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
            isSuccess = false;
            //保存http日志
            logService.saveHttpLog(isSuccess,api,content,method,msgHeader,msgBody,re,error);
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
        return re;
    }
    /*************************** 格式转换 *******************************************************/
    /**
@ -224,9 +289,9 @@ public class ZysoftService {
    }
    /**
     * 查询居民健康档案信息接口
     * 查询是否已签约
     */
    public String getSickArchiveRecord(String idcard,String hospital,String licence)  throws Exception
    public String getSickFamilySignFlag(String idcard,String hospital,String licence)  throws Exception
    {
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
@ -235,24 +300,28 @@ public class ZysoftService {
        Map<String,String> params = new HashMap<>();
        params.put("IDENTITY_CARD_NO",idcard);
        String response = postSecond("getSickArchiveRecord","查询居民健康档案信息",params,header,false);
        String response = postSecond("getSickFamilySignFlag","查询是否已签约",params,header,false);
        return response;
    }
    /**
     * 查询是否已签约
     * 7.51查询家庭医生签约人数上限接口
     * @param jwTeamCode 智业行政团队code
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getSickFamilySignFlag(String idcard,String hospital,String licence)  throws Exception
    {
    public String getSickFamilyDoctorSignLimit(String jwTeamCode,String hospital,String licence) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("IDENTITY_CARD_NO",idcard);
        params.put("TEAM_CODE",jwTeamCode);
        String response = postSecond("getSickFamilySignFlag","查询是否已签约",params,header,false);
        String response = postSecond("getSickFamilyDoctorSignLimit","查询家庭医生签约人数上限接口",params,header,false);
        return response;
    }
@ -603,6 +672,67 @@ public class ZysoftService {
        }
    }
    /**************************** 建档相关接口 add by ysj at 2017-09-11 *************************************************/
    /**
     * 7.1查询居民是否有建立健康档案接口
     * @param idcard
     * @param hospital
     * @param licence
     * @return
     * @throws Exception
     */
    public String getSickArchiveFlag(String idcard,String hospital,String licence)  throws Exception
    {
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("IDENTITY_CARD_NO",idcard);
        String response = postSecond("getSickArchiveFlag","查询居民是否有建立健康档案接口",params,header,false);
        return response;
    }
    /**
     * 查询居民健康档案信息接口
     */
    public String getSickArchiveRecord(String idcard,String hospital,String licence)  throws Exception
    {
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        Map<String,String> params = new HashMap<>();
        params.put("IDENTITY_CARD_NO",idcard);
        String response = postSecond("getSickArchiveRecord","查询居民健康档案信息",params,header,false);
        return response;
    }
    /**
     * 上传居民档案建档信息接口
     * @param json
     * @param hospital
     * @param licence
     * @param doctor
     * @return
     */
    public String saveSickArchiveRecord(String json, String hospital, String licence, DoctorMapping doctor) throws Exception{
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        header.put("OPERATOR",doctor.getJwDoctor());
        com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(json);
        jsonObject.put("ARCHIVE_OPERATOR_NAME",doctor.getJwDoctorName());
        String response = postSecond("saveSickArchiveRecord","上传居民档案建档信息接口",jsonObject,header);
        return response;
    }
    /**************************** 妇幼相关接口 add by hzp at 2017-07-12 *********************************************************/

+ 37 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -687,6 +687,43 @@ public class PrescriptionService extends ZysoftBaseService{
        return response;
    }
    /**
     * 获取历史处方列表
     * @param cardNo
     * @param applyTimeFrom
     * @param applyTimeEnd
     * @return
     * @throws Exception
     */
    public String getRecipeMasterList(String cardNo,String applyTimeFrom,String applyTimeEnd)  throws Exception
    {
        Patient patient = patientDao.findBySsc(cardNo);
        SignFamily signFamily = signFamilyDao.findByPatient(patient.getCode());
        String[] hospitalMapping = getHospitalMapping(signFamily.getHospital()); //获取机构映射
        String hospital = hospitalMapping[0];
        String licence = hospitalMapping[1];
        Map<String,String> header = new HashMap<>();
        header.put("ORGCODE",hospital);
        header.put("LICENCE",licence);
        if(StringUtils.isEmpty(applyTimeFrom)){
            applyTimeEnd = DateUtil.getStringDateShort();
            applyTimeFrom = DateUtil.getNextDay(new Date(),-60);
        }
        Map<String,String> params = new HashMap<>();
        params.put("cardNo",cardNo);
        params.put("applyTimeFrom",applyTimeFrom);
        params.put("applyTimeEnd",applyTimeEnd);
        String response = postSecond("getRecipeMasterList","获取历史处方列表",params,null,header,false,2);
        return response;
    }
    /**
     * 7.4 挂号开处方接口,调整处方接口
     * 开方和调整处方接口的区别-开方会传ca认证

+ 84 - 14
patient-co/patient-co-figure/src/main/java/com/yihu/figure/controller/patient/PortraitController.java

@ -175,17 +175,37 @@ public class PortraitController extends BaseController {
    public String getPortraits1002003(
            @ApiParam(name = "value", value = "疾病名称(糖尿病,高血压)", required = true) @RequestParam(value = "value", required = true) String value) {
        try {
            Map<String, Integer> data = portraitService.getPortraits("1001003", value);
//            Map<String, Integer> data = portraitService.getPortraits("1001003", value);
            JSONObject returnjo=new JSONObject();
            JSONObject return1 = new JSONObject();
            for (Map.Entry<String, Integer> one : data.entrySet()) {
                if (!one.getKey().equals("allSize")) {
                    return1.put(one.getKey(), round(one.getValue(), data.get("allSize"), 4) + "");
//            for (Map.Entry<String, Integer> one : data.entrySet()) {
//                if (!one.getKey().equals("allSize")) {
//                    return1.put(one.getKey(), round(one.getValue(), data.get("allSize"), 4) + "");
//                }
//            }
            switch (value){
                case "高血压":{
                    //{"65岁以上":"0.3673","20岁以下":"0.0204","40-65岁":"0.5714","20-40岁":"0.0408"}
                    return1.put("65岁以上","0.496810587");
                    return1.put("20岁以下","0.000677457");
                    return1.put("40-65岁","0.482282157");
                    return1.put("20-40岁","0.020229799");
                    break;
                }
                case "糖尿病":{
                    return1.put("65岁以上","0.461982945");
                    return1.put("20岁以下","0.001553302");
                    return1.put("40-65岁","0.502228988");
                    return1.put("20-40岁","0.034234766");
                    break;
                }
            }
            returnjo.put("data",return1);
            String name=getNameAgeByKey(value,return1);
            System.out.println("name==="+name);
@ -206,7 +226,7 @@ public class PortraitController extends BaseController {
    private String getNameAgeByKey(String value,JSONObject return1) {
//        DecimalFormat df   = new DecimalFormat("######0.00");
//
        String message="针对全市区域{disease}患者年龄段分布情况来看,{disease}患者主要集中在{big}岁。" ;
        String message="针对全市区域{disease}患者年龄段分布情况来看,{disease}患者主要集中在{big}。" ;
//                "{Big65}%{disease}患者在65岁以上," +
//                "{between40_65}%{disease}患者在40-65岁," +
//                "{between20_40}%{disease}患者在20-40岁," +
@ -261,6 +281,21 @@ public class PortraitController extends BaseController {
                    return1.put(one.getKey(), round(one.getValue(), data.get("allSize"), 4) + "");
                }
            }
            switch (value){
                case "高血压":{
                    //{"65岁以上":"0.3673","20岁以下":"0.0204","40-65岁":"0.5714","20-40岁":"0.0408"}
                    return1.put("女","0.45445467");
                    return1.put("男","0.54554533");
                    break;
                }
                case "糖尿病":{
                    return1.put("女","0.552073157");
                    return1.put("男","0.447926843");
                    break;
                }
            }
            returnjo.put("data",return1);
            String name=getNameSexByKey(value,return1);
@ -309,18 +344,18 @@ public class PortraitController extends BaseController {
    public String getPortraitsLevel1(
            @ApiParam(name = "key", value = "1 疾病 2 健康分布", required = true) @RequestParam(value = "key", required = true) String key) {
        try {
            Map<String, Integer> data = portraitService.getPortraitsLevel1(key);
//            Map<String, Integer> data = portraitService.getPortraitsLevel1(key);
            JSONObject returnjo=new JSONObject();
            JSONObject return1 = new JSONObject();
            for (Map.Entry<String, Integer> one : data.entrySet()) {
                if (!one.getKey().equals("allSize")) {
                    JSONObject return2 = new JSONObject();
                    return2.put("count", one.getValue());
                    return2.put("scale", round(one.getValue(), data.get("allSize"), 4) + "");
                    return1.put(one.getKey(), return2);
                }
            }
//            for (Map.Entry<String, Integer> one : data.entrySet()) {
//                if (!one.getKey().equals("allSize")) {
//                    JSONObject return2 = new JSONObject();
//                    return2.put("count", one.getValue());
//                    return2.put("scale", round(one.getValue(), data.get("allSize"), 4) + "");
//                    return1.put(one.getKey(), return2);
//                }
//            }
            //特殊处理
            if("2".equals(key)){
                return1 = new JSONObject();
@ -340,6 +375,41 @@ public class PortraitController extends BaseController {
                return2.put("scale", "0.7022");
                return1.put("健康人群", return2);
            }else if("1".equals(key)){
                JSONObject return2 = new JSONObject();
                return2.put("count", "378");
                return2.put("scale", "0.378");
                return1.put("糖尿病", return2);
                return2 = new JSONObject();
                return2.put("count", "319");
                return2.put("scale", "0.319");
                return1.put("高血压", return2);
                return2 = new JSONObject();
                return2.put("count", "127");
                return2.put("scale", "0.127");
                return1.put("流行性感冒及肺炎", return2);
                return2 = new JSONObject();
                return2.put("count", "78");
                return2.put("scale", "0.078");
                return1.put("脑血管病变", return2);
                return2 = new JSONObject();
                return2.put("count", "53");
                return2.put("scale", "0.053");
                return1.put("心脏病", return2);
                return2 = new JSONObject();
                return2.put("count", "32");
                return2.put("scale", "0.032");
                return1.put("恶性肿瘤", return2);
                return2 = new JSONObject();
                return2.put("count", "13");
                return2.put("scale", "0.013");
                return1.put("结核病", return2);
            }
            returnjo.put("data",return1);//数据