SiMzService.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. package thyyxxk.webserver.service.medicalinsurance;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import lombok.extern.slf4j.Slf4j;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.beans.factory.annotation.Value;
  7. import org.springframework.stereotype.Service;
  8. import thyyxxk.webserver.config.exception.ExceptionEnum;
  9. import thyyxxk.webserver.constants.Capacity;
  10. import thyyxxk.webserver.constants.sidicts.Insutype;
  11. import thyyxxk.webserver.constants.sidicts.MdtrtCertType;
  12. import thyyxxk.webserver.constants.sidicts.MedType;
  13. import thyyxxk.webserver.constants.sidicts.SiFunction;
  14. import thyyxxk.webserver.dao.his.medicalinsurance.SiMzDao;
  15. import thyyxxk.webserver.entity.ResultVo;
  16. import thyyxxk.webserver.entity.markmtfees.*;
  17. import thyyxxk.webserver.entity.medicalinsurance.outpatient.*;
  18. import thyyxxk.webserver.entity.medicalinsurance.query.InsuInfo;
  19. import thyyxxk.webserver.entity.medicalinsurance.query.PsnBaseInfo;
  20. import thyyxxk.webserver.entity.medicalinsurance.query.QryPsnBsInfo;
  21. import thyyxxk.webserver.entity.medicalinsurance.query.SiPatInfo;
  22. import thyyxxk.webserver.entity.medicalinsurance.setlinfo.FundDetail;
  23. import thyyxxk.webserver.service.externalhttp.SiMzSrvc;
  24. import thyyxxk.webserver.service.externalhttp.ThmzSystem;
  25. import thyyxxk.webserver.utils.*;
  26. import java.math.BigDecimal;
  27. import java.math.RoundingMode;
  28. import java.util.*;
  29. /**
  30. * @description: 门诊医保交易
  31. * @author: DingJie
  32. * @create: 2021-05-28 16:11:19
  33. **/
  34. @Slf4j
  35. @Service
  36. public class SiMzService {
  37. private final SiMzDao dao;
  38. private final ExecService exec;
  39. private final ThmzSystem thmz;
  40. private final SiMzSrvc mzSrvc;
  41. private final SiQueryService qryService;
  42. private static final String RESULT_CODE = "infcode";
  43. private static final String ERROR_MESSAGE = "err_msg";
  44. private static final String OUTPUT = "output";
  45. @Value("${si-mz-fee-url}")
  46. private String siMzFeeUrl;
  47. @Value("${thmz-api-url}")
  48. private String thmzApiUrl;
  49. @Autowired
  50. public SiMzService(SiMzDao dao, ExecService exec, ThmzSystem thmz, SiMzSrvc mzSrvc, SiQueryService qryService) {
  51. this.dao = dao;
  52. this.exec = exec;
  53. this.thmz = thmz;
  54. this.mzSrvc = mzSrvc;
  55. this.qryService = qryService;
  56. }
  57. public ResultVo<String> outpatientRegistration(MzPatientInfo p) {
  58. p.setStaffId(TokenUtil.getTokenUserId());
  59. return mzSrvc.outpatientRegistration(siMzFeeUrl, p);
  60. }
  61. public ResultVo<String> revokeOutpatientRegistration(MzPatientInfo p) {
  62. p.setStaffId(TokenUtil.getTokenUserId());
  63. return mzSrvc.revokeOutpatientRegistration(siMzFeeUrl, p);
  64. }
  65. public ResultVo<List<Map<String, Object>>> getMzReceipts(MzPatientInfo p) {
  66. String patNo = p.getPatNo();
  67. JSONObject queryMzChargeListParam = new JSONObject();
  68. queryMzChargeListParam.put("patCardType", 21);
  69. queryMzChargeListParam.put("patCardNo", patNo);
  70. queryMzChargeListParam.put("hisOrdNum", "");
  71. queryMzChargeListParam.put("ybRequest", 1);
  72. Map<String, Object> mzChargeListMap = thmz.getMzChargeDetailForUnPaid(thmzApiUrl, queryMzChargeListParam);
  73. if (null == mzChargeListMap) {
  74. return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
  75. }
  76. if (0 != (int) mzChargeListMap.get("resultCode")) {
  77. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, mzChargeListMap.get("resultMessage").toString());
  78. }
  79. List<Map<String, Object>> finalResult = new ArrayList<>();
  80. List<Map<String, String>> mzChargeList = FilterUtil.cast(mzChargeListMap.get("data"));
  81. for (Map<String, String> item : mzChargeList) {
  82. String hisOrdNum = item.get("hisOrdNum");
  83. if (null != hisOrdNum) {
  84. String[] hisOrdNumParts = hisOrdNum.split("_");
  85. int tempTimes = Integer.parseInt(hisOrdNumParts[1]);
  86. MzVisit mzVisit = dao.selectMzVisit(patNo, tempTimes);
  87. if (null == mzVisit) {
  88. continue;
  89. }
  90. Map<String, Object> childResult = new HashMap<>(Capacity.FIVE);
  91. childResult.put("times", tempTimes);
  92. childResult.put("mzVisit", mzVisit);
  93. JSONObject queryMzChargeDetailParam = new JSONObject();
  94. queryMzChargeDetailParam.put("patientId", patNo);
  95. queryMzChargeDetailParam.put("times", tempTimes);
  96. queryMzChargeDetailParam.put("receiptNo", hisOrdNumParts[2]);
  97. mzVisit.setReceiptNo(Integer.parseInt(hisOrdNumParts[2]));
  98. Map<String, Object> mzChargeDetailMap = thmz.unPaidToFullChargeDetail(thmzApiUrl, queryMzChargeDetailParam);
  99. if (null != mzChargeDetailMap && 0 == (int) mzChargeDetailMap.get("resultCode")) {
  100. List<Map<String, Object>> mzChargeDetailList = FilterUtil.cast(mzChargeDetailMap.get("data"));
  101. mzChargeDetailList.removeIf(detail -> "TC".equals(detail.get("billItemCode")) ||
  102. !"5".equals(detail.get("payMark")) || "BILL99".equals(detail.get("chargeItemCode")) ||
  103. "四舍五入".equals(detail.get("tcName")));
  104. if (mzChargeDetailList.isEmpty()) {
  105. continue;
  106. }
  107. Map<Integer, List<MzReceipt>> orderReceiptsMap = new HashMap<>(Capacity.DEFAULT);
  108. String doctorName = dao.selectDoctorName(mzChargeDetailList.get(0).get("doctorCode").toString());
  109. mzChargeDetailList.forEach(detail -> {
  110. MzReceipt receipt = fillMzReceipt(detail);
  111. receipt.setPatientId(patNo);
  112. receipt.setTimes(tempTimes);
  113. receipt.setDoctorName(doctorName);
  114. if (!orderReceiptsMap.containsKey(receipt.getOrderNo())) {
  115. List<MzReceipt> list = new ArrayList<>();
  116. list.add(receipt);
  117. orderReceiptsMap.put(receipt.getOrderNo(), list);
  118. } else {
  119. orderReceiptsMap.get(receipt.getOrderNo()).add(receipt);
  120. }
  121. });
  122. List<OrderNo> orderNos = getOrderNos(patNo, tempTimes, mzVisit.getReceiptNo(), orderReceiptsMap);
  123. childResult.put("orderNos", orderNos);
  124. childResult.put("mzReceipts", orderReceiptsMap);
  125. finalResult.add(childResult);
  126. }
  127. }
  128. }
  129. return ResultVoUtil.success(finalResult);
  130. }
  131. public ResultVo<List<MzDepositFile>> getHistoryMzReceipts(String patNo, String start, String end) {
  132. List<MzDepositFile> mzChargeList = dao.selectMzDepositFiles(patNo, start, end);
  133. if (null == mzChargeList || mzChargeList.isEmpty()) {
  134. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有找到历史处方!");
  135. }
  136. return ResultVoUtil.success(mzChargeList);
  137. }
  138. public ResultVo<Map<String, Object>> getHistoryReceiptDetail(MzDepositFile mzDepositFile) {
  139. MzVisit mzVisit = dao.selectMzVisit(mzDepositFile.getPatNo(), mzDepositFile.getTimes());
  140. List<MzReceipt> mzReceipts = dao.selectMzCharge(mzDepositFile.getPatNo(),
  141. mzDepositFile.getTimes(), mzDepositFile.getReceiptNo());
  142. mzReceipts.forEach(itm -> itm.setChecked(StringUtil.notBlank(itm.getNationalCode())));
  143. Map<String, Object> map = new HashMap<>();
  144. map.put("mzVisit", mzVisit);
  145. map.put("mzReceipts", mzReceipts);
  146. return ResultVoUtil.success(map);
  147. }
  148. private MzReceipt fillMzReceipt(Map<String, Object> detail) {
  149. MzReceipt receipt = new MzReceipt();
  150. receipt.setReceiptNo((int) detail.get("receiptNo"));
  151. receipt.setOrderNo((int) detail.get("orderNo"));
  152. receipt.setItemNo((int) detail.get("itemNo"));
  153. receipt.setDrugName(detail.get("tcName").toString());
  154. receipt.setChargeItemCode(detail.get("chargeItemCode").toString());
  155. receipt.setPriceTime(DateUtil.formatPriceTime(detail.get("priceTime").toString()));
  156. receipt.setUnitPrice(new BigDecimal(detail.get("unitPrice").toString()).setScale(4, RoundingMode.HALF_UP));
  157. receipt.setQuantity(Double.valueOf(detail.get("quantity").toString()));
  158. receipt.setDrugWin((int) detail.get("drugWin"));
  159. receipt.setDoctorCode(detail.get("doctorCode").toString());
  160. receipt.setGroupNo(detail.get("groupNo").toString());
  161. receipt.setChargeDate(detail.get("priceTime").toString().split("\\+")[0].replace("T", " "));
  162. receipt.setBillItemCode(detail.get("billItemCode").toString());
  163. receipt.setChargeBillCode(detail.get("chargeBillCode").toString());
  164. String table = receipt.getGroupNo().trim().equals("00") ? "zd_charge_item" : "yp_zd_dict";
  165. receipt.setNationalCode(dao.selectNationalCode(receipt.getChargeItemCode(), table));
  166. receipt.setChecked(StringUtil.notBlank(receipt.getNationalCode()));
  167. if (null != detail.get("serialNo")) {
  168. receipt.setSerialNo(detail.get("serialNo").toString());
  169. }
  170. if (null != detail.get("instructionText")) {
  171. receipt.setInstructionText(detail.get("instructionText").toString());
  172. }
  173. if (null != detail.get("specification")) {
  174. receipt.setSpecification(detail.get("specification").toString());
  175. }
  176. if (null != detail.get("frequency")) {
  177. receipt.setFrequency(detail.get("frequency").toString());
  178. }
  179. if (null != detail.get("drugQuan")) {
  180. receipt.setDrugQuan(Double.valueOf(detail.get("drugQuan").toString()));
  181. }
  182. if (null != detail.get("orderDays")) {
  183. receipt.setOrderDays((Integer) detail.get("orderDays"));
  184. }
  185. // groupNo:00-项目;其他-药品
  186. if ("00".equals(receipt.getGroupNo())) {
  187. receipt.setDrugUnit(dao.selectXmChargeUnit(receipt.getChargeItemCode()));
  188. } else {
  189. if (null != detail.get("serial")) {
  190. receipt.setSerial(detail.get("serial").toString());
  191. receipt.setSpecification(dao.selectSpecification(receipt.getChargeItemCode(), receipt.getSerial()));
  192. }
  193. if (null != detail.get("supplyCode")) {
  194. receipt.setSupplyCode(dao.selectSupplyName(detail.get("supplyCode").toString()));
  195. }
  196. if (null != detail.get("drugUnit")) {
  197. receipt.setDrugUnit(dao.selectDrugUnit(detail.get("drugUnit").toString()));
  198. }
  199. }
  200. return receipt;
  201. }
  202. private List<OrderNo> getOrderNos(String patientId, int times, int receiptNo, Map<Integer, List<MzReceipt>> orderReceiptsMap) {
  203. List<OrderNo> orderNos = new ArrayList<>();
  204. for (Map.Entry<Integer, List<MzReceipt>> entry : orderReceiptsMap.entrySet()) {
  205. OrderNo orderNo = new OrderNo();
  206. orderNo.setPatientId(patientId);
  207. orderNo.setTimes(times);
  208. orderNo.setReceiptNo(entry.getValue().get(0).getReceiptNo());
  209. orderNo.setOrderNo(entry.getKey());
  210. BigDecimal total = new BigDecimal("0.00");
  211. for (MzReceipt receipt : entry.getValue()) {
  212. total = total.add(receipt.getChargeFee());
  213. }
  214. orderNo.setTotalFee(total);
  215. int count = dao.selectFeeCount(patientId, times, receiptNo, entry.getKey());
  216. orderNo.setStatus(count > 0);
  217. orderNos.add(orderNo);
  218. }
  219. return orderNos;
  220. }
  221. public ResultVo<String> insertSiMzFees(List<MzReceipt> receipts) {
  222. receipts.removeIf(item -> !item.getChecked() || item.getChargeItemCode().equals("019110")
  223. || item.getChargeItemCode().equals("019180"));
  224. if (receipts.size() == 0) {
  225. return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "患者没有可以报销的项目!");
  226. }
  227. receipts.forEach(dao::insertBatchedMtFeeInfo);
  228. return ResultVoUtil.success();
  229. }
  230. public ResultVo<String> insertSiMzFeesForSupplement(List<MzReceipt> receipts) {
  231. receipts.removeIf(item -> !item.getChecked() || item.getChargeItemCode().equals("019110")
  232. || item.getChargeItemCode().equals("019180"));
  233. if (receipts.size() == 0) {
  234. return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "患者没有可以报销的项目!");
  235. }
  236. MzReceipt receipt = receipts.get(0);
  237. List<Integer> receiptNos = dao.selectGeneratedReceiptNos(receipt.getPatientId(), receipt.getTimes());
  238. for (int receiptNo : receiptNos) {
  239. if (dao.isReceiptPayed(receipt.getPatientId(), receipt.getTimes(), receiptNo) == 0) {
  240. dao.deleteCertainReceipt(receipt.getPatientId(), receipt.getTimes(), receiptNo);
  241. }
  242. }
  243. receipts.forEach(dao::insertBatchedMtFeeInfo);
  244. return ResultVoUtil.success();
  245. }
  246. public ResultVo<String> deleteMzReceipt(OrderNo param) {
  247. dao.deleteMzReceipt(param);
  248. return ResultVoUtil.success();
  249. }
  250. public ResultVo<String> deleteAllMzReceipts(MzPatientInfo p) {
  251. if (null == p.getTimes()) {
  252. p.setTimes(dao.selectMaxTimes(p.getPatNo()));
  253. }
  254. log.info("【操作员:{}】删除所有门特处方:门诊号:{},门诊次数:{}",
  255. TokenUtil.getTokenUserId(), p.getPatNo(), p.getTimes());
  256. dao.deleteAllReceipts(p.getPatNo(), p.getTimes());
  257. return ResultVoUtil.success("删除成功。");
  258. }
  259. public ResultVo<SiPatInfo> uploadOutpatientFeeDetails(SpcChrDiseAcct p) {
  260. p.setStaffId(TokenUtil.getTokenUserId());
  261. return mzSrvc.uploadOutpatientFeeDetails(siMzFeeUrl, p);
  262. }
  263. public ResultVo<String> revokeOutpatientFeeDetails(MzPatientInfo p) {
  264. p.setStaffId(TokenUtil.getTokenUserId());
  265. return mzSrvc.revokeOutpatientFeeDetails(siMzFeeUrl, p);
  266. }
  267. public ResultVo<FundDetail> outpatientPreSettlement(MzPatientInfo p) {
  268. if (null == p.getStaffId()) {
  269. p.setStaffId(TokenUtil.getTokenUserId());
  270. }
  271. return mzSrvc.outpatientPreSettlement(siMzFeeUrl, p);
  272. }
  273. public ResultVo<FundDetail> outpatientSettlement(MzPatientInfo p) {
  274. if (null == p.getStaffId()) {
  275. p.setStaffId(TokenUtil.getTokenUserId());
  276. }
  277. return mzSrvc.outpatientSettlement(siMzFeeUrl, p);
  278. }
  279. public ResultVo<FundDetail> revokeOutpatientSettlement(MzPatientInfo p) {
  280. if (null == p.getStaffId()) {
  281. p.setStaffId(TokenUtil.getTokenUserId());
  282. }
  283. return mzSrvc.revokeOutpatientSettlement(siMzFeeUrl, p);
  284. }
  285. public void insertSiPatInfo(MzPatientInfo mz) {
  286. PsnBaseInfo patinfo = dao.selectPsnBaseinfo(mz.getPatNo(), mz.getTimes());
  287. patinfo.setTimes(-1);
  288. dao.insertSiMzInfoPsnNo(patinfo);
  289. }
  290. public ResultVo<String> saveSiMzDiags(List<SiMzDiag> diags) {
  291. if (ListUtil.isBlank(diags)) {
  292. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有要保存的诊断!");
  293. }
  294. SiMzDiag diag = diags.get(0);
  295. dao.deleteMzDiags(diag.getPatNo(), diag.getTimes());
  296. String staffId = TokenUtil.getTokenUserId();
  297. for (SiMzDiag itm : diags) {
  298. itm.setRealOpter(staffId);
  299. dao.insertNewMzDiag(itm);
  300. }
  301. return ResultVoUtil.success("门诊诊断保存成功。");
  302. }
  303. public ResultVo<List<SpcChrDiseAcct>> fetchSpcSlwinfo(String socialNo) {
  304. if (StringUtil.isBlank(socialNo)) {
  305. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者身份证号不能为空,请补充!");
  306. }
  307. JSONObject input = exec.makeTradeHeader(SiFunction.OBTAIN_BASIC_PERSON_INFO);
  308. JSONObject data = new JSONObject();
  309. data.put("mdtrt_cert_type", MdtrtCertType.RESIDENT_IDENTITY_CARD.getCode());
  310. data.put("psn_cert_type", "01");
  311. data.put("mdtrt_cert_no", socialNo);
  312. data.put("certno", socialNo);
  313. input.getJSONObject("input").put("data", data);
  314. JSONObject result = exec.executeTrade(input, SiFunction.OBTAIN_BASIC_PERSON_INFO);
  315. if (null == result) {
  316. return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
  317. }
  318. if (null == result.getInteger(RESULT_CODE)) {
  319. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的慢特病备案,或慢特病备案已过期!");
  320. }
  321. if (result.getIntValue(RESULT_CODE) == 0) {
  322. JSONObject output = result.getJSONObject(OUTPUT);
  323. JSONObject baseinfo = output.getJSONObject("baseinfo");
  324. String psnNo = baseinfo.getString("psn_no");
  325. JSONArray insuinfo = output.getJSONArray("insuinfo");
  326. Date now = new Date();
  327. List<SpcChrDiseAcct> list = new ArrayList<>();
  328. for (int i = 0; i < insuinfo.size(); i++) {
  329. JSONObject item = insuinfo.getJSONObject(i);
  330. String admdvs = item.getString("insuplc_admdvs");
  331. input = exec.makeTradeHeaderWithInsureArea(SiFunction.QUERY_SPECIAL_CHRONIC_DISEASES_ACCREDITATION, admdvs);
  332. data = new JSONObject();
  333. data.put("psn_no", psnNo);
  334. input.getJSONObject("input").put("data", data);
  335. result = exec.executeTrade(input, SiFunction.QUERY_SPECIAL_CHRONIC_DISEASES_ACCREDITATION);
  336. if (null == result) {
  337. continue;
  338. }
  339. if (null == result.getInteger(RESULT_CODE)) {
  340. continue;
  341. }
  342. if (result.getIntValue(RESULT_CODE) == 0) {
  343. output = result.getJSONObject(OUTPUT);
  344. JSONArray details = output.getJSONArray("feedetail");
  345. if (null == details || details.size() == 0) {
  346. continue;
  347. }
  348. for (int j = 0; j < details.size(); j++) {
  349. JSONObject detail = details.getJSONObject(j);
  350. SpcChrDiseAcct spcChrDiseAcct = JSONObject.parseObject(detail.toJSONString(), SpcChrDiseAcct.class);
  351. if (now.before(spcChrDiseAcct.getEnddate())) {
  352. list.add(spcChrDiseAcct);
  353. }
  354. }
  355. if (list.size() > 0) {
  356. return ResultVoUtil.success(list);
  357. }
  358. }
  359. }
  360. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的慢特病备案,或慢特病备案已过期!");
  361. }
  362. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的慢特病备案,或慢特病备案已过期!");
  363. }
  364. public Map<String, Object> queryInsuinfo(SiMzBusinessParams param) {
  365. Map<String, Object> result = new HashMap<>();
  366. QryPsnBsInfo mzptnt = new QryPsnBsInfo();
  367. mzptnt.setStaffId(param.getStaffId());
  368. mzptnt.setPatNo(param.getPatientId());
  369. mzptnt.setTimes(param.getTimes());
  370. mzptnt.setMedType(MedType.GENERAL_CLINIC.getCode());
  371. mzptnt.setOnlyQry(1);
  372. mzptnt.setTimes(-1);
  373. ResultVo<PsnBaseInfo> baseInfo = qryService.obtainBasicPersonInfo(mzptnt);
  374. if (null == baseInfo) {
  375. result.put("code", -2);
  376. result.put("msg", "网络异常。");
  377. return result;
  378. }
  379. if (baseInfo.getCode() != ExceptionEnum.SUCCESS.getCode()) {
  380. result.put("code", -2);
  381. result.put("msg", baseInfo.getMessage());
  382. return result;
  383. }
  384. // 如果有职工保险,就入库
  385. PsnBaseInfo psninfo = baseInfo.getData();
  386. InsuInfo insuInfo = getEmployeeInsuInfo(psninfo.getInsuinfo());
  387. if (null == insuInfo) {
  388. result.put("code", -1);
  389. result.put("msg", "患者没有职工医保,如需报销请走医保科流程。");
  390. return result;
  391. }
  392. if (!isInsuplcAdmdvsEligible(insuInfo.getInsuplcAdmdvs())) {
  393. result.put("code", -1);
  394. result.put("msg", "患者参保地不满足门诊统筹要求。");
  395. return result;
  396. }
  397. psninfo.setInsutype(Insutype.BASIC_MEDICAL_INSURANCE_FOR_EMPLOYEES.getCode());
  398. int count = dao.selectSiMzInfoCount(mzptnt.getPatNo(), mzptnt.getTimes());
  399. if (count == 0) {
  400. psninfo.setMedType(MedType.GENERAL_CLINIC.getCode());
  401. psninfo.setInsuplc(insuInfo.getInsuplcAdmdvs());
  402. psninfo.setPsnType(insuInfo.getPsnType());
  403. psninfo.setEmpName(insuInfo.getEmpName());
  404. psninfo.setBalc(insuInfo.getBalc());
  405. dao.insertSiMzInfoPsnNo(psninfo);
  406. } else {
  407. dao.updateSiZyInfoPsnNo(mzptnt.getPatNo(), mzptnt.getTimes(), psninfo.getInsutype(), insuInfo.getBalc());
  408. }
  409. result.put("code", 0);
  410. result.put("expContentRequired", expContentRequired(insuInfo.getInsuplcAdmdvs()));
  411. result.put("msg", "查询职工参保信息成功。");
  412. return result;
  413. }
  414. private InsuInfo getEmployeeInsuInfo(List<InsuInfo> list) {
  415. for (InsuInfo info : list) {
  416. if (info.getInsutype().equals("310")) {
  417. return info;
  418. }
  419. }
  420. return null;
  421. }
  422. private boolean isInsuplcAdmdvsEligible(String insuplc) {
  423. return !insuplc.startsWith("4304") && !insuplc.startsWith("4307");
  424. }
  425. private int expContentRequired(String insuplc) {
  426. return (insuplc.startsWith("4301") || insuplc.equals("439900")) ? 0 : 1;
  427. }
  428. public ResultVo<FundDetail> directRegistration(SiMzBusinessParams param) {
  429. return mzSrvc.directRegistration(siMzFeeUrl, param);
  430. }
  431. public ResultVo<Integer> isPatientDuringSiSettle(String patientId) {
  432. return mzSrvc.isPatientDuringSiSettle(siMzFeeUrl, patientId);
  433. }
  434. }