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

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
 readmysqlport = 3306
150
 readmysqlport = 3306
151
 readmysqluser = root
151
 readmysqluser = root
152
 readmysqlpass = 1Q2W3e4r!@#$
152
 readmysqlpass = 1Q2W3e4r!@#$
153
-readmysqlname = test_xt
153
+readmysqlname = sgj_xt
154
 
154
 
155
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
155
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
156
 writemysqlport = 3306
156
 writemysqlport = 3306
157
 writemysqluser = root
157
 writemysqluser = root
158
 writemysqlpass = 1Q2W3e4r!@#$
158
 writemysqlpass = 1Q2W3e4r!@#$
159
-writemysqlname = test_xt
159
+writemysqlname = sgj_xt
160
 
160
 
161
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
161
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
162
 readuserport = 3306
162
 readuserport = 3306
163
 readuseruser = root
163
 readuseruser = root
164
 readuserpass = 1Q2W3e4r!@#$
164
 readuserpass = 1Q2W3e4r!@#$
165
-readusername = test_users
165
+readusername = sgj_users
166
 
166
 
167
 
167
 
168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
168
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
169
 writeuserport = 3306
169
 writeuserport = 3306
170
 writeuseruser = root
170
 writeuseruser = root
171
 writeuserpass = 1Q2W3e4r!@#$
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
 	countwo, _ := service.GetQuarterTotalCountTwo(orgid, statime, entime, lapseto)
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
 	normData, _ := service.GetNormData(orgid)
1103
 	normData, _ := service.GetNormData(orgid)
1104
 	if err != nil {
1104
 	if err != nil {
1105
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1105
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1106
 		return
1106
 		return
1107
 	}
1107
 	}
1108
 	this.ServeSuccessJSON(map[string]interface{}{
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
 	fmt.Println("第四季度", fourQuarterEndStrUnix)
1674
 	fmt.Println("第四季度", fourQuarterEndStrUnix)
1677
 	if bloodType == -1 {
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
 		if err != nil {
1692
 		if err != nil {
1695
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1693
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1696
 			return
1694
 			return
1697
 		}
1695
 		}
1698
 
1696
 
1699
 		this.ServeSuccessJSON(map[string]interface{}{
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
 	if bloodType == -2 {
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
 		if err != nil {
1720
 		if err != nil {
1723
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1721
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1725
 		}
1723
 		}
1726
 
1724
 
1727
 		this.ServeSuccessJSON(map[string]interface{}{
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
 	return "xt_inspection"
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
 type XtPatients struct {
760
 type XtPatients struct {
748
 	ID                           int64   `gorm:"column:id" json:"id" form:"id"`
761
 	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"`
762
 	UserOrgId                    int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

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

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
 	err = XTReadDB().Where("user_org_id = ? and status =1", orgid).Order("created_time desc").Find(&patients).Error
339
 	err = XTReadDB().Where("user_org_id = ? and status =1", orgid).Order("created_time desc").Find(&patients).Error
340
 	return patients, err
340
 	return patients, err
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
 	db := XTReadDB().Table("xt_monitoring_record as x")
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
 	return record, total, err
2730
 	return record, total, err
2731
 }
2731
 }
2732
 
2732
 
2737
 	return record, total, err
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
 	db := XTReadDB().Table("xt_monitoring_record as x")
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
 	return record, total, err
2744
 	return record, total, err
2745
 }
2745
 }
2746
 
2746
 

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

12
 func GetConfigList(orgID int64) (dataconfig interface{}, err error) {
12
 func GetConfigList(orgID int64) (dataconfig interface{}, err error) {
13
 	var configList []*models.Dataconfig
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
 	if err != nil {
16
 	if err != nil {
17
 		return nil, err
17
 		return nil, err
18
 	}
18
 	}