Преглед на файлове

Merge branch '20200710_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20200710_xt_api_new_branch

csx преди 4 години
родител
ревизия
251f3319b5
променени са 5 файла, в които са добавени 66 реда и са изтрити 55 реда
  1. 4 4
      conf/app.conf
  2. 43 45
      controllers/new_mobile_api_controllers/common_api_controller.go
  3. 13 0
      models/patient_models.go
  4. 5 5
      service/common_service.go
  5. 1 1
      service/data.go

+ 4 - 4
conf/app.conf Целия файл

@@ -150,26 +150,26 @@ readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
150 150
 readmysqlport = 3306
151 151
 readmysqluser = root
152 152
 readmysqlpass = 1Q2W3e4r!@#$
153
-readmysqlname = test_xt
153
+readmysqlname = sgj_xt
154 154
 
155 155
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
156 156
 writemysqlport = 3306
157 157
 writemysqluser = root
158 158
 writemysqlpass = 1Q2W3e4r!@#$
159
-writemysqlname = test_xt
159
+writemysqlname = sgj_xt
160 160
 
161 161
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
162 162
 readuserport = 3306
163 163
 readuseruser = root
164 164
 readuserpass = 1Q2W3e4r!@#$
165
-readusername = test_users
165
+readusername = sgj_users
166 166
 
167 167
 
168 168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
169 169
 writeuserport = 3306
170 170
 writeuseruser = root
171 171
 writeuserpass = 1Q2W3e4r!@#$
172
-writeusername = test_users
172
+writeusername = sgj_users
173 173
 
174 174
 
175 175
 

+ 43 - 45
controllers/new_mobile_api_controllers/common_api_controller.go Целия файл

@@ -1092,29 +1092,27 @@ func (this *CommonApiController) GetFirstQuarter() {
1092 1092
 	countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
1093 1093
 
1094 1094
 	//获取收缩压数据
1095
-	_, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
1095
+	systolic, systolicTotal, parseDateErr := service.GetSystolicBloodPressure(orgid, statime, entime)
1096 1096
 	//统计收缩压合格的数据
1097
-	systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
1097
+	//systolic, sysstandTotal, parseDateErr := service.GetStandSystolicBloodPressure(orgid, statime, entime)
1098 1098
 
1099 1099
 	//获取舒张压数据
1100
-	_, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
1100
+	diastolic, diastotal, parseDateErr := service.GetDiastolicBloodPressure(orgid, statime, entime)
1101 1101
 	//获取合格舒张压数据
1102
-	diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
1102
+	//diastolic, diasstandtotal, parseDateErr := service.GetDiastolicStandPressure(orgid, statime, entime)
1103 1103
 	normData, _ := service.GetNormData(orgid)
1104 1104
 	if err != nil {
1105 1105
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1106 1106
 		return
1107 1107
 	}
1108 1108
 	this.ServeSuccessJSON(map[string]interface{}{
1109
-		"count":          count,
1110
-		"countwo":        countwo,
1111
-		"systolic":       systolic,
1112
-		"systolicTotal":  systolicTotal,
1113
-		"sysstandTotal":  sysstandTotal,
1114
-		"diastolic":      diastolic,
1115
-		"diastotal":      diastotal,
1116
-		"diasstandtotal": diasstandtotal,
1117
-		"normData":       normData,
1109
+		"count":         count,
1110
+		"countwo":       countwo,
1111
+		"systolic":      systolic,
1112
+		"systolicTotal": systolicTotal,
1113
+		"diastolic":     diastolic,
1114
+		"diastotal":     diastotal,
1115
+		"normData":      normData,
1118 1116
 	})
1119 1117
 }
1120 1118
 
