Browse Source

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

yeshijie 7 years ago
parent
commit
5b1fb99155

+ 3 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java

@ -407,9 +407,9 @@ public class JobController extends BaseController {
    }
    /**
     *遍历长处方支付成功但是院内结算失败的记录,重新执行院内结算 --
     *@author huangwenjie
     *@date 2017/8/18 14:16
     * 居民24小时未回复咨询自动结束
     * @author ysj
     * @date 2017/9/11 14:16
     */
    @RequestMapping(value = "/executeFinishConsultJob", method = RequestMethod.POST)
    @ApiOperation("居民24小时未回复咨询自动结束")

+ 92 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/fzzb/HealthEducationArticleService.java

@ -0,0 +1,92 @@
package com.yihu.wlyy.service.third.fzzb;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
 * 福州总部-健康教育医生APP接口文档
 * 文档地址- http://sso.yihu.cn/DWeb/wiki/wz.html?id=CF5D09684702481BA70F84142817A639
 * Created by yeshijie on 2017/9/11.
 */
@Service
public class HealthEducationArticleService extends BaseService{
    private static Logger logger = LoggerFactory.getLogger(HealthEducationArticleService.class);
    @Autowired
    private HttpClientUtil httpClientUtil;
    private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
    @Value("${yihu.yihu_OpenPlatform_appId}")
    private String clientId;
    private String clientVersion = "1.0";
    private String getArticalById = "JkEdu/Article/getArticalById";//获取单篇文章详情
    private String getDoctorArticalList = "JkEdu/Article/getDoctorArticalList";//获取卫计委认证文章+医生发表未认证文章
    private String getCollectionArticalList = "JkEdu/Article/getCollectionArticalList";//获取收藏文章列表
    private String getCategoryList = "JkEdu/Category/getCategoryList";//获取类别接口
    private String cancelArticleCollection = "JkEdu/Behavior/cancelArticleCollection";//取消收藏接口
    private String saveArticleCollection = "JkEdu/Behavior/saveArticleCollection";//医生收藏接口
    public Map<String,String> getParamsMap(String api,String param){
        Map<String,String> params = new HashMap<>();
        JSONObject authInfo = new JSONObject();
        authInfo.put("clientId",clientId);//填渠道ID(必填,固定为9000276)
        authInfo.put("clientVersion",clientVersion);//接入方系统版本号(非必须,默认 1.0)
        authInfo.put("sign","");//(保留,非必填)
        authInfo.put("sessionKey","");//(保留,非必填)
        params.put("AuthInfo",authInfo.toString());
        params.put("SequenceNoString", DateUtil.getUserDate(DateUtil.YYYYMMddHHmmssSSS));//请求序列号,yyyyMMddHHmmssSSS 格式的时间戳
        params.put("Api",api);//Api 名称    需要调用的 API 名称
        params.put("Param",param);//本次请求的方法参数   Json结构的字符串
        params.put("ParamType","0");//指定 param 参数的类型,固定传0
        params.put("OutType","0");//指定返回 JSON/Xml 结构的字符串,固定传0
        params.put("V","1");//API 版本号。版本号为整型,从数字 1 开始递增.
        return params;
    }
    /**
     * 获取文章列表
     * @param articleTitle 否 文章标题
     * @param articleState 否 传1
     * @param firstLevelCategoryId 否    一级类别ID ,多个逗号隔开
     * @param pageIndex 否    起始页数 0开始,默认0
     * @param pageSize 否    每页显示数 ,默认5
     * @param userId 是    当前用户ID
     * @return
     */
    public String getDoctorArticalList(String articleTitle, Integer articleState, String firstLevelCategoryId, Integer pageIndex, Integer pageSize,String userId){
        String response = "";
        try{
            JSONObject param = new JSONObject();
            param.put("articleTitle",articleTitle);
            param.put("articleState",articleState);
            param.put("firstLevelCategoryId",firstLevelCategoryId);
            param.put("pageIndex",pageIndex);
            param.put("pageSize",pageSize);
            param.put("userId",userId);
            response = httpClientUtil.httpPost(baseUrl,getParamsMap("JkEdu.Article.getDoctorArticalList",param.toString()));
        }catch (Exception e){
            logger.error(e.getMessage());
        }
        return response;
    }
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/GuahaoXMService.java

@ -1175,7 +1175,8 @@ public class GuahaoXMService implements IGuahaoService {
            String startTime = map.get("startTime");
            String endTime = map.get("endTime");
            String response = jwSmjkService.webRegisterByFamily(cardNo, patientName, clinicCard, sectionType, startTime, hospitalId, hosDeptId, hosDeptName, doctorId, doctorName,patientPhone);
//            String response = jwSmjkService.webRegisterByFamily(cardNo, patientName, clinicCard, sectionType, startTime, hospitalId, hosDeptId, hosDeptName, doctorId, doctorName,patientPhone);
            String response = "e07cfa6a-e134-4329-bb99-9b7dbffea79e|516|熊永强";
            re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
        } else {

+ 144 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwArchivesService.java

@ -2,7 +2,6 @@ package com.yihu.wlyy.service.third.jw;
import com.yihu.wlyy.service.system.SystemDictService;
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;
@ -805,4 +804,148 @@ public class JwArchivesService {
            throw new Exception("返回结果为空!");
        }
    }
    /*****************************************建档相关******************************************************************/
    /**
     *  查询居民是否有建立健康档案接口
     */
    public String getSickArchiveFlag(String idcard)  throws Exception
    {
        String re = "0";//0 未建档,非0为档案号
        String url = jwUrl + "/third/archives/getSickArchiveFlag";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("idcard", idcard));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if(!StringUtils.isEmpty(response))
        {
            JSONObject json = new JSONObject(response);
            if (!"200".equals(json.optString("status"))) {
                throw new Exception(json.optString("msg"));
            }else{
                String dataStr = json.getString("data");
                if(!StringUtils.isEmpty(dataStr)){
                    JSONObject data = new JSONObject(dataStr);
                    if("1".equals(data.optString("CODE")))
                    {
                        JSONArray jsonArray = data.getJSONArray("DATA");
                        re = jsonArray.getJSONObject(0).getString("ARCHIVE_ID");
                    }
                    else{
                        throw new Exception(json.optString("MESSAGE"));
                    }
                }else{
                    throw new Exception("返回结果为空!");
                }
            }
        }
        else{
            throw new Exception("返回结果为空!");
        }
        return re;
    }
    /**
     * 查询居民健康档案信息接口
     * @param idcard
     * @return
     * @throws Exception
     */
    public JSONArray getSickArchiveRecord(String idcard)  throws Exception
    {
        JSONArray re = new JSONArray();
        String url = jwUrl + "/third/archives/getSickArchiveRecord";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("idcard", idcard));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if(!StringUtils.isEmpty(response))
        {
            JSONObject json = new JSONObject(response);
            if (!"200".equals(json.optString("status"))) {
                throw new Exception(json.optString("msg"));
            }else{
                String dataStr = json.getString("data");
                if(!StringUtils.isEmpty(dataStr)){
                    JSONObject data = new JSONObject(dataStr);
                    if("1".equals(data.optString("CODE")))
                    {
                        JSONArray jsonArray = data.getJSONArray("DATA");
                        // {"ARCHIVE_ID":"档案ID","SICK_NAME":"病人姓名","SICK_SEX":"性别","BIRTHDAY":"出生日期","IDENTITY_CARD_NO":"身份证号码","ZONE_CODE":"归属辖区","HOME_ADDRESS":"现住址","INSUR_CARD_NO":"医保卡号"}
                        jsonArray.forEach(one->{
                            JSONObject jsonObject = new JSONObject(one);
                            JSONObject js = new JSONObject();
                            js.put("archiveId",jsonObject.get("ARCHIVE_ID"));
                            js.put("sickName",jsonObject.get("SICK_NAME"));
                            js.put("sickSex",jsonObject.get("SICK_SEX"));
                            js.put("birthday",jsonObject.get("BIRTHDAY"));
                            js.put("idCard",jsonObject.get("IDENTITY_CARD_NO"));
                            js.put("zoneCode",jsonObject.get("ZONE_CODE"));
                            js.put("homeAddress",jsonObject.get("HOME_ADDRESS"));
                            js.put("ssc",jsonObject.get("INSUR_CARD_NO"));
                            re.put(js);
                        });
                    }
                    else{
                        throw new Exception(json.optString("MESSAGE"));
                    }
                }else{
                    throw new Exception("返回结果为空!");
                }
            }
        }
        else{
            throw new Exception("返回结果为空!");
        }
        return re;
    }
    /**
     * 上传居民档案建档信息接口
     * @param param 入参json对象,成功返回档案号
     * @param doctor
     * @return
     */
    public String saveSickArchiveRecord(String param,String doctor) throws Exception{
        String re = "0";//0 未建档,非0为档案号
        String url = jwUrl + "/third/archives/saveSickArchiveRecord";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("json", param));
        params.add(new BasicNameValuePair("doctor", doctor));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        if(!StringUtils.isEmpty(response))
        {
            JSONObject json = new JSONObject(response);
            if (!"200".equals(json.optString("status"))) {
                throw new Exception(json.optString("msg"));
            }else{
                String dataStr = json.getString("data");
                if(!StringUtils.isEmpty(dataStr)){
                    JSONObject data = new JSONObject(dataStr);
                    if("1".equals(data.optString("CODE")))
                    {
                        JSONArray jsonArray = data.getJSONArray("DATA");
                        re = jsonArray.getJSONObject(0).getString("ARCHIVE_ID");
                    }
                    else{
                        throw new Exception(json.optString("MESSAGE"));
                    }
                }else{
                    throw new Exception("返回结果为空!");
                }
            }
        }
        else{
            throw new Exception("返回结果为空!");
        }
        return re;
    }
}

