package thyyxxk.webserver.service.medicalinsurance; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import thyyxxk.webserver.constants.MedicalInsuranceFunction; import thyyxxk.webserver.entity.ResultVo; import thyyxxk.webserver.utils.DateUtil; import thyyxxk.webserver.utils.SiMsgIdUtil; /** * @description: 医保交易实现 * @author: DingJie * @create: 2021-05-14 16:28:16 **/ @Slf4j @Service public class MedicalInsuranceService { @Value("${si-api-url}") private String siApiUrl; public ResultVo obtainBasicPersonInfo(String socialNo, String name) { JSONObject header = makeParamHeader(MedicalInsuranceFunction.OBTAIN_BASIC_PERSON_INFO); JSONObject param = new JSONObject(); param.put("mdtrt_cert_type", "02"); param.put("mdtrt_cert_no", socialNo); param.put("card_sn", ""); param.put("begintime", ""); param.put("psn_cert_type", "1"); param.put("certno", socialNo); param.put("psn_name", name); header.getJSONObject("input").put("data", param); RestTemplate template = new RestTemplate(); JSONObject result = template.postForObject(siApiUrl, param, JSONObject.class); return null; } private JSONObject makeParamHeader(MedicalInsuranceFunction function) { JSONObject header = new JSONObject(); JSONObject input = new JSONObject(); header.put("infno", function.getCode()); header.put("msgid", SiMsgIdUtil.makeMsgId()); header.put("mdtrtarea_admvs", "就医地医保区划"); header.put("insuplc_admdvs", "参保地医保区划"); header.put("recer_sys_code", "接收方系统代码"); header.put("dev_no", ""); header.put("dev_safe_info", ""); header.put("cainfo", ""); header.put("signtype", ""); header.put("infver", "V1.0"); header.put("opter_type", "1"); header.put("opter", "经办人"); header.put("opter_name", "经办人姓名"); header.put("inf_time", DateUtil.now()); header.put("fixmedins_code", SiMsgIdUtil.INSTITUTION_ID); header.put("fixmedins_name", "湖南泰和医院"); header.put("sign_no", "交易签到流水号"); header.put("input", input); return header; } }