@@ -1676,48 +1674,48 @@ func (this *CommonApiController) GetBloodPressureList() {
1676 1674
 	fmt.Println("第四季度", fourQuarterEndStrUnix)
1677 1675
 	if bloodType == -1 {
1678 1676
 		//统计收缩压第一季度的总数
1679
-		_, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1677
+		firstList, firstTotal, err := service.GetSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1680 1678
 		//统计收缩压第一季合格的总数
1681
-		_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1679
+		//_, firstStandTotal, err := service.GetStandSystolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1682 1680
 		//统计第二季收缩压总数
1683
-		_, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1681
+		secondelist, secondeTotal, err := service.GetSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1684 1682
 		//第二季度合格总数
1685
-		_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1683
+		//_, secondeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1686 1684
 		//统计第三季收缩压总数
1687
-		_, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1685
+		threelist, threeTotal, err := service.GetSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1688 1686
 		//第三季度合格数
1689
-		_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1687
+		//_, threeStandTotal, err := service.GetStandSystolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1690 1688
 		//第四季度总数
1691
-		_, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1689
+		fourlist, fourTotal, err := service.GetSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1692 1690
 		//第四季度合格总数
1693
-		_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1691
+		//_, fourStandTotal, err := service.GetStandSystolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1694 1692
 		if err != nil {
1695 1693
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1696 1694
 			return
1697 1695
 		}
1698 1696
 
1699 1697
 		this.ServeSuccessJSON(map[string]interface{}{
1700
-			"firstTotal":        firstTotal,
1701
-			"firstStandTotal":   firstStandTotal,
1702
-			"secondeTotal":      secondeTotal,
1703
-			"secondeStandTotal": secondeStandTotal,
1704
-			"threeTotal":        threeTotal,
1705
-			"threeStandTotal":   threeStandTotal,
1706
-			"fourTotal":         fourTotal,
1707
-			"fourStandTotal":    fourStandTotal,
1698
+			"firstTotal":   firstTotal,
1699
+			"firstList":    firstList,
1700
+			"secondelist":  secondelist,
1701
+			"secondeTotal": secondeTotal,
1702
+			"threelist":    threelist,
1703
+			"threeTotal":   threeTotal,
1704
+			"fourTotal":    fourTotal,
1705
+			"fourlist":     fourlist,
1708 1706
 		})
1709 1707
 	}
1710 1708
 
1711 1709
 	if bloodType == -2 {
1712 1710
 		//统计舒张压第一季度的总数
1713
-		_, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1714
-		_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1715
-		_, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1716
-		_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1717
-		_, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1718
-		_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1719
-		_, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1720
-		_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1711
+		firstList, firstTotal, err := service.GetDiastolicBloodPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1712
+		//_, firstStandTotal, err := service.GetDiastolicStandPressure(orgId, firstQuarterStartUnix, fisrtQuarterEndStrUnix)
1713
+		secondelist, secondeTotal, err := service.GetDiastolicBloodPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1714
+		//_, secondeStandTotal, err := service.GetDiastolicStandPressure(orgId, secondeQuarterStartUnix, secondQuarterEndStrUnix)
1715
+		threelist, threeTotal, err := service.GetDiastolicBloodPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1716
+		//_, threeStandTotal, err := service.GetDiastolicStandPressure(orgId, threeQuarterStartUnix, threeQuarterEndStrUnix)
1717
+		fourlist, fourTotal, err := service.GetDiastolicBloodPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1718
+		//_, fourStandTotal, err := service.GetDiastolicStandPressure(orgId, fourQuarterStartUnix, fourQuarterEndStrUnix)
1721 1719
 
1722 1720
 		if err != nil {
1723 1721
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
@@ -1725,14 +1723,14 @@ func (this *CommonApiController) GetBloodPressureList() {
1725 1723
 		}
1726 1724
 
1727 1725
 		this.ServeSuccessJSON(map[string]interface{}{
1728
-			"firstTotal":        firstTotal,
1729
-			"firstStandTotal":   firstStandTotal,
1730
-			"secondeTotal":      secondeTotal,
1731
-			"secondeStandTotal": secondeStandTotal,
1732
-			"threeTotal":        threeTotal,
1733
-			"threeStandTotal":   threeStandTotal,
1734
-			"fourTotal":         fourTotal,
1735
-			"fourStandTotal":    fourStandTotal,
1726
+			"firstTotal":   firstTotal,
1727
+			"firstList":    firstList,
1728
+			"secondelist":  secondelist,
1729
+			"secondeTotal": secondeTotal,
1730
+			"threelist":    threelist,
1731
+			"threeTotal":   threeTotal,
1732
+			"fourTotal":    fourTotal,
1733
+			"fourlist":     fourlist,
1736 1734
 		})
1737 1735
 	}
1738 1736
 }

+ 13 - 0
models/patient_models.go Целия файл

@@ -744,6 +744,19 @@ func (XtInspection) TableName() string {
744 744
 	return "xt_inspection"
745 745
 }
746 746
 
747
+type BloodXtPatients struct {
748
+	ID         int64  `gorm:"column:id" json:"id" form:"id"`
749
+	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
750
+	DialysisNo string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
751
+	Name       string `gorm:"column:name" json:"name" form:"name"`
752
+	IdCardNo   string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
753
+}
754
+
755
+func (BloodXtPatients) TableName() string {
756
+
757
+	return "xt_patients"
758
+}
759
+
747 760
 type XtPatients struct {
748 761
 	ID                           int64   `gorm:"column:id" json:"id" form:"id"`
749 762
 	UserOrgId                    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

+ 5 - 5
service/common_service.go Целия файл

@@ -334,7 +334,7 @@ func GetDialysisAgeData(orgID int64) (counts []*models.DialysisAgePieDataStruct,
334 334
 
335 335
 }
336 336
 
337
-func GetCurentOrgPatients(orgid int64) (patients []*models.XtPatients, err error) {
337
+func GetCurentOrgPatients(orgid int64) (patients []*models.BloodXtPatients, err error) {
338 338
 
339 339
 	err = XTReadDB().Where("user_org_id = ? and status =1", orgid).Order("created_time desc").Find(&patients).Error
340 340
 	return patients, err
@@ -2723,10 +2723,10 @@ func UpdateBloodPressure(st *models.XtQualityControlStandard, id int64) error {
2723 2723
 
2724 2724
 }
2725 2725
 
2726
-func GetSystolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.XTMonitoringRecord, total int64, err error) {
2726
+func GetSystolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.VmMonitoringRecord, total int64, err error) {
2727 2727
 
2728 2728
 	db := XTReadDB().Table("xt_monitoring_record as x")
2729
-	err = db.Select("x.id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.systolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2729
+	err = db.Select("x.id,x.systolic_blood_pressure").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.systolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2730 2730
 	return record, total, err
2731 2731
 }
2732 2732
 
@@ -2737,10 +2737,10 @@ func GetStandSystolicBloodPressure(orgid int64, startime int64, endtime int64) (
2737 2737
 	return record, total, err
2738 2738
 }
2739 2739
 
2740
-func GetDiastolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.XTMonitoringRecord, total int64, err error) {
2740
+func GetDiastolicBloodPressure(orgid int64, startime int64, endtime int64) (record []*models.VmMonitoringRecord, total int64, err error) {
2741 2741
 
2742 2742
 	db := XTReadDB().Table("xt_monitoring_record as x")
2743
-	err = db.Select("x.id").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.diastolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2743
+	err = db.Select("x.id,x.diastolic_blood_pressure").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.diastolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
2744 2744
 	return record, total, err
2745 2745
 }
2746 2746
 

+ 1 - 1
service/data.go Целия файл

@@ -12,7 +12,7 @@ import (
12 12
 func GetConfigList(orgID int64) (dataconfig interface{}, err error) {
13 13
 	var configList []*models.Dataconfig
14 14
 
15
-	err = readDb.Model(&models.Dataconfig{}).Where("(org_id in (0,?) and status = 1) or (status = 0 and delete_id_system > 0 and org_id = ?)", orgID, orgID).Order("orders desc, id asc").Find(&configList).Error
15
+	err = readDb.Model(&models.Dataconfig{}).Where("(org_id in (0,?) and status = 1) or (status = 0 and delete_id_system > 0 and org_id = ?)", orgID, orgID).Order("orders asc, id asc").Find(&configList).Error
16 16
 	if err != nil {
17 17
 		return nil, err
18 18
 	}