+ 1 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -20,6 +20,7 @@ public class DateUtil {
	public static final String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
	public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
	public static final String YYYY_M_D_HH_MM_SS = "yyyy/M/d HH:mm:ss";
	public static final String YYYYMMddHHmmssSSS  = "yyyyMMddHHmmssSSS";
	/**
@ -30,11 +31,6 @@ public class DateUtil {
		return formatter.format(date);
	}
	/*public static void main(String[] args)
	{
	   System.out.print(dateToChinese(new Date()));
	}*/
	/**
	 * 字符串转时间格式
	 */

+ 33 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -140,6 +140,39 @@ public class ImUtill {
        return response;
    }
    /**
     * 咨询列表总数
     * @param user
     * @param status status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     * @param reply
     * @param type 1、三师咨询,2、家庭医生咨询,6、患者名医咨询 7医生名医咨询 8续方咨询 10医生发起的求助
     * @return
     */
    public String getConsultCountByStatusAndType(String user,Integer status,Integer reply,Integer type,String patientName,String startTime,String endTime){
        String imAddr = im_host + "api/v2/sessions/topicListCountByType";
        imAddr = imAddr + "?user="+user;
        if (status != null) {
            imAddr += ("&status=" + status);
        }
        if (reply != null) {
            imAddr += ("&reply=" + reply);
        }
        if (type != null) {
            imAddr += ("&type=" + type);
        }
        if (patientName != null) {
            imAddr += ("&patientName=" + patientName);
        }
        if (startTime != null) {
            imAddr += ("&startTime=" + startTime);
        }
        if (endTime != null) {
            imAddr += ("&endTime=" + endTime);
        }
        String response = HttpClientUtil.get(imAddr, "UTF-8");
        return response;
    }
    /**
     * 发送消息给IM
     *

+ 34 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java

@ -174,6 +174,7 @@ public class imController extends BaseController {
                }
                map.put("id", id);
                map.put("status", status);
                map.put("session_id", session_id);
                map.put("photo", avatar);
                map.put("patientName", name);
@ -194,6 +195,39 @@ public class imController extends BaseController {
        }
    }
    /**
     * 获取列表
     * status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复
     * 第一次列表为当前医生(很可能团队长)待回复列表 传参:doctor有后台获取 status=0,reply=0未回复
     * 后 取团队内单个医生的咨询情况 doctor、status、reply均有前端传入
     *
     * @return
     */
    @RequestMapping(value = "/consult/getListCount", method = RequestMethod.GET)
    @ResponseBody
    public String getConsultCountByStatus(
            @RequestParam(required = false) String doctor,
            @RequestParam Integer status,
            @RequestParam(required = false) Integer reply,
            @ApiParam(name = "type", value = "咨询类型") @RequestParam(required = true) Integer type,
            @ApiParam(name = "patientName", value = "居民姓名") @RequestParam(required = false) String patientName,
            @ApiParam(name = "startTime", value = "开始时间") @RequestParam(required = false) String startTime,
            @ApiParam(name = "endTime", value = "结束时间") @RequestParam(required = false) String endTime) {
        try {
            if (StringUtils.isEmpty(doctor)) {
                doctor = getUID();
            }
            String consult = null;
            consult = ImUtill.getConsultCountByStatusAndType(doctor, status, reply,type,patientName,startTime,endTime);
            JSONObject json = new JSONObject(consult);
            return write(200, "查询成功", "total", json.getInt("count"));
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "查询失败!");
        }
    }
    /**
     * 获取团队统计数据
     * status = 10 已结束的咨询,status=0,reply = 1 已回复 ,status=0,reply=0未回复

+ 27 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -12,10 +12,10 @@ import com.yihu.wlyy.service.app.health.*;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.fzzb.HealthEducationArticleService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.util.MessageType;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import io.swagger.annotations.Api;
@ -600,7 +600,31 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
    }
    public static void main(String arg[]) {
        System.out.println(MessageType.MESSAGE_TYPE_PATIENT_HEALTH_EDU.P_HE_01.name());
    /**********************************福州健康文章接口********************************************/
    @Autowired
    private HealthEducationArticleService healthEducationArticleService;
    @RequestMapping(value = "getDoctorArticalList",method = RequestMethod.GET)
    @ApiOperation("获取健康教育文章列表")
    @ResponseBody
    public String getDoctorArticalList(@ApiParam(name = "articleTitle", value = "文章标题")
                                       @RequestParam(value = "articleTitle", required = false) String articleTitle,
                                       @ApiParam(name = "articleState", value = "文章状态(1、正常、2删除 3、草稿)")
                                       @RequestParam(value = "articleState", required = true,defaultValue = "1") Integer articleState,
                                       @ApiParam(name = "firstLevelCategoryId", value = "一级类别ID ,多个逗号隔开")
                                       @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                       @ApiParam(name = "pageIndex", value = "起始页数 0开始,默认0")
                                       @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
//            String response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
            String response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败!");
        }
    }
}

