Commit 4e6225293f42458b9c6965c69b7efd67ea1e13d1

Authored by wtt
1 parent 8a952a6865

产检当天无法出结果的辅助检查项,有结果时自动写入产检报告页面

Showing 1 changed file with 270 additions and 1 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java View file @ 4e62252
1 1 package com.lyms.platform.permission.service.impl;
2 2  
  3 +import com.lyms.platform.biz.service.AntenatalExaminationService;
  4 +import com.lyms.platform.biz.service.PatientsService;
3 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
  6 +import com.lyms.platform.common.enums.YnEnums;
4 7 import com.lyms.platform.common.result.BaseResponse;
5 8 import com.lyms.platform.common.utils.JsonUtil;
6 9 import com.lyms.platform.permission.DataAccessLayerService;
7 10  
... ... @@ -9,7 +12,16 @@
9 12 import com.lyms.platform.permission.model.LisReportModel;
10 13 import com.lyms.platform.permission.model.LisReportQuery;
11 14 import com.lyms.platform.permission.service.LisService;
  15 +import com.lyms.platform.permission.service.OrganizationService;
  16 +import com.lyms.platform.pojo.AntExChuModel;
  17 +import com.lyms.platform.pojo.AntenatalExaminationModel;
12 18 import com.lyms.platform.pojo.BasicConfig;
  19 +import com.lyms.platform.pojo.Patients;
  20 +import com.lyms.platform.query.AntExChuQuery;
  21 +import com.lyms.platform.query.AntExQuery;
  22 +import com.lyms.platform.query.PatientsQuery;
  23 +import net.sf.json.JSONArray;
  24 +import net.sf.json.JSONObject;
13 25 import org.apache.commons.collections.CollectionUtils;
14 26 import org.codehaus.jackson.type.TypeReference;
15 27 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -28,7 +40,12 @@
28 40  
29 41 @Autowired
30 42 private MasterLisMapper masterLisMapper;
31   -
  43 + @Autowired
  44 + private AntenatalExaminationService antExService;
  45 + @Autowired
  46 + private PatientsService patientsService;
  47 + @Autowired
  48 + private OrganizationService organizationService;
