Browse Source

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

陈少旭 1 week ago
parent
commit
2d136064c8

BIN
XT_New.exe View File


+ 12 - 7
controllers/patient_api_controller.go View File

@@ -330,6 +330,7 @@ func (c *PatientApiController) GetPatientsList() {
330 330
 	patientSoureType, _ := c.GetInt64("patientSoureType")
331 331
 	patient_type, _ := c.GetInt64("patient_type")
332 332
 	nurse, _ := c.GetInt64("nurse")
333
+	insuplc_admdvs_name := c.GetString("insuplc_admdvs_name")
333 334
 	if page <= 0 {
334 335
 		page = 1
335 336
 	}
@@ -368,7 +369,7 @@ func (c *PatientApiController) GetPatientsList() {
368 369
 
369 370
 	var patients []*models.Patients
370 371
 	var total int64
371
-	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse, patient_type)
372
+	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse, patient_type, insuplc_admdvs_name)
372 373
 
373 374
 	c.ServeSuccessJSON(map[string]interface{}{
374 375
 		"patients": patients,
@@ -6304,6 +6305,8 @@ func (c *PatientApiController) GetRemindPatientList() {
6304 6305
 	limit, _ := c.GetInt64("limit", 10)
6305 6306
 	adminUserInfo := c.GetAdminUserInfo()
6306 6307
 	total, patients, _ := service.GetAllWaitRemindPatient(adminUserInfo.CurrentOrgId, page, limit)
6308
+
6309
+	patientZoneList, _ := service.GetPatientZoneList(adminUserInfo.CurrentOrgId)
6307 6310
 	_, errcode := service.GetOrgFollowIsExist(c.GetAdminUserInfo().CurrentOrgId)
6308 6311
 	if errcode == gorm.ErrRecordNotFound {
6309 6312
 		information, err := service.GetAdminUserRoleInformation(0)
@@ -6313,9 +6316,10 @@ func (c *PatientApiController) GetRemindPatientList() {
6313 6316
 			return
6314 6317
 		}
6315 6318
 		c.ServeSuccessJSON(map[string]interface{}{
6316
-			"total":       total,
6317
-			"patients":    patients,
6318
-			"information": information,
6319
+			"total":           total,
6320
+			"patients":        patients,
6321
+			"information":     information,
6322
+			"patientZoneList": patientZoneList,
6319 6323
 		})
6320 6324
 	} else if errcode == nil {
6321 6325
 		information, err := service.GetAdminUserRoleInformation(c.GetAdminUserInfo().CurrentOrgId)
@@ -6325,9 +6329,10 @@ func (c *PatientApiController) GetRemindPatientList() {
6325 6329
 			return
6326 6330
 		}
6327 6331
 		c.ServeSuccessJSON(map[string]interface{}{
6328
-			"total":       total,
6329
-			"patients":    patients,
6330
-			"information": information,
6332
+			"total":           total,
6333
+			"patients":        patients,
6334
+			"information":     information,
6335
+			"patientZoneList": patientZoneList,
6331 6336
 		})
6332 6337
 	}
6333 6338
 }

+ 2 - 1
controllers/pharmacy_controller.go View File

@@ -325,7 +325,7 @@ func (this *PharmacyController) GetPharmacyContent() {
325 325
 	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
326 326
 	list_p, err := service.GetPatientProject(orgid, patient_id, stime, etime, is_medicine)
327 327
 	list = append(list, list_p...)
328
-	//baseList, _ := service.GetAllBaseDrugListTwo(orgid)
328
+	baseList, _ := service.GetAllBaseDrugListTwo(orgid)
329 329
 	patients, _ := service.GetPatientByIDOne(orgid, patient_id)
330 330
 	//zoneList, _ := service.GetAllZoneByList(orgid)
331 331
 	appId := this.GetAdminUserInfo().CurrentAppId
@@ -347,6 +347,7 @@ func (this *PharmacyController) GetPharmacyContent() {
347 347
 	return_value["prescription"] = prescriptionListByToDay
348 348
 	return_value["diagnose"] = diagnose
349 349
 	return_value["config"] = config
350
+	return_value["baseList"] = baseList
350 351
 
351 352
 	this.ServeSuccessJSON(return_value)
352 353
 	return

+ 0 - 1
controllers/statistics_api_controller.go View File

@@ -1396,7 +1396,6 @@ func (c *StatisticsApiController) GetAnticoagulant() {
1396 1396
 	var startTime int64
1397 1397
 	if len(start_date) > 0 {
1398 1398
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_date+" 00:00:00", loc)
1399
-		fmt.Println("err-----------", err)
1400 1399
 		if err != nil {
1401 1400
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1402 1401
 			return

+ 2 - 0
models/patient_models.go View File

@@ -105,6 +105,7 @@ type VMDoctorAdviceForList struct {
105 105
 	CheckTime      int64 `gorm:"column:check_time" json:"check_time" form:"check_time"`
106 106
 	CheckState     int64 `gorm:"column:check_state" json:"check_state" form:"check_state"`
107 107
 	ParentId       int64 `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
108
+	AdviceType     int64 `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
108 109
 }
109 110
 
110 111
 func (VMDoctorAdviceForList) TableName() string {
@@ -1268,6 +1269,7 @@ type XtPatients struct {
1268 1269
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
1269 1270
 	Url                          string  `gorm:"column:url" json:"url" form:"url"`
1270 1271
 	FirstLetter                  string  `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
1272
+	InsuplcAdmdvsName            string  `gorm:"column:insuplc_admdvs_name" json:"insuplc_admdvs_name" form:"insuplc_admdvs_name"`
1271 1273
 }
1272 1274
 
1273 1275
 func (XtPatients) TableName() string {

+ 16 - 4
service/patient_service.go View File

@@ -14,7 +14,7 @@ import (
14 14
 )
15 15
 
16 16
 // GetPatientList 返回患者的列表
17
-func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64, patient_type int64) (patients []*models.Patients, total int64, err error) {
17
+func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64, patient_type int64, insuplc_admdvs_name string) (patients []*models.Patients, total int64, err error) {
18 18
 
19 19
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
20 20
 	if orgID > 0 {
@@ -26,6 +26,11 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
26 26
 		db = db.Where("p.name LIKE ? OR p.dialysis_no LIKE ? OR p.first_letter LIKE ?", likeKey, likeKey, likeKey)
27 27
 	}
28 28
 
29
+	if insuplc_admdvs_name != "全部" {
30
+
31
+		db = db.Where("p.insuplc_admdvs_name = ?", insuplc_admdvs_name)
32
+	}
33
+
29 34
 	if schedulType > 0 {
30 35
 		db = db.Joins("JOIN xt_schedule as s ON s.patient_id=p.id")
31 36
 		db = db.Where("s.status=1 and s.schedule_type=?", schedulType)
@@ -1900,6 +1905,13 @@ func GetAllWaitRemindPatient(org_id int64, page int64, limit int64) (total int64
1900 1905
 	return totals.Count, patient, err
1901 1906
 }
1902 1907
 
1908
+func GetPatientZoneList(org_id int64) (patients []*models.XtPatients, err error) {
1909
+
1910
+	err = XTReadDB().Where("user_org_id = ? and status =1 and patient_type =1 and insuplc_admdvs_name!=''", org_id).Group("insuplc_admdvs_name").Find(&patients).Error
1911
+
1912
+	return patients, err
1913
+}
1914
+
1903 1915
 func UpdatePatientRemindStatus(patient_id int64, remind int64, org_id int64) (err error) {
1904 1916
 	err = writeDb.Model(&models.Patients{}).Where("status = 1  AND id = ? AND user_org_id = ?", patient_id, org_id).Updates(map[string]interface{}{"is_open_remind": remind}).Error
1905 1917
 	return
@@ -3317,15 +3329,15 @@ func GetNewMonitorRecord(orgID int64, date int64, partition int64, patientId int
3317 3329
 func GetAdviceList(user_org_id int64, advice_date int64, pat_type int64) (advice []*models.VMDoctorAdviceForList, err error) {
3318 3330
 
3319 3331
 	if pat_type == 0 {
3320
-		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =7 and check_time = 0", user_org_id, advice_date).Find(&advice).Error
3332
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =7 and check_time = 0 and (advice_type=2 or advice_type =3)", user_org_id, advice_date).Find(&advice).Error
3321 3333
 	}
3322 3334
 	//待医嘱核对
3323 3335
 	if pat_type == 1 {
3324
-		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and check_time = 0", user_org_id, advice_date).Find(&advice).Error
3336
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and check_time = 0 and (advice_type=2 or advice_type =3)", user_org_id, advice_date).Find(&advice).Error
3325 3337
 	}
3326 3338
 	//待医嘱执行
3327 3339
 	if pat_type == 6 {
3328
-		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and execution_state = 2", user_org_id, advice_date).Find(&advice).Error
3340
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and execution_state = 2 and (advice_type=2 or advice_type =3)", user_org_id, advice_date).Find(&advice).Error
3329 3341
 
3330 3342
 	}
3331 3343
 	return advice, err

+ 11 - 11
service/warhouse_service.go View File

@@ -6112,9 +6112,9 @@ func UpdateDrugWarehouseOutInfo(id int64, warehouse_info_id int64, org_id int64,
6112 6112
 	return err
6113 6113
 }
6114 6114
 
6115
-func UpdateNewDrugWarehouseOutInfo(id int64, warehouse_info_id int64, org_id int64, over_count int64, drug_price float64, tx *gorm.DB) error {
6115
+func UpdateNewDrugWarehouseOutInfo(id int64, warehouse_info_id int64, org_id int64, over_count int64, drug_price float64, batch_number string, tx *gorm.DB) error {
6116 6116
 
6117
-	err = tx.Model(&models.DrugWarehouseOutInfo{}).Where("id = ? and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count, "price": drug_price, "retail_price": drug_price}).Error
6117
+	err = tx.Model(&models.DrugWarehouseOutInfo{}).Where("id = ? and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count, "price": drug_price, "retail_price": drug_price, "batch_number": batch_number}).Error
6118 6118
 	if err != nil {
6119 6119
 		tx.Rollback()
6120 6120
 		return err
@@ -6145,9 +6145,9 @@ func GetDrugOutFlowByWarehouseOut(drug_id int64, warehouse_out_detail_id int64,
6145 6145
 	return flow, err
6146 6146
 }
6147 6147
 
6148
-func UpdateNewGoodWarehouseOutById(id int64, warehouse_info_id int64, org_id int64, over_count int64, tx *gorm.DB) error {
6148
+func UpdateNewGoodWarehouseOutById(id int64, warehouse_info_id int64, org_id int64, over_count int64, number string, tx *gorm.DB) error {
6149 6149
 
6150
-	err := tx.Model(models.WarehouseOutInfo{}).Where("id = ?  and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count}).Error
6150
+	err := tx.Model(models.WarehouseOutInfo{}).Where("id = ?  and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count, "number": number}).Error
6151 6151
 	if err != nil {
6152 6152
 		tx.Rollback()
6153 6153
 		return err
@@ -8340,7 +8340,7 @@ func ConsumableNewPrescriptionDelivery(orgID int64, patient_id int64, record_tim
8340 8340
 		}
8341 8341
 
8342 8342
 		//添加入库ID
8343
-		errWarehouse := UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, tx)
8343
+		errWarehouse := UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, warehouse.Number, tx)
8344 8344
 		if errWarehouse != nil {
8345 8345
 			goodErrcode := models.XtGoodErrcode{
8346 8346
 				UserOrgId:      orgID,
@@ -8668,7 +8668,7 @@ func ConsumableNewPrescriptionDelivery(orgID int64, patient_id int64, record_tim
8668 8668
 			ModifyNewAddGoodSumCount(goods.StorehouseId, flow.Count, orgID, goods.GoodId, tx)
8669 8669
 		}
8670 8670
 
8671
-		errWarehouse := UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, tx)
8671
+		errWarehouse := UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, warehouse.Number, tx)
8672 8672
 		if errWarehouse != nil {
8673 8673
 			goodErrcode := models.XtGoodErrcode{
8674 8674
 				UserOrgId:      orgID,
@@ -8934,7 +8934,7 @@ func ConsumableNewHisPrescriptionDelivery(orgID int64, patient_id int64, record_
8934 8934
 
8935 8935
 		ModifyNewGoodSumCount(goods.StorehouseId, stock_number, orgID, goods.GoodId, tx)
8936 8936
 
8937
-		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, tx)
8937
+		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, warehouse.Number, tx)
8938 8938
 
8939 8939
 	}
8940 8940
 	dialyPrepareOne := &models.DialysisBeforePrepare{
@@ -10925,7 +10925,7 @@ func ConsumablesNewDeliveryThirty(orgID int64, record_time int64, goods *models.
10925 10925
 		CreateOutInfoLog(outInfoLog, tx)
10926 10926
 
10927 10927
 		//添加入库ID
10928
-		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, tx)
10928
+		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, warehouse.Number, tx)
10929 10929
 
10930 10930
 		//更新出库数量
10931 10931
 		ModifyNewGoodSumCount(goods.StorehouseId, goods.Count, goods.OrgId, goods.GoodId, tx)
@@ -11002,7 +11002,7 @@ func ConsumablesNewDeliveryThirty(orgID int64, record_time int64, goods *models.
11002 11002
 
11003 11003
 		CreateOutInfoLog(outInfoLog, tx)
11004 11004
 
11005
-		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, tx)
11005
+		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, warehouse.Number, tx)
11006 11006
 
11007 11007
 		//更新出库数量
11008 11008
 		ModifyNewGoodSumCount(goods.StorehouseId, stock_number, goods.OrgId, goods.GoodId, tx)
@@ -11268,7 +11268,7 @@ func AutoNewDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, wareh
11268 11268
 		CreateDrugOutInfoLog(outInfoLog, tx)
11269 11269
 
11270 11270
 		//更新出库id
11271
-		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, tx)
11271
+		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, warehouse.BatchNumber, tx)
11272 11272
 
11273 11273
 		return nil
11274 11274
 
@@ -11348,7 +11348,7 @@ func AutoNewDrugDeliverInfoFourtyOne(orgID int64, prescribingNumber int64, wareh
11348 11348
 		}
11349 11349
 		CreateDrugOutInfoLog(outInfoLog, tx)
11350 11350
 		//更新出库id
11351
-		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, tx)
11351
+		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, warehouse.Number, tx)
11352 11352
 		// 出库完成后,要将该批次库存清零
11353 11353
 
11354 11354
 		prescribingNumber_two_temp := deliver_number - stock_number