|  | @ -1,111 +1,21 @@
 | 
												
													
														
															|  | package com.yihu.jw.hospital.endpoint.healthCare;
 |  | package com.yihu.jw.hospital.endpoint.healthCare;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSON;
 |  | 
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSONObject;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.dict.service.BaseDictJobTitleService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.dict.service.HospitalDeptService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.doctor.service.BaseDoctorInfoService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.dict.DictJobTitleDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.im.ConsultDo;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.im.ConsultTeamDo;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.wx.WxWechatDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.prescription.*;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.order.BusinessOrderDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.es.service.StatisticsEsService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.es.service.yqfk.YqfkService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.file_upload.FileUploadService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.healthCare.service.HealthCareService;
 |  | import com.yihu.jw.healthCare.service.HealthCareService;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.httplog.service.WlyyHttpLogService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.message.service.BaseBannerDoctorService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.message.service.BaseUserMsgService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.message.service.SystemMessageService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.prescription.dao.*;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.prescription.service.*;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.prescription.service.entrance.HcyyEntranceService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.service.consult.KnowledgeCategoryService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.service.consult.QrcodeService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.hospital.service.consult.SysDictService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.im.dao.ConsultDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.im.dao.ConsultTeamDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.im.service.ImService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.order.BusinessOrderService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.order.dao.BusinessOrderDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.order.pay.utils.PayLogService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.order.pay.ylz.YlzPayService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.iot.common.UploadVO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.Envelop;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.ListEnvelop;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.MixEnvelop;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 |  | import com.yihu.jw.restmodel.web.ObjEnvelop;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
 |  | import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
 | 
												
													
														
															|  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
												
													
														
															|  | import com.yihu.jw.rm.patient.PatientRequestMapping;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.sms.service.YkyyINSMSService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.util.common.FileUtil;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.util.common.XMLUtil;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.util.date.DateUtil;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.wechat.dao.BasePatientWechatDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.wechat.dao.WechatDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.wechat.service.WechatInfoService;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
 |  | 
 | 
												
													
														
															|  | import com.ylzinfo.onepay.sdk.OnepayClient;
 |  | 
 | 
												
													
														
															|  | import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
 |  | 
 | 
												
													
														
															|  | import com.ylzinfo.onepay.sdk.domain.ResponseParams;
 |  | 
 | 
												
													
														
															|  | import com.ylzinfo.onepay.sdk.domain.WebHook;
 |  | 
 | 
												
													
														
															|  | import com.ylzinfo.onepay.sdk.domain.ext.WaitPayDetailVO;
 |  | 
 | 
												
													
														
															|  | import com.ylzinfo.onepay.sdk.exception.PayException;
 |  | 
 | 
												
													
														
															|  | import com.ylzinfo.onepay.sdk.utils.SecurityUtil;
 |  | 
 | 
												
													
														
															|  | import com.ylzinfo.onepay.sdk.utils.StringUtil;
 |  | 
 | 
												
													
														
															|  | import io.swagger.annotations.Api;
 |  | import io.swagger.annotations.Api;
 | 
												
													
														
															|  | import io.swagger.annotations.ApiOperation;
 |  | import io.swagger.annotations.ApiOperation;
 | 
												
													
														
															|  | import io.swagger.annotations.ApiParam;
 |  | import io.swagger.annotations.ApiParam;
 | 
												
													
														
															|  | import net.sf.json.JSONArray;
 |  | 
 | 
												
													
														
															|  | import net.sf.json.xml.XMLSerializer;
 |  | 
 | 
												
													
														
															|  | import org.apache.axis.utils.StringUtils;
 |  | 
 | 
												
													
														
															|  | import org.apache.commons.collections.map.HashedMap;
 |  | 
 | 
												
													
														
															|  | import org.slf4j.Logger;
 |  | import org.slf4j.Logger;
 | 
												
													
														
															|  | import org.slf4j.LoggerFactory;
 |  | import org.slf4j.LoggerFactory;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Value;
 |  | 
 | 
												
													
														
															|  | import org.springframework.data.redis.core.StringRedisTemplate;
 |  | 
 | 
												
													
														
															|  | import org.springframework.util.StreamUtils;
 |  | 
 | 
												
													
														
															|  | import org.springframework.web.bind.annotation.*;
 |  | import org.springframework.web.bind.annotation.*;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import javax.servlet.http.HttpServletRequest;
 |  | 
 | 
												
													
														
															|  | import javax.servlet.http.HttpServletResponse;
 |  | 
 | 
												
													
														
															|  | import java.io.IOException;
 |  | 
 | 
												
													
														
															|  | import java.io.InputStream;
 |  | 
 | 
												
													
														
															|  | import java.nio.charset.Charset;
 |  | 
 | 
												
													
														
															|  | import java.util.*;
 |  | 
 | 
												
													
														
															|  | import java.util.concurrent.TimeUnit;
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import static com.yihu.jw.utils.sfutils.SHAUtils.SHA1;
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | /**
 |  | /**
 | 
												
													
														
															|  |  * @author zmk
 |  | 
 | 
												
													
														
															|  |  * 患者不用登陆访问居民PC端控制类
 |  | 
 | 
												
													
														
															|  |  * Created at 2019/12/25。
 |  | 
 | 
												
													
														
															|  | 
 |  |  * @author wangzhinan
 | 
												
													
														
															|  | 
 |  |  *
 | 
												
													
														
															|  | 
 |  |  * Created at 20211003
 | 
												
													
														
															|  |  */
 |  |  */
 | 
												
													
														
															|  | @RestController
 |  | @RestController
 | 
												
													
														
															|  | @RequestMapping(value = BaseHospitalRequestMapping.HealthCare.PREFIX)
 |  | @RequestMapping(value = BaseHospitalRequestMapping.HealthCare.PREFIX)
 | 
												
											
												
													
														
															|  | @ -197,4 +107,93 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
 | 
												
													
														
															|  |         return ObjEnvelop.getSuccess("ok",healthCareService.authorized(patient));
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.authorized(patient));
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/medicareOnline")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = "医保在线服务授权表单(H5表单/小程序)(N20.17.01.02)", notes = "医保在线服务授权表单(H5表单/小程序)(N20.17.01.02)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop medicareOnline(@ApiParam(name = "patient", value = "患者id", required = true)
 | 
												
													
														
															|  | 
 |  |                                  @RequestParam(value = "patient", required = true)String patient)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.medicareOnline(patient));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/register")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = "2.5.1医保挂号(N20.17.04.01)", notes = "2.5.1医保挂号(N20.17.04.01)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop register(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
 | 
												
													
														
															|  | 
 |  |                                      @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.register(outpatientId));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/registerBack")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.5.2医保挂号冲销(N20.17.04.02)", notes = " 2.5.2医保挂号冲销(N20.17.04.02)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop registerBack(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
 | 
												
													
														
															|  | 
 |  |                                @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.registerBack(outpatientId));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/feeDetailUpload")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.5.3医保费用明细上传(N20.17.04.03)", notes = " 2.5.3医保费用明细上传(N20.17.04.03)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop feeDetailUpload(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
 | 
												
													
														
															|  | 
 |  |                                    @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailUpload(outpatientId));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/feeDetailRefund")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.5.4医保费用明细上传冲销(N20.17.04.04)", notes = " 2.5.4医保费用明细上传冲销(N20.17.04.04)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop feeDetailRefund(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
 | 
												
													
														
															|  | 
 |  |                                       @RequestParam(value = "outpatientId", required = false)String outpatientId,
 | 
												
													
														
															|  | 
 |  |                                       @ApiParam(name = "prescriptionId", value = "处方id", required = true)
 | 
												
													
														
															|  | 
 |  |                                       @RequestParam(value = "prescriptionId", required = false)String prescriptionId,
 | 
												
													
														
															|  | 
 |  |                                       @ApiParam(name = "remark", value = "作废原因", required = false)
 | 
												
													
														
															|  | 
 |  |                                           @RequestParam(value = "remark", required = true)String remark)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailRefund(outpatientId,prescriptionId,remark));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/preSettlement")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.5.5医保预结算服务(N20.17.04.05)", notes = " 2.5.5医保预结算服务(N20.17.04.05)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop preSettlement(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
 | 
												
													
														
															|  | 
 |  |                                       @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.preSettlement(outpatientId));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/preSettlementRefund")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.5.6医保结算冲销服务(N20.17.04.06)", notes = " 2.5.6医保结算冲销服务(N20.17.04.06)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop preSettlementRefund(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
 | 
												
													
														
															|  | 
 |  |                                     @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.preSettlementRefund(outpatientId));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/getSettlementResultUrl")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.5.7获取医保结算页面地址(N20.17.04.07)", notes = " 2.5.7获取医保结算页面地址(N20.17.04.07)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop getSettlementResultUrl(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
 | 
												
													
														
															|  | 
 |  |                                           @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrl(outpatientId));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/getSettlementResult")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.5.8获取医保结算结果(N20.17.04.08)", notes = " 2.5.8获取医保结算结果(N20.17.04.08)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop getSettlementResult(@ApiParam(name = "code", value = "结果回参", required = true)
 | 
												
													
														
															|  | 
 |  |                                              @RequestParam(value = "code", required = false)String code)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResult(code));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/uploadMedicalHistory")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.7.1上传用户病史病情及医学报告(N20.17.06.01)", notes = " 2.7.1上传用户病史病情及医学报告(N20.17.06.01)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop uploadMedicalHistory(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
 | 
												
													
														
															|  | 
 |  |                                           @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.uploadMedicalHistory(outpatientId));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/refundMedicalHistory")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.7.2作废用户病史病情及医学报告(N20.17.06.06)", notes = " 2.7.2作废用户病史病情及医学报告(N20.17.06.06)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop refundMedicalHistory(@ApiParam(name = "outpatientId", value = "门诊id", required = false)
 | 
												
													
														
															|  | 
 |  |                                           @RequestParam(value = "outpatientId", required = false)String outpatientId,
 | 
												
													
														
															|  | 
 |  |                                            @ApiParam(name = "remark", value = "作废原因", required = false)
 | 
												
													
														
															|  | 
 |  |                                            @RequestParam(value = "remark", required = false)String remark)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.refundMedicalHistory(outpatientId,remark));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @PostMapping(value = "/uploadIcdProcess")
 | 
												
													
														
															|  | 
 |  |     @ApiOperation(value = " 2.7.3获取问诊过程数据(N20.17.06.02)", notes = " 2.7.3获取问诊过程数据(N20.17.06.02)")
 | 
												
													
														
															|  | 
 |  |     public ObjEnvelop uploadIcdProcess(@ApiParam(name = "outpatientId", value = "门诊id", required = false)
 | 
												
													
														
															|  | 
 |  |                                            @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
 | 
												
													
														
															|  | 
 |  |         return ObjEnvelop.getSuccess("ok",healthCareService.uploadIcdProcess(outpatientId));
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | }
 |  | }
 |