|
@@ -27,7 +27,7 @@ func (b InstitutionService) GetFilterItem() (levelList, typeList *[]map[string]i
|
|
|
func (b InstitutionService) Institution(in *medical.SearchInstitutionReq) (dataList []map[string]interface{}) {
|
|
|
//先查询医疗机构
|
|
|
//医疗机构查询拼接
|
|
|
- query := `{"query":{"bool":{"must":[%s],"must_not": [{"term": {"p_miname": ""}}],"should":[%s],"minimum_should_match": %d}}, "from": %d,"size": %d}`
|
|
|
+ query := `{"query":{"bool":{"must":[%s],"must_not": [{"term": {"p_miname": ""}}],"should":[%s],"minimum_should_match": %d}},"sort":{"id":{"order":"desc"}}, "from": %d,"size": %d}`
|
|
|
shouldQuery := `{"bool":{"should":[%s],"minimum_should_match": %d}}`
|
|
|
multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
|
|
|
musts := []string{}
|
|
@@ -75,8 +75,9 @@ func (b InstitutionService) Institution(in *medical.SearchInstitutionReq) (dataL
|
|
|
}
|
|
|
//机构名称处理
|
|
|
if in.CompanyName != "" {
|
|
|
- companyNameQuery := entity.SplicingString("p_miname", in.CompanyName)
|
|
|
- musts = append(musts, companyNameQuery)
|
|
|
+ /*companyNameQuery := entity.SplicingString("p_miname", in.CompanyName)
|
|
|
+ musts = append(musts, companyNameQuery)*/
|
|
|
+ musts = append(musts, fmt.Sprintf(multi_match, "\""+in.CompanyName+"\"", "\"p_miname\""))
|
|
|
}
|
|
|
//业务范围处理
|
|
|
boolsNum, bools := BusinessScopehandle(in.SdequipmentCode, multi_match, `"sdequipment"`, query_bool_must_and, bools)
|
|
@@ -126,7 +127,6 @@ func (b InstitutionService) Institution(in *medical.SearchInstitutionReq) (dataL
|
|
|
//
|
|
|
if len(countList) > 0 && countList != nil {
|
|
|
for _, value := range countList {
|
|
|
- log.Println(companyMap[value.CompanyName], value.CompanyName, companyMap[value.CompanyName])
|
|
|
if companyMap[value.CompanyName] != nil {
|
|
|
companyMap[value.CompanyName]["project_money"] = value.ProjectMoney
|
|
|
companyMap[value.CompanyName]["project_count"] = value.ProjectCount
|
|
@@ -135,7 +135,6 @@ func (b InstitutionService) Institution(in *medical.SearchInstitutionReq) (dataL
|
|
|
}
|
|
|
}
|
|
|
for _, value := range companyMap {
|
|
|
- log.Println(value)
|
|
|
dataList = append(dataList, value)
|
|
|
}
|
|
|
} else {
|
|
@@ -149,7 +148,7 @@ func (b InstitutionService) Institution(in *medical.SearchInstitutionReq) (dataL
|
|
|
func (b InstitutionService) Distributor(in *medical.SearchDistributorReq) (dataList []map[string]interface{}) {
|
|
|
//先查询医疗机构
|
|
|
//医疗机构查询拼接
|
|
|
- query := `{"query":{"bool":{"must":[%s],"must_not": [{"term": {"p_supplier": ""}}],"should":[%s],"minimum_should_match": %d}}, "from": %d,"size": %d}`
|
|
|
+ query := `{"query":{"bool":{"must":[%s],"must_not": [{"term": {"p_supplier": ""}}],"should":[%s],"minimum_should_match": %d}}, "sort":{"id":{"order":"desc"}},"from": %d,"size": %d}`
|
|
|
shouldQuery := `{"bool":{"should":[%s],"minimum_should_match": %d}}`
|
|
|
multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
|
|
|
var query_bool_must_and = `{"bool": {"must": [%s]%s}}`
|
|
@@ -193,8 +192,7 @@ func (b InstitutionService) Distributor(in *medical.SearchDistributorReq) (dataL
|
|
|
}
|
|
|
//机构名称处理
|
|
|
if in.CompanyName != "" {
|
|
|
- companyNameQuery := entity.SplicingString("p_supplier", in.CompanyName)
|
|
|
- musts = append(musts, companyNameQuery)
|
|
|
+ musts = append(musts, fmt.Sprintf(multi_match, "\""+in.CompanyName+"\"", "\"p_supplier\""))
|
|
|
}
|
|
|
shouldNumber := 0
|
|
|
if len(shoulds) > 0 {
|
|
@@ -248,7 +246,6 @@ func (b InstitutionService) Distributor(in *medical.SearchDistributorReq) (dataL
|
|
|
}
|
|
|
}
|
|
|
for _, value := range companyMap {
|
|
|
- log.Println(value)
|
|
|
dataList = append(dataList, value)
|
|
|
}
|
|
|
} else {
|