|
|
@@ -3,14 +3,19 @@ package org.jeecg.modules.medical.ruleengine.projectcache;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.jeecg.modules.medical.Constant;
|
|
|
import org.jeecg.modules.medical.entity.DiagnoseItems;
|
|
|
+import org.jeecg.modules.medical.entity.Diagnoses;
|
|
|
import org.jeecg.modules.medical.entity.MaterialItems;
|
|
|
import org.jeecg.modules.medical.entity.MedicalInsuranceDrugs;
|
|
|
+import org.jeecg.modules.medical.entity.OperativeItems;
|
|
|
import org.jeecg.modules.medical.entity.TreatmentItems;
|
|
|
+import org.jeecg.modules.medical.service.IDiagnoseItemsService;
|
|
|
import org.jeecg.modules.medical.service.IDiagnosesService;
|
|
|
import org.jeecg.modules.medical.service.IMaterialItemsService;
|
|
|
import org.jeecg.modules.medical.service.IMedicalInsuranceDrugsService;
|
|
|
+import org.jeecg.modules.medical.service.IOperativeItemsService;
|
|
|
import org.jeecg.modules.medical.service.ITreatmentItemsService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.HashOperations;
|
|
|
@@ -35,11 +40,13 @@ public class HisMedicalProjectCache {
|
|
|
@Autowired
|
|
|
IMaterialItemsService materialItemsService;
|
|
|
@Autowired
|
|
|
- IDiagnosesService diagnosesService;
|
|
|
+ IDiagnoseItemsService diagnoseItemsService;
|
|
|
+ @Autowired
|
|
|
+ IOperativeItemsService operativeItemsService;
|
|
|
|
|
|
@PostConstruct
|
|
|
public void initHisMedicalProjectCache() {
|
|
|
- long count = medicalInsuranceDrugsService.count();
|
|
|
+ long count = medicalInsuranceDrugsService.lambdaQuery().isNotNull(MedicalInsuranceDrugs::getItemIdHosp).isNotNull(MedicalInsuranceDrugs::getMedicineCode).count();
|
|
|
|
|
|
if (count > 0) {
|
|
|
long pageNum = count / 1000;
|
|
|
@@ -49,7 +56,7 @@ public class HisMedicalProjectCache {
|
|
|
}
|
|
|
for (int i = 1; i <= pageNum; i++) {
|
|
|
IPage page = new Page(i, 1000);
|
|
|
- List<MedicalInsuranceDrugs> medicalInsuranceDrugsList = medicalInsuranceDrugsService.page(page).getRecords();
|
|
|
+ List<MedicalInsuranceDrugs> medicalInsuranceDrugsList = medicalInsuranceDrugsService.lambdaQuery().isNotNull(MedicalInsuranceDrugs::getItemIdHosp).isNotNull(MedicalInsuranceDrugs::getMedicineCode).page(page).getRecords();
|
|
|
for (MedicalInsuranceDrugs medicalInsuranceDrugs : medicalInsuranceDrugsList) {
|
|
|
try {
|
|
|
redisTemplate.opsForHash().put(Constant.HIS_MEDICAL_DICT_KEY, medicalInsuranceDrugs.getItemIdHosp(), medicalInsuranceDrugs.getMedicineCode());
|
|
|
@@ -60,7 +67,7 @@ public class HisMedicalProjectCache {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- count = treatmentItemsService.count();
|
|
|
+ count = treatmentItemsService.lambdaQuery().isNotNull(TreatmentItems::getItemIdHosp).isNotNull(TreatmentItems::getItemId).count();
|
|
|
if (count > 0) {
|
|
|
long pageNum = count / 1000;
|
|
|
long modNum = count % 1000;
|
|
|
@@ -69,7 +76,7 @@ public class HisMedicalProjectCache {
|
|
|
}
|
|
|
for (int i = 1; i <= pageNum; i++) {
|
|
|
IPage page = new Page(i, 1000);
|
|
|
- List<TreatmentItems> treatmentItemsList = treatmentItemsService.page(page).getRecords();
|
|
|
+ List<TreatmentItems> treatmentItemsList = treatmentItemsService.lambdaQuery().isNotNull(TreatmentItems::getItemIdHosp).isNotNull(TreatmentItems::getItemId).page(page).getRecords();
|
|
|
for (TreatmentItems treatmentItems : treatmentItemsList) {
|
|
|
try {
|
|
|
redisTemplate.opsForHash().put(Constant.HIS_MEDICAL_DICT_KEY, treatmentItems.getItemIdHosp(), treatmentItems.getItemId());
|
|
|
@@ -82,7 +89,7 @@ public class HisMedicalProjectCache {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- count = materialItemsService.count();
|
|
|
+ count = materialItemsService.lambdaQuery().isNotNull(MaterialItems::getItemIdHosp).isNotNull(MaterialItems::getItemId).count();
|
|
|
if (count > 0) {
|
|
|
long pageNum = count / 1000;
|
|
|
long modNum = count % 1000;
|
|
|
@@ -91,7 +98,7 @@ public class HisMedicalProjectCache {
|
|
|
}
|
|
|
for (int i = 1; i <= pageNum; i++) {
|
|
|
IPage page = new Page(i, 1000);
|
|
|
- List<MaterialItems> materialItemsList = materialItemsService.page(page).getRecords();
|
|
|
+ List<MaterialItems> materialItemsList = materialItemsService.lambdaQuery().isNotNull(MaterialItems::getItemIdHosp).isNotNull(MaterialItems::getItemId).page(page).getRecords();
|
|
|
for (MaterialItems materialItem : materialItemsList) {
|
|
|
try {
|
|
|
redisTemplate.opsForHash().put(Constant.HIS_MEDICAL_DICT_KEY, materialItem.getItemIdHosp(), materialItem.getItemId());
|
|
|
@@ -104,7 +111,7 @@ public class HisMedicalProjectCache {
|
|
|
}
|
|
|
|
|
|
|
|
|
- count = diagnosesService.count();
|
|
|
+ count = diagnoseItemsService.lambdaQuery().isNotNull(DiagnoseItems::getDiagnoseCode).isNotNull(DiagnoseItems::getMedicalDiagnoseCode).count();
|
|
|
if (count > 0) {
|
|
|
long pageNum = count / 1000;
|
|
|
long modNum = count % 1000;
|
|
|
@@ -113,8 +120,9 @@ public class HisMedicalProjectCache {
|
|
|
}
|
|
|
for (int i = 1; i <= pageNum; i++) {
|
|
|
IPage page = new Page(i, 1000);
|
|
|
- List<DiagnoseItems> diagnoseItemsList = diagnosesService.page(page).getRecords();
|
|
|
+ List<DiagnoseItems> diagnoseItemsList = diagnoseItemsService.lambdaQuery().isNotNull(DiagnoseItems::getDiagnoseCode).isNotNull(DiagnoseItems::getMedicalDiagnoseCode).page(page).getRecords();
|
|
|
for (DiagnoseItems diagnoseItems : diagnoseItemsList) {
|
|
|
+
|
|
|
try {
|
|
|
redisTemplate.opsForHash().put(Constant.HIS_MEDICAL_DICT_KEY, diagnoseItems.getDiagnoseCode(), diagnoseItems.getMedicalDiagnoseCode());
|
|
|
redisTemplate.opsForHash().put(Constant.MEDICAL_CODE_NAME_KEY, diagnoseItems.getMedicalDiagnoseCode(), diagnoseItems.getMedicalDiagnoseName());
|
|
|
@@ -124,6 +132,29 @@ public class HisMedicalProjectCache {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ count = operativeItemsService.lambdaQuery().isNotNull(OperativeItems::getOperativeCode).isNotNull(OperativeItems::getMedicalOperativeCode).count();
|
|
|
+ if (count > 0) {
|
|
|
+ long pageNum = count / 1000;
|
|
|
+ long modNum = count % 1000;
|
|
|
+ if (modNum > 0) {
|
|
|
+ pageNum = pageNum + 1;
|
|
|
+ }
|
|
|
+ for (int i = 1; i <= pageNum; i++) {
|
|
|
+ IPage page = new Page(i, 1000);
|
|
|
+ List<OperativeItems> operativeItemsList = operativeItemsService.lambdaQuery().isNotNull(OperativeItems::getOperativeCode).isNotNull(OperativeItems::getMedicalOperativeCode).page(page).getRecords();
|
|
|
+ for(OperativeItems operativeItem : operativeItemsList){
|
|
|
+
|
|
|
+ try {
|
|
|
+ redisTemplate.opsForHash().put(Constant.HIS_MEDICAL_DICT_KEY, operativeItem.getOperativeCode(), operativeItem.getMedicalOperativeCode());
|
|
|
+ redisTemplate.opsForHash().put(Constant.MEDICAL_CODE_NAME_KEY, operativeItem.getMedicalOperativeCode(), operativeItem.getMedicalOperativeName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public <R> R loadHisMedicalMapping(String medicalProjectCode) {
|