|
@@ -0,0 +1,87 @@
|
|
|
+package thyyxxk.webserver.service.yibao;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
+import thyyxxk.webserver.dao.yibao.YbVerifyDao;
|
|
|
+import thyyxxk.webserver.pojo.DJRet;
|
|
|
+import thyyxxk.webserver.pojo.yibao.patient.PatientPojo;
|
|
|
+import thyyxxk.webserver.pojo.yibao.ybverify.CancelRegisterRequestPojo;
|
|
|
+import thyyxxk.webserver.pojo.yibao.ybverify.IdCardUploadPojo;
|
|
|
+import thyyxxk.webserver.utils.TokenUtil;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class YbVerifyService {
|
|
|
+ private final YbVerifyDao dao;
|
|
|
+ private final YibaoHttpService http;
|
|
|
+
|
|
|
+ public YbVerifyService(YbVerifyDao dao, YibaoHttpService http) {
|
|
|
+ this.dao = dao;
|
|
|
+ this.http = http;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public DJRet approveYbsf(PatientPojo param) {
|
|
|
+ log.info("医保身份审核通过 => 操作员:{},住院号:{},住院次数:{}", TokenUtil.getTokenUserId(),
|
|
|
+ param.getInpatientNo(), param.getAdmissTimes());
|
|
|
+ if (param.getResponceType().equals("04")) {
|
|
|
+ DJRet djRet = http.httpPost("getFamilyMember", param, "04");
|
|
|
+ if (djRet.getCode() == ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ JSONObject obj = (JSONObject) djRet.getData();
|
|
|
+ JSONArray members = obj.getJSONArray("members");
|
|
|
+ for (int i = 0; i < members.size(); i++) {
|
|
|
+ JSONObject member = members.getJSONObject(i);
|
|
|
+ if (member.getString("name").trim().equals(param.getName().trim())) {
|
|
|
+ String memberSysNo = member.getString("memberNo");
|
|
|
+ param.setXnhMembersysno(memberSysNo);
|
|
|
+ dao.updateMemberSysNo(param.getInpatientNo(), memberSysNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ djRet = http.httpPost("register", param, "04");
|
|
|
+ if (djRet.getCode() == ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ IdCardUploadPojo info = dao.getSfzInfo(param.getInpatientNo(), param.getAdmissTimes());
|
|
|
+ if (info == null || info.getFileSfz() == null) {
|
|
|
+ djRet = http.httpPost("uploadScanFile", param, "04");
|
|
|
+ } else {
|
|
|
+ djRet = http.httpPost("uploadIdCard", param, "04");
|
|
|
+ }
|
|
|
+ if (djRet.getCode() == ExceptionEnum.SUCCESS.getCode()) {
|
|
|
+ dao.approveYbsf(param.getInpatientNo(), param.getAdmissTimes(), TokenUtil.getTokenUserId(), param.getYbRemark());
|
|
|
+ dao.updateZyActpatient(param.getInpatientNo(), param.getAdmissTimes());
|
|
|
+ return DJRet.success();
|
|
|
+ } else {
|
|
|
+ return djRet;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return djRet;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return djRet;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ dao.approveYbsf(param.getInpatientNo(), param.getAdmissTimes(), TokenUtil.getTokenUserId(), param.getYbRemark());
|
|
|
+ dao.updateZyActpatient(param.getInpatientNo(), param.getAdmissTimes());
|
|
|
+ return DJRet.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public DJRet rejectYbsf(PatientPojo param) {
|
|
|
+ dao.rejectYbsf(param.getInpatientNo(), param.getAdmissTimes(), param.getYbRemark());
|
|
|
+ return DJRet.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ public DJRet getUnhandledRequests(Integer requestType) {
|
|
|
+ return DJRet.success(dao.getUnhandledRequests(requestType));
|
|
|
+ }
|
|
|
+
|
|
|
+ public DJRet handleRequests(CancelRegisterRequestPojo param) {
|
|
|
+ String verifyName = dao.getVerifyName(param.getVerifyId());
|
|
|
+ param.setVerifyName(verifyName);
|
|
|
+ log.info("取消医保入院登记审核>>> {}", param);
|
|
|
+ dao.handleRequests(param);
|
|
|
+ return DJRet.success();
|
|
|
+ }
|
|
|
+}
|