32 49 @Override
33 50 public BaseResponse saveLisData(final List<LisReportModel> lisList,ThreadPoolTaskExecutor commonThreadPool) {
34 51 try {
... ... @@ -129,6 +146,16 @@
129 146 try {
130 147 masterLisMapper.deleteLisData(model);
131 148 masterLisMapper.saveLisData(model);
  149 +
  150 + //临时用一下,未确定使用查询方式
  151 + LisReportQuery lisReportQuery = new LisReportQuery();
  152 + lisReportQuery.setLisId(model.getLisId());
  153 + lisReportQuery.setVcCardNo(model.getVcCardNo());
  154 + lisReportQuery.setHospitalId(model.getHospitalId());
  155 +
  156 + List<LisReportModel> lisReportModels = masterLisMapper.queryLisDataByModel(lisReportQuery);
  157 + saveLisUpdateData(lisReportModels.get(0));
  158 +
132 159 } catch (Exception e)
133 160 {
134 161 continue;
... ... @@ -137,6 +164,248 @@
137 164 }
138 165 countDownLatch.countDown();
139 166 }
  167 + }
  168 +
  169 + /**
  170 + * 根据孕妇,修改检查项为空,检查项结果
  171 + * @param model
  172 + */
  173 + private void saveLisUpdateData(LisReportModel model) {
  174 +
  175 + //1获取孕妇pid
  176 + PatientsQuery patientsQuery = new PatientsQuery();
  177 + patientsQuery.setHospitalId(model.getHospitalId());
  178 + patientsQuery.setVcCardNo(model.getVcCardNo());
  179 + patientsQuery.setName(model.getName());
  180 + patientsQuery.setSort("created");
  181 + List<Patients> list = patientsService.queryPatient(patientsQuery);
  182 + Patients patients = list.get(list.size()-1);
  183 +
  184 + //2 判断更新初诊还是复诊
  185 + AntExQuery antExQuery = new AntExQuery();
  186 + antExQuery.setYn(YnEnums.YES.getId());
  187 + antExQuery.setParentId(patients.getId());
  188 + List<AntenatalExaminationModel> AntenatalExaminationModels = antExService.queryAntenatalExamination(antExQuery.convertToQuery()); //复诊记录
  189 + if (CollectionUtils.isEmpty(AntenatalExaminationModels)){
  190 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  191 + antExChuQuery.setYn(YnEnums.YES.getId());
  192 + antExChuQuery.setParentId(patients.getId());
  193 + List<AntExChuModel> antExChuModels = antExService.queryAntExChu(antExChuQuery);//初诊记录
  194 + if (CollectionUtils.isNotEmpty(antExChuModels)) {
  195 + AntExChuModel antExChuModel = antExChuModels.get(antExChuModels.size() - 1);
  196 + AntExChuModel antExChuModel1 = new AntExChuModel();
  197 + //3 更新初诊记录
  198 + antExChuModelUpadte(model, antExChuModel, antExChuModel1);
  199 + antExService.updateAntExChu(antExChuModel1,antExChuModel.getId());
  200 + }
  201 + }else {
  202 + AntenatalExaminationModel antenatalExaminationModel= AntenatalExaminationModels.get(AntenatalExaminationModels.size() - 1);
  203 + AntenatalExaminationModel antenatalExaminationModel1 = new AntenatalExaminationModel();
  204 + //3 更新复诊记录
  205 + fuZhenUpdate(model, antenatalExaminationModel, antenatalExaminationModel1);
  206 + antExService.updateOneAnt(antenatalExaminationModel1,antenatalExaminationModel.getId());
  207 + }
  208 + }
  209 +
  210 + /**
  211 + * 更新复诊记录
  212 + * @param model
  213 + * @param antenatalExaminationModel
  214 + * @param antenatalExaminationModel1
  215 + */
  216 + private void fuZhenUpdate(LisReportModel model, AntenatalExaminationModel antenatalExaminationModel, AntenatalExaminationModel antenatalExaminationModel1) {
  217 + if("".equals(antenatalExaminationModel.getHemoglobin()) || antenatalExaminationModel.getHemoglobin()==null){
  218 + antenatalExaminationModel1.setHemoglobin(getCodeValue(model, "HGB")); //血红蛋白
  219 + }
  220 + if("".equals(antenatalExaminationModel.getUrineProtein()) || antenatalExaminationModel.getUrineProtein()==null){
  221 + antenatalExaminationModel1.setUrineProtein(getCodeValue(model, "PRO")); //尿蛋白
  222 + }
  223 +
  224 + if("".equals(antenatalExaminationModel.getTtita()) || antenatalExaminationModel.getTtita()==null){
  225 + antenatalExaminationModel1.setTtita(getCodeValue(model, "T3")); // 总三碘甲状腺原氨酸(TT3)
  226 + }
  227 + if("".equals(antenatalExaminationModel.getTotalThy()) || antenatalExaminationModel.getTotalThy()==null){
  228 + antenatalExaminationModel1.setTotalThy(getCodeValue(model, "T4")); // //总甲状腺素(TT4)
  229 + }
  230 + if("".equals(antenatalExaminationModel.getFtita()) || antenatalExaminationModel.getFtita()==null){
  231 + antenatalExaminationModel1.setFtita(getCodeValue(model, "FT3")); // //游离三碘甲状腺原氨酸(FT3)
  232 + }
  233 + if("".equals(antenatalExaminationModel.getFreeThy()) || antenatalExaminationModel.getFreeThy()==null){
  234 + antenatalExaminationModel1.setFreeThy(getCodeValue(model, "FT4")); //游离甲状腺素(FT4)
  235 + }
  236 + if("".equals(antenatalExaminationModel.getPta()) || antenatalExaminationModel.getPta()==null){
  237 + antenatalExaminationModel1.setPta(getCodeValue(model, "PT")); //凝血酶原活动度(PT%)
  238 + }
  239 + if("".equals(antenatalExaminationModel.getActPar()) || antenatalExaminationModel.getActPar()==null){
  240 + antenatalExaminationModel1.setActPar(getCodeValue(model, "APTT")); //活化部分凝血活酶时间(APTT)
  241 + }
  242 + if("".equals(antenatalExaminationModel.getThrTime()) || antenatalExaminationModel.getThrTime()==null){
  243 + antenatalExaminationModel1.setThrTime(getCodeValue(model, "TT")); //凝血酶时间(TT)
  244 + }
  245 + if("".equals(antenatalExaminationModel.getFibrin()) || antenatalExaminationModel.getFibrin()==null){
  246 + antenatalExaminationModel1.setFibrin(getCodeValue(model, "FIB")); //纤维蛋白原(FIB)
  247 + }
  248 +
  249 + if("".equals(antenatalExaminationModel.getDimer()) || antenatalExaminationModel.getDimer()==null){
  250 + antenatalExaminationModel1.setDimer(getCodeValue(model, "D-Dimer")); //D-二聚体(D-Dimer)
  251 + }
  252 +
  253 + if("".equals(antenatalExaminationModel.getTotalChol()) || antenatalExaminationModel.getTotalChol()==null){
  254 + antenatalExaminationModel1.setTotalChol(getCodeValue(model, "TC")); //总胆固醇(TC)
  255 + }
  256 + if("".equals(antenatalExaminationModel.getTricer()) || antenatalExaminationModel.getTricer()==null){
  257 + antenatalExaminationModel1.setTricer(getCodeValue(model, "TG")); //甘油三酯(TG)
  258 + }
  259 + if("".equals(antenatalExaminationModel.getHighDens()) || antenatalExaminationModel.getHighDens()==null){
  260 + antenatalExaminationModel1.setHighDens(getCodeValue(model, "HDL-C")); //高密度脂蛋白胆固醇(HDL-C)
  261 + }
  262 + if("".equals(antenatalExaminationModel.getLowDens()) || antenatalExaminationModel.getLowDens()==null){
  263 + antenatalExaminationModel1.setLowDens(getCodeValue(model, "LDL-C")); //低密度脂蛋白胆固醇(LDL-C)
  264 + }
  265 +
  266 + }
  267 +
  268 + /**
  269 + * 更新初诊记录
  270 + * @param model
  271 + * @param antExChuModel
  272 + * @param antExChuModel1
  273 + */
  274 + private void antExChuModelUpadte(LisReportModel model, AntExChuModel antExChuModel, AntExChuModel antExChuModel1) {
  275 + if("".equals(antExChuModel.getXhdb()) || antExChuModel.getXhdb()==null){//血红蛋白
  276 + antExChuModel1.setXhdb(getCodeValue(model, "HGB"));
  277 + }
  278 + if("".equals(antExChuModel.getBxbjs()) || antExChuModel.getBxbjs()==null){//白细胞计数
  279 + antExChuModel1.setBxbjs(getCodeValue(model, "WBC"));
  280 + }
  281 + if("".equals(antExChuModel.getPlatelet()) || antExChuModel.getPlatelet()==null){//血小板
  282 + antExChuModel1.setPlatelet(getCodeValue(model, "PLT"));
  283 + }
  284 + if("".equals(antExChuModel.getNdb()) || antExChuModel.getNdb()==null){//尿蛋白
  285 + antExChuModel1.setNdb(getCodeValue(model, "PRO"));
  286 + }
  287 +
  288 + if("".equals(antExChuModel.getUrineKetone()) || antExChuModel.getUrineKetone()==null){//尿酮体
  289 + antExChuModel1.setUrineKetone(getCodeValue(model, "KET"));
  290 + }
  291 + if("".equals(antExChuModel.getBld()) || antExChuModel.getBld()==null){//尿潜血
  292 + antExChuModel1.setBld(getCodeValue(model, "BLD"));
  293 + }
  294 + if("".equals(antExChuModel.getAbo()) || antExChuModel.getAbo()==null){//血型
  295 + antExChuModel1.setAbo(getCodeValue(model, "ABO"));
  296 + }
  297 + if("".equals(antExChuModel.getRh()) || antExChuModel.getRh()==null){//RH血型
  298 + antExChuModel1.setRh(getCodeValue(model, "RH"));
  299 + }
  300 + if("".equals(antExChuModel.getBloodSugar()) || antExChuModel.getBloodSugar()==null){//血糖
  301 + antExChuModel1.setBloodSugar(getCodeValue(model, "GLU"));
  302 + }
  303 + if("".equals(antExChuModel.getXqgbzam()) || antExChuModel.getXqgbzam()==null){//血清谷丙转氨酶
  304 + antExChuModel1.setXqgbzam(getCodeValue(model, "ALT"));
  305 + }
  306 + if("".equals(antExChuModel.getXqgczam()) || antExChuModel.getXqgczam()==null){//血清谷草转氨酶
  307 + antExChuModel1.setXqgczam(getCodeValue(model, "AST"));
  308 + }
  309 +
  310 + if("".equals(antExChuModel.getAlbumin()) || antExChuModel.getAlbumin()==null){//白蛋白
  311 + antExChuModel1.setAlbumin(getCodeValue(model, "ALB"));
  312 + }
  313 + if("".equals(antExChuModel.getTotalBilirubin()) || antExChuModel.getTotalBilirubin()==null){//总胆红素
  314 + antExChuModel1.setTotalBilirubin(getCodeValue(model, "TBIL"));
  315 + }
  316 + if("".equals(antExChuModel.getJhBilirubin()) || antExChuModel.getJhBilirubin()==null){//结合胆红素
  317 + antExChuModel1.setJhBilirubin(getCodeValue(model, "DBIL"));
  318 + }
  319 + if("".equals(antExChuModel.getBg()) || antExChuModel.getBg()==null){//丙肝
  320 + antExChuModel1.setBg(getCodeValue(model, "HCV"));
  321 + }
  322 + if("".equals(antExChuModel.getYgbmky()) || antExChuModel.getYgbmky()==null){//乙肝表面抗原
  323 + antExChuModel1.setYgbmky(getCodeValue(model, "HBsAg"));
  324 + }
  325 + if("".equals(antExChuModel.getYgbmkt()) || antExChuModel.getYgbmkt()==null){//乙肝表面抗体
  326 + antExChuModel1.setYgbmkt(getCodeValue(model, "HBsAb"));
  327 + }
  328 + if("".equals(antExChuModel.getYgeky()) || antExChuModel.getYgeky()==null){//乙肝e抗原
  329 + antExChuModel1.setYgeky(getCodeValue(model, "HBeAg"));
  330 + }
  331 + if("".equals(antExChuModel.getYgekt()) || antExChuModel.getYgekt()==null){//乙肝e抗体
  332 + antExChuModel1.setYgekt(getCodeValue(model, "HBeAb"));
  333 + }
  334 + if("".equals(antExChuModel.getYghxkt()) || antExChuModel.getYghxkt()==null){//乙肝核心抗体
  335 + antExChuModel1.setYghxkt(getCodeValue(model, "HBcAb"));
  336 + }
  337 + if("".equals(antExChuModel.getXqjq()) || antExChuModel.getXqjq()==null){//血清肌
  338 + antExChuModel1.setXqjq(getCodeValue(model, "CRE"));
  339 + }
  340 + if("".equals(antExChuModel.getXnsd()) || antExChuModel.getXnsd()==null){//血尿素氮
  341 + antExChuModel1.setXnsd(getCodeValue(model, "UREA"));
  342 + }
  343 + if("".equals(antExChuModel.getSyjg()) || antExChuModel.getSyjg()==null){//实验结果
  344 + antExChuModel1.setSyjg(getCodeValue(model, "TP1"));
  345 + }
  346 + if("".equals(antExChuModel.getHivkt()) || antExChuModel.getHivkt()==null){//hit抗体检测
  347 + antExChuModel1.setHivkt(getCodeValue(model, "HIV1"));
  348 + }
  349 +
  350 + if("".equals(antExChuModel.getYdqjd()) || antExChuModel.getYdqjd()==null){//阴道清洁度
  351 + antExChuModel1.setYdqjd(getCodeValue(model, "QJD"));
  352 + }
  353 + if("".equals(antExChuModel.getTtita()) || antExChuModel.getTtita()==null){
  354 + antExChuModel1.setTtita(getCodeValue(model, "T3")); // 总三碘甲状腺原氨酸(TT3)
  355 + }
  356 + if("".equals(antExChuModel.getTotalThy()) || antExChuModel.getTotalThy()==null){
  357 + antExChuModel1.setTotalThy(getCodeValue(model, "T4")); //总甲状腺素(TT4)
  358 + }
  359 + if("".equals(antExChuModel.getFtita()) || antExChuModel.getFtita()==null){
  360 + antExChuModel1.setFtita(getCodeValue(model, "FT3")); // //游离三碘甲状腺原氨酸(FT3)
  361 + }
  362 + if("".equals(antExChuModel.getFreeThy()) || antExChuModel.getFreeThy()==null){
  363 + antExChuModel1.setFreeThy(getCodeValue(model, "FT4")); //游离甲状腺素(FT4)
  364 + }
  365 + if("".equals(antExChuModel.getPta()) || antExChuModel.getPta()==null){
  366 + antExChuModel1.setPta(getCodeValue(model, "PT")); //凝血酶原活动度(PT%)
  367 + }
  368 + if("".equals(antExChuModel.getActPar()) || antExChuModel.getActPar()==null){
  369 + antExChuModel1.setActPar(getCodeValue(model, "APTT")); //活化部分凝血活酶时间(APTT)
  370 + }
  371 + if("".equals(antExChuModel.getThrTime()) || antExChuModel.getThrTime()==null){
  372 + antExChuModel1.setThrTime(getCodeValue(model, "TT")); //凝血酶时间(TT)
  373 + }
  374 + if("".equals(antExChuModel.getFibrin()) || antExChuModel.getFibrin()==null){
  375 + antExChuModel1.setFibrin(getCodeValue(model, "FIB")); //纤维蛋白原(FIB)
  376 + }
  377 +
  378 + if("".equals(antExChuModel.getDimer()) || antExChuModel.getDimer()==null){
  379 + antExChuModel1.setDimer(getCodeValue(model, "D-Dimer")); //D-二聚体(D-Dimer)
  380 + }
  381 +
  382 + if("".equals(antExChuModel.getTotalChol()) || antExChuModel.getTotalChol()==null){
  383 + antExChuModel1.setTotalChol(getCodeValue(model, "TC")); //总胆固醇(TC)
  384 + }
  385 + if("".equals(antExChuModel.getTricer()) || antExChuModel.getTricer()==null){
  386 + antExChuModel1.setTricer(getCodeValue(model, "TG")); //甘油三酯(TG)
  387 + }
  388 + if("".equals(antExChuModel.getHighDens()) || antExChuModel.getHighDens()==null){
  389 + antExChuModel1.setHighDens(getCodeValue(model, "HDL-C")); //高密度脂蛋白胆固醇(HDL-C)
  390 + }
  391 + if("".equals(antExChuModel.getLowDens()) || antExChuModel.getLowDens()==null){
  392 + antExChuModel1.setLowDens(getCodeValue(model, "LDL-C")); //低密度脂蛋白胆固醇(LDL-C)
  393 + }
  394 +
  395 + }
  396 +
  397 +
  398 + private String getCodeValue(LisReportModel model, String codeStr) {
  399 + JSONArray jsonArray=JSONArray.fromObject(model.getItemJson());
  400 + for (int i = 0; i < jsonArray.size(); i++) {
  401 + Object o=jsonArray.get(i);
  402 + JSONObject jsonObject2=JSONObject.fromObject(o);
  403 + String code = (String)jsonObject2.get("code");
  404 + if (code.equals(codeStr)){
  405 + return (String)jsonObject2.get("result");
  406 + }
  407 + }
  408 + return null;
140 409 }
141 410 }