+ 47 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthRecordController.java

@ -261,4 +261,51 @@ public class DoctorHealthRecordController extends BaseController {
		}
	}
	@RequestMapping(value = "testFlag", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("是否建档")
	public String getSickArchiveFlag(@ApiParam(name = "idcard", value = "体检ID", defaultValue = "1249652")
								 @RequestParam(value="idcard",required = true) String idcard){
		try{
			String response = jwArchivesService.getSickArchiveFlag(idcard);
			return write(200,"查询成功","getSickArchiveFlag",response);
		}catch (Exception e){
			error(e);
			return error(-1,"查询失败");
		}
	}
	@RequestMapping(value = "saveSickArchiveRecord", method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("上传建档")
	public String testFlag(){
		try{
			JSONObject json = new JSONObject();
			json.put("ARCHIVE_TIME",DateUtil.getStringDateShort());//建档时间
			json.put("ARCHIVE_STATUS","3");//档案状态【1.未管理 2.死亡 3.正常 4.高危】
			json.put("SICK_NAME","");//姓名
			json.put("SICK_SEX","");//性别【1.男 2.女 9 未知】
			json.put("BIRTHDAY","");//出生日期
			json.put("ZONE_CODE","");//所属社区【ZONE_DICT】
			json.put("IDENTITY_TYPE","");//证件类型【IDENTITY_TYPE_DICT】
			json.put("IDENTITY_CARD_NO","");//身份证号
			json.put("HOME_PHONE","");//本人电话
			json.put("HOME_ADDRESS","");//现住址
			json.put("ORG_ID","0");//新增默认传0
			json.put("RESIDENCE","1");//户籍【1.户籍 2.非户籍】
			json.put("SICK_NAME","");//姓名
			json.put("SICK_NAME","");//姓名
			json.put("SICK_NAME","");//姓名
			json.put("SICK_NAME","");//姓名
			String doctor = "";
			String response = jwArchivesService.saveSickArchiveRecord(json.toString(),doctor);
			return write(200,"查询成功","saveSickArchiveRecord",response);
		}catch (Exception e){
			error(e);
			return error(-1,"查询失败");
		}
	}
}