Browse Source

2024/6/17

28169 1 month ago
parent
commit
019b1957dd

BIN
XT_New.exe View File


+ 4 - 4
controllers/base_api_controller.go View File

@@ -83,7 +83,7 @@ func (this *BaseAuthAPIController) Prepare() {
83 83
 		userAdmin.ModifyTime = 1530786071
84 84
 		var subscibe models.ServeSubscibe
85 85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10633 //机构id
86
+		subscibe.OrgId = 10164 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,7 +93,7 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10633 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
97 97
 		adminUserInfo.CurrentAppId = 12627 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10633 //机构id小英9675或4
332
+		subscibe.OrgId = 10164 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,7 +339,7 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10633 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10164 //机构id小英9675或4
343 343
 		adminUserInfo.CurrentAppId = 12627 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes

+ 43 - 0
controllers/dialysis_api_controller.go View File

@@ -5612,6 +5612,49 @@ func (c *DialysisApiController) UploadDryWeight() {
5612 5612
 		fmt.Println(value)
5613 5613
 
5614 5614
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
5615
+
5616
+		//康桥
5617
+		if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 {
5618
+			timeNowStr := time.Now().Format("2006-01-02")
5619
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
5620
+
5621
+			beforAssesment, _ := service.GetPatientAssesmentBefor(patient_id, timeNewDate.Unix(), adminUserInfo.CurrentOrgId)
5622
+
5623
+			dialysisPrescription, _ := service.GetPatientDialysisPrescription(patient_id, timeNewDate.Unix(), adminUserInfo.CurrentOrgId)
5624
+
5625
+			if beforAssesment.ID > 0 {
5626
+
5627
+				service.UpdatePatientAssesmentBefor(beforAssesment.ID, dry_weight)
5628
+
5629
+				var dewater_amount float64
5630
+
5631
+				dewater_amount = beforAssesment.WeightBefore - dry_weight - beforAssesment.AdditionalWeight
5632
+
5633
+				service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
5634
+				//获取key,清空redis
5635
+				key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_prescribe"
5636
+				redis := service.RedisClient()
5637
+
5638
+				//清空key 值
5639
+				redis.Set(key, "", time.Second)
5640
+
5641
+				keyOne := "scheduals_" + timeNowStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
5642
+				//清空key 值
5643
+				redis.Set(keyOne, "", time.Second)
5644
+
5645
+				keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_solution"
5646
+				//清空key 值
5647
+				redis.Set(keyTwo, "", time.Second)
5648
+
5649
+				keySix := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":prescriptions_list_all"
5650
+				redis.Set(keySix, "", time.Second)
5651
+
5652
+				keySeven := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":dialysis_prescribe_by_mode"
5653
+				redis.Set(keySeven, "", time.Second)
5654
+			}
5655
+
5656
+		}
5657
+
5615 5658
 		loc, _ := time.LoadLocation("Local")
5616 5659
 		nowTime := time.Now()
5617 5660
 		nowDay := nowTime.Format("2006-01-02")

+ 43 - 0
controllers/doctors_api_controller.go View File

@@ -347,6 +347,49 @@ func (c *DoctorsApiController) UpdatedDryWeightData() {
347 347
 		errors := service.UpdateDialysisPrescription(patientid, orgid, dryweight, prescription)
348 348
 		fmt.Println(errors)
349 349
 	}
350
+
351
+	//康桥
352
+	if adminUserInfo.CurrentOrgId == 10702 || adminUserInfo.CurrentOrgId == 10164 {
353
+		timeNowStr := time.Now().Format("2006-01-02")
354
+		timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
355
+
356
+		beforAssesment, _ := service.GetPatientAssesmentBefor(patientid, timeNewDate.Unix(), adminUserInfo.CurrentOrgId)
357
+
358
+		dialysisPrescription, _ := service.GetPatientDialysisPrescription(patientid, timeNewDate.Unix(), adminUserInfo.CurrentOrgId)
359
+
360
+		if beforAssesment.ID > 0 {
361
+
362
+			service.UpdatePatientAssesmentBefor(beforAssesment.ID, dry_weight)
363
+
364
+			var dewater_amount float64
365
+
366
+			dewater_amount = beforAssesment.WeightBefore - dry_weight - beforAssesment.AdditionalWeight
367
+
368
+			service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
369
+			//获取key,清空redis
370
+			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_prescribe"
371
+			redis := service.RedisClient()
372
+
373
+			//清空key 值
374
+			redis.Set(key, "", time.Second)
375
+
376
+			keyOne := "scheduals_" + timeNowStr + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
377
+			//清空key 值
378
+			redis.Set(keyOne, "", time.Second)
379
+
380
+			keyTwo := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_solution"
381
+			//清空key 值
382
+			redis.Set(keyTwo, "", time.Second)
383
+
384
+			keySix := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":prescriptions_list_all"
385
+			redis.Set(keySix, "", time.Second)
386
+
387
+			keySeven := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":dialysis_prescribe_by_mode"
388
+			redis.Set(keySeven, "", time.Second)
389
+		}
390
+
391
+	}
392
+
350 393
 	key := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(patientid, 10) + ":" + strconv.FormatInt(dayTime.Unix(), 10) + ":assessment_before_dislysis"
351 394
 	redis.Set(key, "", time.Second)
352 395
 	keySix := strconv.FormatInt(orgid, 10) + ":" + strconv.FormatInt(dayTime.Unix(), 10) + ":assessment_befores_list_all"

+ 42 - 0
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -6139,6 +6139,48 @@ func (c *DialysisAPIController) UploadDryWeight() {
6139 6139
 		}
6140 6140
 
6141 6141
 		createErr := service.CreatePatientWeightAdjust(dryWeight)
6142
+
6143
+		//康桥
6144
+		if adminUserInfo.Org.Id == 10702 || adminUserInfo.Org.Id == 10164 {
6145
+			timeNowStr := time.Now().Format("2006-01-02")
6146
+			timeNewDate, _ := utils.ParseTimeStringToTime("2006-01-02", timeNowStr)
6147
+
6148
+			beforAssesment, _ := service.GetPatientAssesmentBefor(patient_id, timeNewDate.Unix(), adminUserInfo.Org.Id)
6149
+
6150
+			dialysisPrescription, _ := service.GetPatientDialysisPrescription(patient_id, timeNewDate.Unix(), adminUserInfo.Org.Id)
6151
+
6152
+			if beforAssesment.ID > 0 {
6153
+
6154
+				service.UpdatePatientAssesmentBefor(beforAssesment.ID, dry_weight)
6155
+
6156
+				var dewater_amount float64
6157
+
6158
+				dewater_amount = beforAssesment.WeightBefore - dry_weight - beforAssesment.AdditionalWeight
6159
+
6160
+				service.UpdatePatientDialysisPrscription(dialysisPrescription.ID, dewater_amount)
6161
+				//获取key,清空redis
6162
+				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_prescribe"
6163
+				redis := service.RedisClient()
6164
+
6165
+				//清空key 值
6166
+				redis.Set(key, "", time.Second)
6167
+
6168
+				keyOne := "scheduals_" + timeNowStr + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
6169
+				//清空key 值
6170
+				redis.Set(keyOne, "", time.Second)
6171
+
6172
+				keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(dialysisPrescription.ModeId, 10) + ":dialysis_solution"
6173
+				//清空key 值
6174
+				redis.Set(keyTwo, "", time.Second)
6175
+
6176
+				keySix := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":prescriptions_list_all"
6177
+				redis.Set(keySix, "", time.Second)
6178
+
6179
+				keySeven := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patient_id, 10) + ":" + strconv.FormatInt(timeNewDate.Unix(), 10) + ":dialysis_prescribe_by_mode"
6180
+				redis.Set(keySeven, "", time.Second)
6181
+			}
6182
+
6183
+		}
6142 6184
 		redis := service.RedisClient()
6143 6185
 		loc, _ := time.LoadLocation("Local")
6144 6186
 		nowTime := time.Now()

+ 9 - 9
controllers/patient_dataconfig_api_controller.go View File

@@ -571,15 +571,15 @@ func (this *PatientDataConfigAPIController) DeletePhysiqueCheck() {
571 571
 	}
572 572
 
573 573
 	adminUserInfo := this.GetAdminUserInfo()
574
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
575
-	if getPatientErr != nil {
576
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
577
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
578
-		return
579
-	} else if patient == nil {
580
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
581
-		return
582
-	}
574
+	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
575
+	//if getPatientErr != nil {
576
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
577
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
578
+	//	return
579
+	//} else if patient == nil {
580
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
581
+	//	return
582
+	//}
583 583
 
584 584
 	recordIDStrs := strings.Split(idsStr, ",")
585 585
 	recordIDs := make([]int64, 0, len(recordIDStrs))

+ 1 - 1
controllers/stock_in_api_controller.go View File

@@ -8238,7 +8238,7 @@ func (this *StockManagerApiController) UpdateBaseDrugListByUserOrgID() {
8238 8238
 	//	service.UpdateDealerManufacturerOne(item.ID, manufacturer.ManufacturerName)
8239 8239
 	//}
8240 8240
 
8241
-	drugList, _ := service.GetAllBaseDrugListTwenty(10644)
8241
+	drugList, _ := service.GetAllBaseDrugListTwentyOne(10265)
8242 8242
 
8243 8243
 	for _, item := range drugList {
8244 8244
 		var drug_spec = item.Dose + item.DoseUnit + "*" + strconv.FormatInt(item.MinNumber, 10) + item.MinUnit + "/" + item.MaxUnit

+ 1 - 0
models/user_models.go View File

@@ -202,6 +202,7 @@ type XtDialysisPrescription struct {
202 202
 	DialysisStrainer           string  `gorm:"column:dialysis_strainer" json:"dialysis_strainer" form:"dialysis_strainer"`
203 203
 	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
204 204
 	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
205
+	PrescriptionWater          float64 `gorm:"column:prescription_water" json:"prescription_water" form:"prescription_water"`
205 206
 }
206 207
 
207 208
 func (XtDialysisPrescription) TableName() string {

+ 6 - 0
service/gobal_config_service.go View File

@@ -1088,6 +1088,12 @@ func GetAllBaseDrugListTwenty(orgid int64) (drug []*models.BaseDrugLibTwenty, er
1088 1088
 	return drug, err
1089 1089
 }
1090 1090
 
1091
+func GetAllBaseDrugListTwentyOne(orgid int64) (drug []*models.BaseDrugLibTwenty, err error) {
1092
+
1093
+	err = XTReadDB().Model(&drug).Where("org_id = ? and status = 1", orgid).Find(&drug).Error
1094
+	return drug, err
1095
+}
1096
+
1091 1097
 func UpdateBaseDrugList(drug_id int64, specification_name string) error {
1092 1098
 
1093 1099
 	err := XTWriteDB().Model(&models.XtBaseDrug{}).Where("id = ? and status=1", drug_id).Updates(map[string]interface{}{"specification_name": specification_name}).Error

+ 35 - 0
service/patient_service.go View File

@@ -1826,6 +1826,41 @@ func CreatePatientWeightAdjust(m *models.SgjPatientDryweight) (err error) {
1826 1826
 	return
1827 1827
 }
1828 1828
 
1829
+func GetPatientAssesmentBefor(patient_id int64, assessment_date int64, org_id int64) (models.XtAssessmentBeforeDislysis, error) {
1830
+
1831
+	beforeDislysis := models.XtAssessmentBeforeDislysis{}
1832
+
1833
+	err := XTReadDB().Where("patient_id = ? and assessment_date = ? and user_org_id = ? and status=1", patient_id, assessment_date, org_id).Find(&beforeDislysis).Error
1834
+
1835
+	return beforeDislysis, err
1836
+}
1837
+
1838
+func GetPatientDialysisPrescription(patient_id int64, record_date int64, org_id int64) (models.XtDialysisPrescription, error) {
1839
+
1840
+	prescription := models.XtDialysisPrescription{}
1841
+
1842
+	err := XTReadDB().Where("patient_id = ? and record_date = ? and user_org_id = ? and status=1", patient_id, record_date, org_id).Find(&prescription).Error
1843
+
1844
+	return prescription, err
1845
+}
1846
+
1847
+func UpdatePatientAssesmentBefor(id int64, dry_weight float64) (models.XtAssessmentBeforeDislysis, error) {
1848
+
1849
+	beforeDislysis := models.XtAssessmentBeforeDislysis{}
1850
+	err := XTWriteDB().Model(&beforeDislysis).Where("id = ? and status=1", id).Update(map[string]interface{}{"dry_weight": dry_weight}).Error
1851
+
1852
+	return beforeDislysis, err
1853
+}
1854
+
1855
+func UpdatePatientDialysisPrscription(id int64, dewater_amount float64) (models.XtDialysisPrescription, error) {
1856
+
1857
+	prescription := models.XtDialysisPrescription{}
1858
+
1859
+	err := XTWriteDB().Model(&prescription).Where("id = ? and status =1", id).Update(map[string]interface{}{"target_ultrafiltration": dewater_amount, "prescription_water": dewater_amount}).Error
1860
+
1861
+	return prescription, err
1862
+}
1863
+
1829 1864
 func FindLastDryWeightAdjust(orgID int64, id int64) (weight models.SgjPatientDryweight, err error) {
1830 1865
 	err = readDb.Model(&models.SgjPatientDryweight{}).Where("user_org_id=? and patient_id=? and status=1", orgID, id).Order("id desc").First(&weight).Error
1831 1866
 	return

+ 1 - 1
service/stock_service.go View File

@@ -463,7 +463,7 @@ func CreateWarehousingInfo(warehousingInfo []*models.WarehousingInfo) (err error
463 463
 	if len(warehousingInfo) > 0 {
464 464
 		utx := writeDb.Begin()
465 465
 		if len(warehousingInfo) > 0 {
466
-			thisSQL := "INSERT INTO xt_warehouse_info (warehousing_id, good_id, good_type_id, number, product_date,expiry_date,warehousing_count,price,total_price,dealer,manufacturer,remark,ctime,mtime,status,org_id,warehousing_order,type,stock_count,license_number,packing_price,storehouse_id) VALUES "
466
+			thisSQL := "INSERT INTO xt_warehouse_info (warehousing_id, good_id, good_type_id, number, product_date,expiry_date,warehousing_count,price,total_price,dealer,manufacturer,remark,ctime,mtime,status,org_id,warehousing_order,type,stock_count,license_number,packing_price,storehouse_id,good_code) VALUES "
467 467
 			insertParams := make([]string, 0)
468 468
 			insertData := make([]interface{}, 0)
469 469
 			for _, info := range warehousingInfo {